Reputation: 4585
My application will be processing 12-bit binary images that I am getting from a camera. The same image is being shown below in jpeg.
The task is to identify each white glowing region.
These 4 regions as a bunch are randomly coming in each image.
It can be assumed that the 4 white regions always move together from one image to another image.
Each point will be having very high intensity as compared to black or near black background. Each point is actually not a single pixel but a 14 x 14 ROI.
Also the height of the image is 200 pixels.
The distances between each white region is always fixed.
If I apply CVMinMaxLoc(); I will get only one location which is the brightest one.
How do I identify each region?
Upvotes: 0
Views: 701
Reputation: 12514
What you can do is the following:
use threshold()
to get a black-and-white image with at least one white dot per white region.
On the thresholded image: Apply minMaxLoc()
to get the first white region, but then use floodFill()
to get rid of that white region by painting it black.
Repeat step 2 until you get all the white regions. (You will find each white connected component once because you paint each black.)
If your white regions are not connected after threshold()
, you can use dilate()
to make them connected.
If you wanna detect the centre of the white regions, you can also use erode()
after step 1.
Upvotes: 1