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)
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.

Answers (2)

Image Analyst
Image Analyst on 2 Oct 2014
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

Syed Asad  Ali
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
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!