2 answers

This is a simple case of blob analysis. You can use one of the blob analysis libraries, for example, cvBlobsLib, and get the information you need. It will give you the coordinates as well as the size of the blobs.

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.