2
$\begingroup$

I have a image similar to below. In that I need to find all red circles and count them. So, I am thinking to use MATLAB R2011a with Image Processing Toolkit for it. How could I possibly extract them?

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Please give us lots more detail. Will there be any other red objects visible in the image? Will the red objects always be approximately the same size (in pixels), or might they vary? Do you need to deal with occlusion (e.g., a tomato that is partly occluded by a leaf in front of it)? I hope you're aware that many of the tomatoes in your image are not in fact red circles, because they're occluded by other objects (e.g., leaves, other tomatoes): what were you hoping should happen in that case? $\endgroup$ – D.W. Dec 24 '13 at 22:01
1
$\begingroup$

A simple approach to start with is to extract just the red channel, do some binary thresholding (e.g., Otsu's method), and then use standard morphology operators to find the blobs. You could try applying a closing operation. Then, you could apply the watershed transformation or region flooding to identify the blobs where the tomatoes are.

A possibly better approach could be to convert to HSV representation, then generate a binary image as follows: every pixel whose hue matches the hue of a tomato (from some range you manually determine) is colored white, the rest are colored black. Then you could continue with morphology operators and watershed/region flooding.

How well this will work will depend upon your requirements (e.g., whether you need to deal with occlusion) and on application-specific details (e.g., how constant in color the tomatoes are).

Take a look at the following questions on StackOverflow; they are quite relevant and will be helpful to you:

and also these resources:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.