openCV: creating a match of features, meaning of output array, java -
the following code (written in java using opencv-libraries image processing) produces output of class matofdmatch. problem dont understand values inside array telling me match:
featuredetector fastfeaturedetector = featuredetector .create(featuredetector.fast); descriptorextractor surfdescriptorextractor = descriptorextractor .create(descriptorextractor.surf); descriptormatcher flanndescriptormatcher = descriptormatcher .create(descriptormatcher.flannbased); mat image1 = highgui.imread(mypicpath); mat image2 = highgui.imread(mypicpath2); arraylist<matofkeypoint> keypoints1 = new arraylist<matofkeypoint>(); keypoints1.add(new matofkeypoint()); arraylist<matofkeypoint> keypoints2 = new arraylist<matofkeypoint>(); keypoints2.add(new matofkeypoint()); fastfeaturedetector.detect(image1, keypoints1.get(0)); fastfeaturedetector.detect(image2, keypoints2.get(0)); mat descriptor1 = new mat(); mat descriptor2 = new mat(); surfdescriptorextractor.compute(image1, keypoints1.get(0), descriptor1); surfdescriptorextractor.compute(image2, keypoints2.get(0), descriptor2); arraylist<matofdmatch> matches = new arraylist<matofdmatch>(); matches.add(new matofdmatch()); flanndescriptormatcher.match(descriptor1, descriptor2, matches.get(0)); mat outimg = new mat(); features2d.drawmatches(image1, keypoints1.get(0), image2, keypoints2.get(0), matches.get(0), outimg, new scalar(0, 255, 0), new scalar(0, 0, 255), new matofbyte(), features2d.not_draw_single_points); highgui.imwrite(myoutpupicpath, outimg); //the following code part not part of matching process (which above part), //i include here because prints matofdmatchvalues in readable fashion arraylist<double> matchchannel_0 = new arraylist<double>(); arraylist<double> matchchannel_1 = new arraylist<double>(); arraylist<double> matchchannel_2 = new arraylist<double>(); arraylist<double> matchchannel_3 = new arraylist<double>(); (int j = 0; j < matches.get(0).size().height; j++) { matchchannel_0.add(matches.get(0).get(j, 0)[0]); matchchannel_1.add(matches.get(0).get(j, 0)[1]); matchchannel_2.add(matches.get(0).get(j, 0)[2]); matchchannel_3.add(matches.get(0).get(j, 0)[3]); } system.out.println(matchchannel_0 + "\n" + matchchannel_1 + "\n" + matchchannel_2 + "\n" + matchchannel_3);
setting image1 , image2 same pic, lets values in matchchannel_1 become matchchannel_0 , values matchchannel_3 become 0.
setting image1 , image2 different pictures, values become different.
what values mean? sure have tell something match, cant figure out , how. i need answer "bigger values in channel means , in other channel that". clarify this, not explained opencv tutorial on page.
Comments
Post a Comment