mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-13 12:40:24 +08:00
Merge Chris's cv docs updates.
This commit is contained in:
@@ -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'
|
||||
|
||||
+1710
-2342
File diff suppressed because it is too large
Load Diff
@@ -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:
|
||||
|
||||
+9213
-9020
File diff suppressed because it is too large
Load Diff
+636
-232
File diff suppressed because it is too large
Load Diff
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user