kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library

Home Page:http://kyamagu.github.io/mexopencv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error using cv.drawKeypoints

fybaft2012 opened this issue · comments

Hi @amroamroamro,

My code is like this:

im = 'image.png';
detector = cv.FeatureDetector('ORB');             % 1
keypoints2 = detector.detect(im);                 % 2
extractor = cv.DescriptorExtractor('ORB');        % 3
descriptors2 = extractor.compute(im, keypoints2); % 4
out = cv.drawKeypoints(im, keypoints2);           % 5

It worked fine line1-line4, when I call cv.drawKeypoints, it throw the error:

Error using cv.drawKeypoints
Unexpected Standard exception from MEX file.
What() is: ../mexopencv-3.3.0/src/MxArray.cpp:531:
error: (-215) isNumeric() || isLogical() || isChar() in function toMat

I don't know what is the problem, could you help me to figure it out?
Thanks!

commented

You forgot to imread the image, rather than passing the path as a string you must use the actual image.

im = imread('image.png');
...

Sorry, I wrote the wrong code in the issues, but I did use imread in my original code. Actually, my original code is as following:

im = imread('image.png');
detector = cv.FeatureDetector('ORB');             % 1
keypoints2 = detector.detect(im);                 % 2
extractor = cv.DescriptorExtractor('ORB');        % 3
descriptors2 = extractor.compute(im, keypoints2); % 4
out = cv.drawKeypoints(im, keypoints2);           % 5

So could you help me out this error?

Hi, @amroamroamro , I just found the problem is the 'im' format problem, my original code saved im as cell structure, therefore the OpenCV cannot recognize it. Now, I modified the im format, now it works!
You give me a hint about im format. Thank you very much amroamroamro, I think I will close this issue.