title: OPENCV (Unsupported format or combination formats) SURF
body: <p>anyone familiar with this error? I tested a surf descriptor in real-time. I want to use it for recognition of different species of fish using of this features. Sometimes the program is okay but sometimes it gets an error. The compilation is Build successfully. After the compilation this error show.</p>
  
  <p><img src="https://i.stack.imgur.com/qWlrs.png" alt="enter image description here"></p>
  
  <pre><code>#include &lt;opencv2\imgproc\imgproc_c.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;opencv\highgui.h&gt;
  #include &lt;opencv\cv.h&gt;
  #include &lt;opencv2/features2d/features2d.hpp&gt;
  #include &lt;opencv2/calib3d/calib3d.hpp&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/nonfree/features2d.hpp&gt;
  #include &lt;opencv2/legacy/legacy.hpp&gt;
  using namespace cv;
  
  
  #define nimg 3
  
  
  int main()
  {
      Mat object =  imread( "D:/galunggong.jpg", CV_LOAD_IMAGE_GRAYSCALE );
      Mat object1 = imread( "D:/sapsap.jpg", CV_LOAD_IMAGE_GRAYSCALE );
      Mat object2 = imread( "D:/bisugo.jpg",CV_LOAD_IMAGE_GRAYSCALE );
      // Mat object3 = imread( "4.jpg", CV_LOAD_IMAGE_GRAYSCALE );
      //Mat object4 = imread( "5.jpg", CV_LOAD_IMAGE_GRAYSCALE );
  
  if( !object.data )
  {
      std::cout&lt;&lt; "Error reading object " &lt;&lt; std::endl;
      return -1;
  }
    if( !object1.data )
  {
      std::cout&lt;&lt; "Error reading object " &lt;&lt; std::endl;
      return -1;
  }
      if( !object2.data )
  {
      std::cout&lt;&lt; "Error reading object " &lt;&lt; std::endl;
      return -1;
  }
  
  
  //Detect the keypoints using SURF Detector
  int minHessian = 1000;
  
  SurfFeatureDetector detector( minHessian );
  
  std::vector&lt;KeyPoint&gt; kp_object;
  std::vector&lt;KeyPoint&gt; kp_object1;
  std::vector&lt;KeyPoint&gt; kp_object2;
  std::vector&lt;KeyPoint&gt; kp_object3;
  std::vector&lt;KeyPoint&gt; kp_object4;
  
  detector.detect( object,  kp_object );
  detector.detect( object1, kp_object1 );
  detector.detect( object2, kp_object2 );
  
  
  //Calculate descriptors (feature vectors)
  SurfDescriptorExtractor extractor;
  Mat des_object;
  Mat des_object1;
  Mat des_object2;
  
  
  extractor.compute( object, kp_object, des_object );
  extractor.compute( object1, kp_object1, des_object1 );
  extractor.compute( object2, kp_object2, des_object2 );
  
  
  FlannBasedMatcher matcher;
   CvCapture* cap = cvCreateCameraCapture(0);
  cvSetCaptureProperty(cap, CV_CAP_PROP_FRAME_WIDTH, 320);
  cvSetCaptureProperty( cap, CV_CAP_PROP_FRAME_HEIGHT, 240 );
  
  namedWindow("Good Matches");
  
  std::vector&lt;Point2f&gt; obj_corners(4);
  
  //Get the corners from the object
  obj_corners[0] = cvPoint(0,0);
  obj_corners[1] = cvPoint( object.cols, 0 );
  obj_corners[2] = cvPoint( object.cols, object.rows );
  obj_corners[3] = cvPoint( 0, object.rows );
  
  char key = 'a';
  int framecount = 0;
  Mat frame;
  
  
  
   Mat des_image, img_matches;
  
   char vect[nimg];
   char contor;
   char ok, ko;
  
  
  
  while (1)
  {
  
          frame = cvQueryFrame(cap);
  
      if (framecount &lt; 5)
      {
          framecount++;
          continue;
      }
  
      std::vector&lt;KeyPoint&gt; kp_image;
  
      std::vector&lt;vector&lt;DMatch &gt; &gt; matches;
      std::vector&lt;vector&lt;DMatch &gt; &gt; matches1;
      std::vector&lt;vector&lt;DMatch &gt; &gt; matches2;
  
      std::vector&lt;DMatch &gt; good_matches;
      std::vector&lt;DMatch &gt; good_matches1;
      std::vector&lt;DMatch &gt; good_matches2;
  
  
      std::vector&lt;Point2f&gt; obj;
      std::vector&lt;Point2f&gt; scene;
      std::vector&lt;Point2f&gt; scene_corners(4);
      Mat H;
      Mat image;
  
  
  
  
      cvtColor(frame, image, CV_RGB2GRAY);
  
      detector.detect( image, kp_image );
      extractor.compute( image, kp_image, des_image );
  
  
  
      matcher.knnMatch(des_object, des_image, matches, 2);
  
  
  
      //  printf("d \n");
  //////////////////////////////////////////////////////
  
      contor=0;
  
      for(int i = 0; i &lt; min(des_image.rows-1,(int) matches.size()); i++) //THIS LOOP IS
  SENSITIVE TO SEGFAULTS
      {
          if((matches[i][0].distance &lt; 0.6*(matches[i][1].distance)) &amp;&amp; ((int)
  matches[i].size()&lt;=2 &amp;&amp; (int) matches[i].size()&gt;0))
          {
              good_matches.push_back(matches[i][0]);
          }
      }
  
      vect[contor]=good_matches.size();
  /////////////////////////////////////////////////////   
  
      contor=1;
      matcher.knnMatch(des_object1, des_image, matches1, 2);
  
  
      for(int i = 0; i &lt; min(des_image.rows-1,(int) matches1.size()); i++) //THIS LOOP IS
  SENSITIVE TO SEGFAULTS
      {
          if((matches1[i][0].distance &lt; 0.6*(matches1[i][1].distance)) &amp;&amp; ((int)
  matches1[i].size()&lt;=2 &amp;&amp; (int) matches1[i].size()&gt;0))
          {
              good_matches1.push_back(matches1[i][0]);
          }
      }
  
      vect[contor]=good_matches1.size();
  
  /////////////////////////////////////////////////////   
  
      contor=2;
      matcher.knnMatch(des_object2, des_image, matches2, 2);
  
  
      for(int i = 0; i &lt; min(des_image.rows-1,(int) matches2.size()); i++) //THIS LOOP IS
  SENSITIVE TO SEGFAULTS
      {
          if((matches2[i][0].distance &lt; 0.6*(matches2[i][1].distance)) &amp;&amp; ((int)
  matches2[i].size()&lt;=2 &amp;&amp; (int) matches2[i].size()&gt;0))
          {
              good_matches2.push_back(matches2[i][0]);
          }
      }
      vect[contor]=good_matches2.size();
  ////////////////////////////////////////////////////        
      /*
      contor =3; 
      matcher.knnMatch(des_object, des_image, matches3, 2);
  
  
      for(int i = 0; i &lt; min(des_image.rows-1,(int) matches3.size()); i++) //THIS LOOP IS
  SENSITIVE TO SEGFAULTS
      {
          if((matches3[i][0].distance &lt; 0.6*(matches3[i][1].distance)) &amp;&amp; ((int)
  matches3[i].size()&lt;=2 &amp;&amp; (int) matches3[i].size()&gt;0))
          {
              good_matches3.push_back(matches[i][0]);
          }
      }
      vect[contor]=good_matches3.size();
  
  //////////////////////////////////////////////////
  
      contor=4;
      matcher.knnMatch(des_object, des_image, matches4, 2);
  
  
      for(int i = 0; i &lt; min(des_image.rows-1,(int) matches4.size()); i++) //THIS LOOP IS
  SENSITIVE TO SEGFAULTS
      {
          if((matches4[i][0].distance &lt; 0.6*(matches4[i][1].distance)) &amp;&amp; ((int)
  matches4[i].size()&lt;=2 &amp;&amp; (int) matches4[i].size()&gt;0))
          {
              good_matches4.push_back(matches[i][0]);
          }
      }
    vect[contor]=good_matches4.size();
  
    */
  printf("%d %d %d \n ",vect[0],vect[1],vect[2]);
  
  ok=0;
  for (contor=1;contor&lt;nimg;contor++)
      if (vect[contor]&gt;vect[contor-1])
          ok=contor;
  
  for (ko=10;ko&gt;3;ko++)
  {
  if (ok==0 &amp;&amp; vect[ok]&gt;ko)
      {printf("Forward \n");
      ko=2;}
  else if (ok==1 &amp;&amp; vect[ok]&gt;ko)
      {printf("Turn Left \n");
      ko=2;}
  else if (ok==2 &amp;&amp; vect[ok]&gt;ko)
      {printf("Turn Right \n");
      ko=2;}
  
  
  
  }        
  
  
  
      //Show detected matches
      imshow( "Good Matches",frame /*img_matches*/ );
  
      key = waitKey(1);  
  }
  
  }
  </code></pre>