title: openCV: creating a match of features, meaning of output array, java
body: <p>The following code (written in <strong>Java</strong> using <strong>openCV</strong>-libraries for <em>Image Processing</em>) produces an output of class <strong>MatOfDMatch</strong>. The problem is i dont understand what the values inside the array are telling me about the match:</p>
  
  <pre><code>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&lt;MatOfKeyPoint&gt; keypoints1 = new ArrayList&lt;MatOfKeyPoint&gt;();
      keypoints1.add(new MatOfKeyPoint());
  ArrayList&lt;MatOfKeyPoint&gt; keypoints2 = new ArrayList&lt;MatOfKeyPoint&gt;();
      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&lt;MatOfDMatch&gt; matches = new ArrayList&lt;MatOfDMatch&gt;();
  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 is not part of the Matching process (which is above part), 
  //I include it here because it prints the MatOfDMatchvalues in a readable fashion
  ArrayList&lt;Double&gt; matchChannel_0 = new ArrayList&lt;Double&gt;();
  ArrayList&lt;Double&gt; matchChannel_1 = new ArrayList&lt;Double&gt;();
  ArrayList&lt;Double&gt; matchChannel_2 = new ArrayList&lt;Double&gt;();
  ArrayList&lt;Double&gt; matchChannel_3 = new ArrayList&lt;Double&gt;();
  
  for (int j = 0; j &lt; 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);
  </code></pre>
  
  <p><br/>
  Setting <strong>image1</strong> and <strong>image2</strong> to the <strong>same pic</strong>, lets all values in <code>matchChannel_1</code> become as <code>matchChannel_0</code> and values <code>matchChannel_3</code> become all 0.</p>
  
  <p>Setting <strong>image1</strong> and <strong>image2</strong> to <strong>different pictures</strong>, the values become different.</p>
  
  <p><strong>What do the values mean?</strong> They sure have to tell <strong>something about the match</strong>, but i cant figure out what exactly and how. <em>I need an answer like "bigger values in that channel means this and in the other channel that".</em> Could someone clarify this, as it is not explained by the openCV tutorial on this <a href="http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html" rel="nofollow">page</a>.</p>