Isolate the green colour of a picture and then threshold it to a B&W picture.
Show older comments
I want to isolate the green chips and then make them white, while everything else is black. I will show my work so far and two examples of what I have done and if someone points out my mistake I will be very grateful.
Example: I had to do it with the blue chips, which was easier to do. My code:
I = imread('img.png');
J= I(:,:,3); %extracting the blue layer of the image;
B= (J>225); % makes the blue chips white and the background black
I did the same for the yellow chips:
J2=I(:,:,2); %this extract the green layer of the image.
Y=(J2>240); %this takes the yellow chips and makes the white.
My work on the green chips isolation: G=((J>60)&(J<66))|((J>75)&(J<120)); Image created: http://imgur.com/8jB3Z9Y But as you can see one of the red chips is showing on the picture and also around the pen there is a white border. How can I fix this?
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!