title: OpenCV: howto use mask parameter for feature point detection (SURF)
body: <p>I want to limit a SurfFeatureDetector to a set of regions (mask). For a test I define only a single mask:</p>
  
  <pre><code>Mat srcImage; //RGB source image
  Mat mask = Mat::zeros(srcImage.size(), srcImage.type());
  Mat roi(mask, cv::Rect(10,10,100,100));
  roi = Scalar(255, 255, 255);
  SurfFeatureDetector detector();
  std::vector&lt;KeyPoint&gt; keypoints;
  detector.detect(srcImage, keypoints, roi); // crash
  //detector.detect(srcImage, keypoints); // does not crash
  </code></pre>
  
  <p>When I pass the "roi" as the mask I get this error:</p>
  
  <pre><code>OpenCV Error: Assertion failed (mask.empty() || (mask.type() == CV_8UC1 &amp;&amp; mask.size() == image.size())) in detect, file /Users/ux/Downloads/OpenCV-iOS/OpenCV-iOS/../opencv-svn/modules/features2d/src/detectors.cpp, line 63
  </code></pre>
  
  <p>What is wrong with this? How can I correctly pass a mask to the SurfFeatureDetector's "detect" method?</p>
  
  <p>Regards,</p>