I am writing code to find similar objects from Drawable in camera preview. I'm using the latest OpenCV 2.4.4.
Below are an output from my work and logcat. Am I doing the wrong thing that I am getting such an output?
to detect public zeros (MAT MARGBA) {object_desc = new MET (); Scene_desc = new met (); Object_keys = New MatOfKeyPoint (); Scene_keys = New MatOfKeyPoint (); Matches = new matth de match (); Good_match = new matfodmatch (); Bitmap image = bitmapfichtor. Decode processing (getResources (), R.drawable.sto); Utils.bitmapToMat (image, object); Surf = featuredoc Create (FeatureDirector. FAST); Surf.detect (object, object_keys); Surf.detect (mRgba, scene_keys); Surfx = Descriptor Extractor Create (Descriptor Extractor. Bride); SurfEX.compute (object, object_keys, object_desc); SurfEX.compute (mRgba, scene_keys, scene_desc); Dm = Description Matter. Cut (descriptor mater. BRUTEFORCE_SL2); Dm.match (object_desc, scene_desc, matches); Double max_dist = 0; Double min_dist = 100; (Int i = 0; i & lt; object_desc.rows (); i ++) {double distance = matches for To Array () [i]. Distance; If (dist> max_dist) max_dist = dist; } For (int i = 0; i & lt; object_desc.rows (); i ++) {MatOfDMatch temp = new MatOfDMatch (); If (matches. To arrays) [i]. Distance = 3 * min_dist) {temp.fromArray (matches.toArray () [i]); Good_matches.push_back (temporary); }}} Cameraframe on public mat (CVCMARViFrameInputFrame) {mRgba = inputFrame.rgba (); Detect_image (mRgba); Return inputFrame.rgba (); } Logkat:
03-27 01: 55: 31.258: E / CV :: error () (564): OpenCVI error: failure failed (Type == src2.type () & amp; src1.cols == src2.cols & amp; (Type == CV_32F || Type == CV_8U)) Zero CV :: Batch Distance (CV :: Input Aurere , Cv :: InputArray, cv :: OutputArray, int, cv :: OutputArray, int, int, cv :: InputArray, int, bool), file / home / report / ci / slave / 50-sdk / opensev / module / Core /src/stat.cpp, line 1803
Just to close this question For:
Unless your comment In essence, the following line was causing problems:
dm.match (object_desc, scene_desc, mail); I have advised you to manually verify:
(object_desc.type == scene_desc.type and object_desccols = = Object_scene.cols) The problem is finally for the first frame, object_desc.cols ()! = Scene_desc.cols () . A simple if was enough to solve the problem.
No comments:
Post a Comment