title: OpenCV: Using cvGoodFeaturesToTrack with C++ mat variable
body: <p>I am trying to use the <code>cvGoodFeatureToTrack</code> function in Visual Studio 2010 with the image type as <code>Mat</code>. Most of the examples I have seen use the <code>IplImage</code> pointer.
  Right now I have this:</p>
  
  <pre><code>int w, h; // video frame size
  
  Mat grayFrame;
  Mat eigImage;
  Mat tempImage;
  const int MAX_CORNERS = 10;
  CvPoint2D32f corners[MAX_CORNERS] = {0};
  int corner_count = MAX_CORNERS;
  double quality_level = 0.1;
  double min_distance = 10;
  int eig_block_size = 3;
  int use_harris = false;
  
  w = CurrFrame.size().width;
  h = CurrFrame.size().height;
  cvtColor(CurrFrame, grayFrame, CV_BGR2GRAY);
  cvGoodFeaturesToTrack(&amp;grayFrame,
                        &amp;eigImage,
                        &amp;tempImage,
                        corners,
                        &amp;corner_count,
                        quality_level,
                        min_distance,
                        NULL,
                        eig_block_size,
                        use_harris);
  </code></pre>
  
  <p>It compiles but gives me a memory access violation. Help!</p>