So I am working on a project where we are supposed to detect and count the red and gold ornaments in the picture provided in the link below. I am having issues detecting and counting each ornament and cant seem to figure out why. I will outline my process:

1) input image and convert to grayscale then binary 2) using a disk structuring element perform a closing operation to remove the areas around the ornaments. 3) use a method to detect the circles (No problems here I think the main issue is in 2).

Is there a better way for me to isolate the red and gold ornaments? I just need a pointer in the right direction as I have tried a variety of things and none of them seem to work so I am starting to panic. I am working on this project in MATLAB and have included the current output below.

http://www.deviantart.com/art/Xmas-tree-png-3-HQ-large-398885414

enter image description here

The problem lies in step 1. Since you need the color information, you should not convert it to grayscale. Convert the image to HSV color space and work on the HUE(H) to filter the objects with color you require.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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