Ask Your Question
0

Feature Matching with FLANN Tutorial

asked 2013-04-12 09:08:23 -0600

Immi gravatar image

updated 2013-04-15 01:57:00 -0600

Hello all!

I've tried this tut: http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html#feature-flann-matcher .

When I'm adding: equalizeHist(img_1,img_1) after loading the images, the program will crash. This crash at "matcher.match( descriptors_1, descriptors_2, matches );" with error: "OpenCV Error: Unsupported format or combination of formats (type=0) in unknown function, file ......\src\opencv\modules\flann\src\miniflann.cpp, line 315"

What changes in format does equalizeHist() do? Do you have some hints for me, to evade this error? Thanks in advance. Wish you a nice weekend.

Solution: http://answers.opencv.org/question/11449/flann-algorithm-cannot-find-any-descriptor/ I was using the same image. Immi

edit retag flag offensive close merge delete

Comments

Have you made any other changes to the code? I tried running the tutorial code with and without equalizeHist(), and even emptied the descriptors and keypoints after running their respective functions and it still worked fine on my machine.

HD_Mouse gravatar imageHD_Mouse ( 2013-04-12 13:16:15 -0600 )edit

Hi, I've just changed imread from variable to path and deleted the lines with check of arguments.Thanks for your help.

Immi gravatar imageImmi ( 2013-04-15 01:14:19 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-04-12 10:12:46 -0600

Guanta gravatar image

updated 2013-04-12 10:13:17 -0600

According to the docu, equalizeHist doesn't change the image-format, however, the docu doesn't state if it works in-place or not, so please try it this way:

cv::Mat tmp;
equalizeHist(img_1, tmp);
img_1 = tmp;

Also note, that your image must be in grayscale - is that the case?

If this doesn't help, one other idea comes to my mind: Have you checked if you get keypoints from your equalized image at all? If not, descriptors_1 will be empty and you'll probably get such an error.

edit flag offensive delete link more

Comments

1

equalizeHist does allow you to read and write from and to the same source. I am doing it in all my projects. I am guessing his images are BGR, and not yet converted to grayscale.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-12 16:28:07 -0600 )edit

Hi, thanks for your answers. I've loaded images with img_1 = imread("path", CV_LOAD_IMAGE_GRAYSCALE); after your comments I've tried with cvtColor() but the error was the same. descriptors_1 is not empty. Checked with .data and .empty().

The code is running, when both images are equalized.

Immi gravatar imageImmi ( 2013-04-15 01:27:05 -0600 )edit

Ok out of ideas here :) all depends on @Guanta now :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-15 01:31:26 -0600 )edit
1

Hi, I've found the solution: http://answers.opencv.org/question/11449/flann-algorithm-cannot-find-any-descriptor/ I was using the same picture for img_1 and img_2

Immi gravatar imageImmi ( 2013-04-15 01:50:29 -0600 )edit
1

Indeed, that is a frequent error also. Didn't think of it this time :) Good luck with your project. Accept the answer of guanta, so topic looks solved and maybe add the link and explanation to the problem at your original post.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-15 01:53:41 -0600 )edit

I have still a question for this problem: When I'm equalizing both images, it works also with the same image file. Why does it crash, when I'm equalizing only img_1?

Immi gravatar imageImmi ( 2013-04-15 02:02:15 -0600 )edit

No idea, what exactly crashes actually?

Guanta gravatar imageGuanta ( 2013-04-15 05:25:13 -0600 )edit

I'm just wondering about this error described in topic. It crashs equalizing one image. im1 = imread("im1.bmp, CV_LOAD_IMAGE_GRAYSCALE); im2 = imread("im1.bmp, CV_LOAD_IMAGE_GRAYSCALE);

equalizeHist(im1, im1); // then it crashs like described above. descriptors_2 is empty

//adding following line, it's working equalizeHist(im2, im2);

And now I'm asking, why this happens.

Immi gravatar imageImmi ( 2013-04-15 05:54:53 -0600 )edit

Question Tools

Stats

Asked: 2013-04-12 09:08:23 -0600

Seen: 2,289 times

Last updated: Apr 15 '13