Ask Your Question

Single image and multiple colors/objects

asked 2015-06-10 09:19:42 -0500

In my image, I have pinkish objects and orange/brown objects. I would like to calculate the area of each object individually and a count for the number of each objects within their respective color categories. How do I do this, where do I start? All the videos I have seen focus on 1 objects and color set, not multiple. Please help.


Here is a link to the image: CR2 Image File - 21 MB

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-11 08:26:58 -0500

Some steps to follow

  • Start by converting your image to a color space that can be better segmented for visible colors, like HSV color space.
  • Then define threshold values for your specific colors on the H S and V color channels seperately.
  • For each color create a binary thresholded mask based on the threshold values previously defined.
  • On each mask you can apply findContours (even remove some noise with a gaussian blur if you need that) and detect all the available blobs/objects.
  • Now count the number of objects and assign an index to each blob.
  • In order to be sure that an index sticks to blob, apply a Kalman filter tracking and use a distance measure to connect blobs between frames.
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-06-10 09:16:36 -0500

Seen: 204 times

Last updated: Jun 11 '15