Question concerning color segmentation performance.

Hello there!
I am looking to perform color segmentation on specific images in order to isolate the green objects in the image (more specifically, a green glove). I have this part covered, with all credit going to Image Analyst, whose Simple Color Detection code is the basis of the program, which is attached. However, I've encountered a problem where, in very similar circumstances, I successfully isolate the green in one image, while I am unable to detect any green at all in the other. I am using the same thresholds all throughout.
Specifically, said successful image is here:
While unsuccessful image is here:
Can anyone please explain why this happens? Is it simply a matter of adjusting the thresholds ever so slightly, or is there something I am missing here?
And if possible, is there a way for me to improve the performance and robustness of this color segmentation method?
Thank you for your time. Any help would be greatly appreciated.

 Accepted Answer

Probably. My demo code (attached below here) gives you the histograms of the h, s, and v channels. You need to see where green lies. It's probably around 0.2-0.4 or so You might have to combine it with other color channels. For example since everything else is some shade of gray, you might be able to threshold on the saturation channel. Attach your two images (working and not working) if you want more help.

4 Comments

Hmm, now that you mention it, histograms would help a lot in determining the ranges I'll need to expect.
Also, my apologies. Attached are the specific images I used.
Is there any way the detection performance can be improved, while keeping the basic frame of the code?
Thank you for the reply.
Try the test3.m attached below the images of what it produces. It requires you to download and use my interactive thresholding application. I found that thresholding H to the range [.23-.41], S to [.13 - .49] and V to [.2 - .64] is a good starting point for that camera, color of lighting, and illumination level. Below are the results for the nonworkingimage. Of course it would be much better if you didn't jpeg the heck out of them. The image quality is horrendous!
You might want to use my other attached demo which lets you extract only the largest blob since that will presumably be the hand. That will let you get rid of some of those smaller, spurious blobs.
So now that you've had a chance to try it, what do you think? Good enough to accept the answer, or not?
You've suggested a lot of ways to improve the program, and these codes will help immensely in optimizing the color segmentation. This is more than enough. Thank you for the help.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!