how to extract or select region of interest for example a red ball from an image and output should be red colored ball with black background?
1 view (last 30 days)
Show older comments
hello sir/madam I have a red ball in an image and I need to extract that ball.After finding the region of interest output should be red ball with black background.Region of interest should be selected automatically not by manual selection.
0 Comments
Answers (2)
Image Analyst
on 2 Oct 2014
Here's a simple though not very robust method: http://www.mathworks.com/matlabcentral/fileexchange/28757-tracking-red-color-objects-using-matlab
If you want better, more robust and flexible methods, see my File Exchange for my color segmentation demos. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
2 Comments
Image Analyst
on 29 Oct 2014
See demo I posted here to track a green object. http://www.mathworks.com/matlabcentral/answers/157265#comment_242523
Syed Asad Ali
on 22 Feb 2016
Hi..sir please understand me about this intensity formula and threshold for finding green intensity....
r=center(:,:,1); g=center(:,:,2); b=center(:,:,3); green=g-(r/2)-(b/2); bw=(green>30);
in this formula why use /2...and why g is place before r/2 and b/2..and also why use green>30...why use 30 in this...sir pls ans ASAP
1 Comment
Image Analyst
on 22 Feb 2016
Basically it's computing "green" as the difference between the actual green signal and the average of the red and blue signals. Then it takes only pixels where that signal is at least 30, so in other words the green must be 30 gray levels brighter than the average of the red and blue channels.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!