Merge Chris's cv docs updates.

This commit is contained in:
Stefan van der Walt
2009-10-31 23:13:55 +02:00
6 changed files with 11617 additions and 11599 deletions
+47
View File
@@ -0,0 +1,47 @@
from textwrap import dedent
import numpy as np
# some utility functions for the opencv wrappers
# the doc decorator
class cvdoc(object):
''' a doc decorator which adds the docs for the opencv functions.
It primarily serves to append the appropriate opencv doc url
to each function.
'''
base_url = 'http://opencv.willowgarage.com/documentation/'
branch_urls = {'cv': {'image': 'image_processing',
'structural': 'structural_analysis',
'calibration': 'camera_calibration_and_3D_reconstruction'
},
'cxcore': {},
'highgui': {}
}
def __init__(self, package='', group='', doc=''):
self.package = str(package)
self.group = str(group)
self.doc = str(doc)
def __call__(self, func):
# if key errors occur, fail silently
try:
self._add_url(func)
np.add_docstring(func, self.doc)
return func
except KeyError:
return func
def _add_url(self, func):
name = func.__name__
full_url = (self.base_url +
self.branch_urls[self.package][self.group] +
'.html' + '#' + name)
message = dedent('''
The OpenCV documentation for this fuction can
be found at the following url:''')
self.doc += '\n\n' + message + '\n\n' + full_url + '\n'
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -117,7 +117,13 @@ cdef CvMat* cvmat_ptr_from_iplimage(IplImage* arr):
return mat_hdr
cdef int validate_array(np.ndarray arr) except -1:
assert PyArray_ISCONTIGUOUS(arr), 'Array must be contiguous'
# this assertion prevents the use of slices, so
# we need to be more creative about how to deal
# with non-contiguous arrays
#assert PyArray_ISCONTIGUOUS(arr), 'Array must be contiguous'
if arr.ndim != 2 and arr.ndim != 3:
raise ValueError('Arrays must have either 2 or 3 dimensions')
if arr.ndim == 3:
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -77,7 +77,7 @@ class TestFindCornerSubPix(object):
[2, 5],
[5, 2],
[5, 5]], dtype='float32')
cvFindCornerSubPix(img, corners, 4, (2, 2))
cvFindCornerSubPix(img, corners, (2, 2))
class TestGoodFeaturesToTrack(OpenCVTest):
@@ -103,8 +103,8 @@ class TestGetQuadrangleSubPix(OpenCVTest):
class TestResize(OpenCVTest):
@opencv_skip
def test_cvResize(self):
cvResize(self.lena_RGB_U8, height=50, width=50, method=CV_INTER_LINEAR)
cvResize(self.lena_RGB_U8, height=200, width=200, method=CV_INTER_CUBIC)
cvResize(self.lena_RGB_U8, (50, 50), method=CV_INTER_LINEAR)
cvResize(self.lena_RGB_U8, (200, 200), method=CV_INTER_CUBIC)
class TestWarpAffine(OpenCVTest):
@@ -167,7 +167,7 @@ class TestSmooth(OpenCVTest):
def test_cvSmooth(self):
for st in (CV_BLUR_NO_SCALE, CV_BLUR, CV_GAUSSIAN, CV_MEDIAN,
CV_BILATERAL):
cvSmooth(self.lena_GRAY_U8, None, st, 3, 0, 0, 0, False)
cvSmooth(self.lena_GRAY_U8, st, 3, 0, 0, 0, False)
class TestFilter2D(OpenCVTest):