quintushorace / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

DMatch should NOT be touched over the position() function. #195

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a DMatch object (e.g. DMatch dmatch = new DMatch()).
2. Find matching keypoints
3. Access one property of one DMatch object. (e.g. dmatch.postition(i).trainIdx)
4. use drawMatches method to display the matches.

What is the expected output? What do you see instead?

Insetead to show all the matches, the drawMatches function will only show the 
matches that were not touched with position(i) function.

What version of the product are you using? On what operating system?
I'm using OpenCv2.3.1, newest JavaCv and Eclipse on Windows 8 Consumer Preview. 

Here my code:

FlannBasedMatcher matcher = new FlannBasedMatcher();
DMatch matches = new DMatch();
matcher.match(descriptors_1, descriptors_2, matches, null);

for( int i = 0; i < 412; i++ )
{ 
  System.out.println( "-- Good Match "+i+" Keypoint 1:  "+matches.position(i).queryIdx()+"  -- Keypoint 2: "+matches.position(i).trainIdx()+"  \n" );
}

IplImage result = 
IplImage.create(cvSize(gnome_0_10_0.width()+gnome_0_20_0.width(), 
gnome_0_10_0.height()), gnome_0_10_0.depth(), gnome_0_10_0.nChannels());

opencv_features2d.drawMatches(gnome_0_10_0, v1, gnome_0_20_0, v2, matches, 
result, cvScalarAll(-1), cvScalarAll(-1), null, 0);

Original issue reported on code.google.com by crossfir...@googlemail.com on 25 Apr 2012 at 4:08

GoogleCodeExporter commented 8 years ago
Simply call matches.position(0) before calling drawMatches(), as shown in the 
README.txt file. 

Please post your questions on the mailing list next time if possible, thank you!

Original comment by samuel.a...@gmail.com on 26 Apr 2012 at 4:48