cornerSubPix

464 views
Skip to first unread message

gblaha

unread,
Nov 4, 2010, 5:43:30 PM11/4/10
to ctypes-opencv

Has anybody been successful in calling the cornerSubPix function? If
so, would you mind posting a code snippet that shows it in action?
I've tried the following without success:

from pyopencv import *
termCriteria = TermCriteria(3,30,0.1) #this works!
imGray = imread("chessBoard1.jpg",CV_LOAD_IMAGE_GRAYSCALE) #this
works!
found,corners = findChessboardCorners(imGray,Size(6,9)) #this works!
result =
cornerSubPix(imGray,corners,len(corners),Size(11,11),Size(-1,-1),termCriteria);

The exception that is raised on the final line reads:

Boost.Python.ArgumentError: Python argument types in
pyopencv.cv_hpp_ext.cornerSubPix(Mat, vector_Point2f, int, Size2i,
Size2i, TermCriteria)
did not match C++ signature:
cornerSubPix(cv::Mat image, std::vector<cv::Point_<float>,
std::allocator<cv::Point_<float> > > {lvalue} corners, cv::Size_<int>
winSize, cv::Size_<int> zeroZone, cv::TermCriteria criteria)

I'm quite new to the the pyopencv library and have zero experience
with Boost (have used SWIG in the past). My noob hunch is that the
{lvalue} for the returned sub-pixel corners is the issue with my
call. Thanks in advance for any help you can offer.

Minh-Tri Pham

unread,
Nov 5, 2010, 2:55:27 AM11/5/10
to ctypes...@googlegroups.com
Thanks for asking. I'll take a look this weekend. Meanwhile, can you try this:

result = cornerSubPix(imGray, corners, Size(11,11), Size(-1,-1), termCriteria);

Cheers,
Minh-Tri

--
Minh-Tri Pham Tel +44 1223 436 952
Toshiba Research Europe Fax +44 1223 436 909
208 Cambridge Science Park
Cambridge CB4 0GZ, UK

gblaha

unread,
Nov 8, 2010, 5:16:03 PM11/8/10
to ctypes-opencv

Wow - that worked! I thought I had tried everything. Thank you very
much for the help (to to mention the awesome library to begin with).
For those following along, the return variable ("result") comes back
as None while the contents of the "corners" input argument are
modified with the sub-pixel coordinates.
Thanks again - George
Reply all
Reply to author
Forward
0 new messages