title: How can I use Blob Detector
body: <p>I'm trying to use SimpleBlobDetector in OpenCV 3 to detect blobs of heat in thermal images, for example people. Any simple code or example will be appreciated.</p>
  
  <p>i tried`   </p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  
  #include &lt;iostream&gt;
  
  #include "opencv2\features2d.hpp"
  
  using namespace cv;
  using namespace std;
  
  int main(int argc, char** argv)
  {
  if (argc != 2)
  {
      cout &lt;&lt; " Usage: display_image ImageToLoadAndDisplay" &lt;&lt; endl;
      return 0;
  }
  
  Mat image;
  image = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);   // Read the file
  
  if (!image.data)                              // Check for invalid input
  {
      cout &lt;&lt; "Could not open or find the image" &lt;&lt; std::endl;
      return 0;
  }
  
  
  
  // Set up the detector with default parameters.
  //SimpleBlobDetector detector;
  // Setup SimpleBlobDetector parameters.
  SimpleBlobDetector::Params params;
  
  // Change thresholds
  params.minThreshold = 50;
  params.maxThreshold = 200;
  
  // Filter by Area.
  params.filterByArea = true;
  params.minArea = 1500;
  
  // Filter by Circularity
  params.filterByCircularity = true;
  params.minCircularity = 0.1;
  
  // Filter by Convexity
  params.filterByConvexity = true;
  params.minConvexity = 0.87;
  
  // Filter by Inertia
  params.filterByInertia = true;
  params.minInertiaRatio = 0.01;
  
  // Detect blobs.
  std::vector&lt;KeyPoint&gt; keypoints;
  cv::Ptr&lt;cv::SimpleBlobDetector&gt; detector = cv::SimpleBlobDetector::create(params);
  //detector-&gt;detect(img, keypoints);
  detector-&gt;detect(image, keypoints);
  //params.detect(image, keypoints);
  
  // Draw detected blobs as red circles.
  //DrawMatchesFlags::DRAW_RICH_KEYPOINTS flag ensures the size of the circle corresponds to the size of blob
  Mat im_with_keypoints;
  drawKeypoints(image, keypoints, im_with_keypoints, Scalar(0, 0, 255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
  
  // Show blobs
  imshow("keypoints", im_with_keypoints);
  waitKey(0);
  
  //namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
  //imshow("Display window", image);                   // Show our image inside it.
  
  //waitKey(0);                                          // Wait for a keystroke in the window
  //return 0;
  </code></pre>
  
  <p>}
  ` but it just returns the gray image unchanged.</p>