Note that there are some explanatory texts on larger screens.

plurals
  1. POMatcher Assertions failed error opencv Android
    primarykey
    data
    text
    <p>I'm writing code to find similar object from drawable in camerapreview. I am using the newest Opencv 2.4.4.</p> <p>Below are my functions and an output from logcat. What am I doing wrong that I'm getting such output?</p> <pre><code> public void detect_image (Mat mRgba) { object_desc = new Mat(); scene_desc = new Mat(); object_keys = new MatOfKeyPoint(); scene_keys = new MatOfKeyPoint(); matches = new MatOfDMatch(); good_matches = new MatOfDMatch(); Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.sto); Utils.bitmapToMat(image,object); surf = FeatureDetector.create(FeatureDetector.FAST); surf.detect( object, object_keys ); surf.detect( mRgba, scene_keys); surfEX = DescriptorExtractor.create(DescriptorExtractor.BRIEF); surfEX.compute(object, object_keys, object_desc); surfEX.compute(mRgba, scene_keys, scene_desc); dm = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2); dm.match(object_desc, scene_desc, matches); double max_dist = 0; double min_dist = 100; for( int i = 0; i &lt; object_desc.rows(); i++ ) { double dist = matches.toArray()[i].distance; if( dist &lt; min_dist ) min_dist = dist; if( dist &gt; max_dist ) max_dist = dist; } for( int i = 0; i &lt; object_desc.rows(); i++ ) { MatOfDMatch temp = new MatOfDMatch(); if( matches.toArray()[i].distance &lt; 3*min_dist ) { temp.fromArray(matches.toArray()[i]); good_matches.push_back(temp); } } } public Mat onCameraFrame(CvCameraViewFrame inputFrame) { mRgba = inputFrame.rgba(); detect_image(mRgba); return inputFrame.rgba(); } </code></pre> <p>Logcat:</p> <pre><code>03-27 01:55:31.258: E/cv::error()(564): OpenCV Error: Assertion failed (type == src2.type() &amp;&amp; src1.cols == src2.cols &amp;&amp; (type == CV_32F || type == CV_8U)) in void cv::batchDistance(cv::InputArray, cv::InputArray, cv::OutputArray, int, cv::OutputArray, int, int, cv::InputArray, int, bool), file /home/reports/ci/slave/50-SDK/opencv/modules/core/src/stat.cpp, line 1803 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload