Ask Your Question

Revision history [back]

You task may be solved in several steps. Firstly, convert image to gray scale and apply cv::threshold to it. You get binary image: white pixel (255) means that pixel value is in range, black (0) means that pixel value is not in range. Then apply cv::findContours function to binarised image. it returns contours for all objects. Using this contours you can calculate bounding box for all of them. Also there are cv::dilate and cv::erode function that implements dilatation and erosion for binarized imaged. It helps you to solve problems with diagonally neighboring pixels.