Ask Your Question
0

OpenCV error unsupported format or comibation of formats when doing FlannBased matching

asked 2013-05-01 10:54:12 -0600

MysticBE gravatar image

updated 2013-05-01 10:57:24 -0600

I get the following errors from Logcat when I'm trying FlannBased matching. The descriptors I give to the matcher are FREAK descriptors. Do they not match or something? I searched for the error, but it seems to be a bug?? Is it fixed in 2.4.5 ? My descriptors are of the type CV_32FC (so I don't think the problem is with the descriptors I'm sending)

05-01 17:48:14.975: E/cv::error()(4060): OpenCV Error: Unsupported format or combination of formats (type=0
05-01 17:48:14.975: E/cv::error()(4060): ) in void cv::flann::buildIndex_(void*&, const cv::Mat&, const cv::flann::IndexParams&, const Distance&) [with Distance = cvflann::L2<float>, IndexType = cvflann::Index<cvflann::L2<float> >], file /home/reports/ci/slave/50-SDK/opencv/modules/flann/src/miniflann.cpp, line 315
05-01 17:48:14.980: D/AndroidRuntime(4060): Shutting down VM
05-01 17:48:14.980: W/dalvikvm(4060): threadid=1: thread exiting with uncaught exception (group=0x4201c2a0)
05-01 17:48:14.990: E/AndroidRuntime(4060): FATAL EXCEPTION: main
05-01 17:48:14.990: E/AndroidRuntime(4060): CvException [org.opencv.core.CvException: /home/reports/ci/slave/50-SDK/opencv/modules/flann/src/miniflann.cpp:315: error: (-210) type=0
05-01 17:48:14.990: E/AndroidRuntime(4060):  in function void cv::flann::buildIndex_(void*&, const cv::Mat&, const cv::flann::IndexParams&, const Distance&) [with Distance = cvflann::L2<float>, IndexType = cvflann::Index<cvflann::L2<float> >]
05-01 17:48:14.990: E/AndroidRuntime(4060): ]

The code is:

MatOfDMatch matches = new MatOfDMatch();

            matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);
            matcher.match(descriptors,descriptors1,matches);
            MatOfDMatch goedematches = new MatOfDMatch();

            double max_dist = 0;
            double min_dist = 100;
            //if (descriptors.cols() == descriptors1.cols())
            //{
            for( int i = 0; i < descriptors.rows(); i++ )
            { double dist = matches.toArray()[i].distance;
              if( dist < min_dist ) min_dist = dist;
              if( dist > max_dist ) max_dist = dist;
            }
            // should only draw good matches
           for( int i = 0; i < descriptors.rows(); i++ )
            {  MatOfDMatch temp = new MatOfDMatch();
               if( matches.toArray()[i].distance < 3*min_dist )
               {   temp.fromArray(matches.toArray()[i]);
                   goedematches.push_back(temp); 
                   }        
           // }
            }

           Log.d("LOG!", "Number of good matches= " + goedematches.size());
edit retag flag offensive close merge delete

Comments

Hi! Please, localize the problem (which line produces error).

Daniil Osokin gravatar imageDaniil Osokin ( 2013-05-01 15:14:32 -0600 )edit
1

sorry, the error comes from the matcher.match(descriptors,descriptors1,matches); line

MysticBE gravatar imageMysticBE ( 2013-05-01 18:08:44 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-05-02 01:04:31 -0600

Nyenna gravatar image

I don't know the Java API, but the following line:

[with Distance = cvflann::L2<float>, IndexType = cvflann::Index<cvflann::L2<float> >]

suggests that you are using L2 distance. FREAK creates binary descriptors and thus requires the Hamming distance.

edit flag offensive delete link more

Comments

I experienced a similar problem using the BRIEF descriptor. As far as I know BRIEF creates a multidimensional binary descriptor. So the Hamming distance match method should be used for BRIEF too, right?

Stefan K. gravatar imageStefan K. ( 2013-06-13 04:57:44 -0600 )edit
0

answered 2013-10-24 04:44:14 -0600

surodip gravatar image

updated 2013-10-24 04:45:42 -0600

This problem occurred when the descriptors could not be found from a image. Means the features couldn't be extracted from images for various reasons. Just check the descriptors for empty.

Surodip

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-01 10:54:12 -0600

Seen: 6,719 times

Last updated: Oct 24 '13