title: How to process output of the matchShapes() function
body: <p>Given below is the code of the program used to compare 2 shapes.</p>
  
  <pre><code>#include "opencv2/highgui/highgui.hpp"
  #include "opencv2/imgproc/imgproc.hpp"
  #include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace cv;
  using namespace std;
  
  int main()
  {
      RNG rng(12345);
      Mat image1=cvLoadImage("C:/Users/Administrator/Desktop/circle1.png",1);
      Mat image2=cvLoadImage("C:/Users/Administrator/Desktop/circle2.png",1);
      Mat imagegray1, imagegray2, imageresult1, imageresult2;
      int thresh=150;
      double ans=0, result=0;;
      cvtColor(image1, imagegray1,CV_BGR2GRAY);
      cvtColor(image2,imagegray2,CV_BGR2GRAY);
  
      vector&lt;vector&lt;Point&gt;&gt;contours1, contours2;
      vector&lt;Vec4i&gt;hierarchy1, hierarchy2;
  
      Canny(imagegray1, imageresult1,thresh, thresh*2);
      Canny(imagegray2, imageresult2,thresh, thresh*2);
  
      findContours(imageresult1,contours1,hierarchy1,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0));
      for(int i=0;i&lt;contours1.size();i++)
      {
          Scalar color=Scalar(rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255));
          drawContours(imageresult1,contours1,i,color,1,8,hierarchy1,0,Point());
      }
  
      findContours(imageresult2,contours2,hierarchy2,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0));
      for(int i=0;i&lt;contours2.size();i++)
      {
          Scalar color=Scalar(rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255));
          drawContours(imageresult2,contours2,i,color,1,8,hierarchy2,0,Point());
      }
      for(int i=0;i&lt;contours1.size();i++)
      {
          ans=matchShapes(contours1[i],contours2[i],CV_CONTOURS_MATCH_I1,0);
          cout&lt;&lt;ans;
          getchar();
      }
  }
  </code></pre>
  
  <p>I am running it with these images:</p>
  
  <p><img src="https://i.stack.imgur.com/IE8Ni.png" alt="Image 1">
  <img src="https://i.stack.imgur.com/Oufh6.png" alt="enter image description here"></p>
  
  <p>The result in this case i.e. the value of the variable ans is:</p>
  
  <blockquote>
    <p>8.97971e-007</p>
    
    <p>1.73019e-005</p>
    
    <p>2.25315e-006</p>
    
    <p>2.21416e-005</p>
  </blockquote>
  
  <p>How to use these values to determine if the shapes match each other?</p>