mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 12:14:59 +08:00
Added support for cvDrawChessboardCorners
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Generated by Cython 0.11.3 on Thu Oct 15 09:01:25 2009 */
|
||||
/* Generated by Cython 0.11.3 on Thu Oct 15 12:51:38 2009 */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
@@ -2408,7 +2408,6 @@ static struct __pyx_t_7scikits_5image_6opencv_11opencv_type_CvTermCriteria __py
|
||||
* crit.epsilon = epsilon
|
||||
* return crit # <<<<<<<<<<<<<<
|
||||
*
|
||||
*
|
||||
*/
|
||||
__pyx_r = __pyx_v_crit;
|
||||
goto __pyx_L0;
|
||||
|
||||
@@ -196,10 +196,3 @@ cdef CvTermCriteria get_cvTermCriteria(int iterations, double epsilon):
|
||||
crit.max_iter = 0
|
||||
crit.epsilon = epsilon
|
||||
return crit
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1025
-786
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,11 @@ ctypedef void (*cvFindChessboardCornersPtr)(IplImage*, CvSize, CvPoint2D32f*, in
|
||||
cdef cvFindChessboardCornersPtr c_cvFindChessboardCorners
|
||||
c_cvFindChessboardCorners = (<cvFindChessboardCornersPtr*><size_t>ctypes.addressof(cv.cvFindChessboardCorners))[0]
|
||||
|
||||
# cvDrawChessboardCorners
|
||||
ctypedef void (*cvDrawChessboardCornersPtr)(IplImage*, CvSize, CvPoint2D32f*, int, int)
|
||||
cdef cvDrawChessboardCornersPtr c_cvDrawChessboardCorners
|
||||
c_cvDrawChessboardCorners = (<cvDrawChessboardCornersPtr*><size_t>ctypes.addressof(cv.cvDrawChessboardCorners))[0]
|
||||
|
||||
# cvSmooth
|
||||
ctypedef void (*cvSmoothPtr)(IplImage*, IplImage*, int, int, int, double, double)
|
||||
cdef cvSmoothPtr c_cvSmooth
|
||||
@@ -103,7 +108,6 @@ def cvFindChessboardCorners(np.ndarray src, pattern_size, int flags = CV_CALIB_C
|
||||
outshape[1] = <int> 2 # pattern_size[0]
|
||||
|
||||
points = new_array(2, outshape, FLOAT32)
|
||||
points[:] = 0
|
||||
cdef CvPoint2D32f* cvpoints = array_as_cvPoint2D32f_ptr(points)
|
||||
|
||||
cdef CvSize cvpattern_size
|
||||
@@ -118,6 +122,38 @@ def cvFindChessboardCorners(np.ndarray src, pattern_size, int flags = CV_CALIB_C
|
||||
|
||||
return points[:ncorners_found]
|
||||
|
||||
def cvDrawChessboardCorners(np.ndarray out, pattern_size, np.ndarray corners):
|
||||
"""
|
||||
Wrapper around the OpenCV cvDrawChessboardCorners function.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
out : ndarray, dim 3, dtype: uint8
|
||||
Image to draw into
|
||||
pattern_size : array_like, shape (2,)
|
||||
Number of inner corners (w,h)
|
||||
corners : ndarray, shape (n,2), dtype: float32
|
||||
Corners found in the image. See cvFindChessboardCorners and
|
||||
cvFindCornerSubPix
|
||||
"""
|
||||
validate_array(out)
|
||||
|
||||
assert_nchannels(out, [3])
|
||||
assert_dtype(out, [UINT8])
|
||||
|
||||
cdef CvSize cvpattern_size
|
||||
cvpattern_size.height = pattern_size[1]
|
||||
cvpattern_size.width = pattern_size[0]
|
||||
|
||||
cdef IplImage img
|
||||
populate_iplimage(out, &img)
|
||||
|
||||
cdef CvPoint2D32f* cvcorners = array_as_cvPoint2D32f_ptr(corners)
|
||||
|
||||
cdef int ncount = pattern_size[0]*pattern_size[1]
|
||||
c_cvDrawChessboardCorners(&img, cvpattern_size, cvcorners,
|
||||
ncount, <int> len(corners) == ncount)
|
||||
|
||||
def cvSobel(np.ndarray src, np.ndarray out=None, int xorder=1, int yorder=0,
|
||||
int aperture_size=3):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user