filter a specific color from image

Hello everybody
i have a problem and it would be great if someone helps i am trying to cut a color from an image where the result image is BW .and the color specified i want to chose is black and the rest is white .the main problem is since there was more light of the left side of the image the pixel value pattern changes for the same color over the same image,for example blue of the left has value of RGB= 106 156 183 where on the right side RGB=106 126 133 ,is there a way where i can make the brightness the same all over the image ?I mean a way of making the values of the color i see to have the same values all over the image or a same pattern?

 Accepted Answer

See color segmentation demos in my File Exchange. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Or use the ColorThresholder App on the Apps tab of the tool ribbon.

7 Comments

Amr's "Answer" moved here:
"i read them, sadly i didnt find an answer.the main problem is the light is diffrent in the morning than in the evening ,which create diffrent patterns. is there a way to make the adjust the brightness where it is the same in all part of the image and make the same value for the morning and the evening image? thank you Btw for the response!"
Yes you can adjust the brightness by multiplying by the ratio of the means. That won't do color correction though, as you would need to do when comparing sunset, noon, and sunrise photos. Maybe you can try to have your camera automatically white balance, or do it post capture by examining a spot in the scene that you define to be white.
thank you for keeping track ,would you kindly explain that did u mean by post capture by examining a spot in the scene that you define to be white.and if there is a reading matirial on the this subject that would be great!!
Let's say you have a white piece of plastic or ceramic in your scene. Well, you can define this to be white, where red=green=blue. But they won't all be the same since the color of daylight at noon is different than at sunset. You can measure what you have and multiply by factors to MAKE red=green=blue so now the white chip will be white no matter what the lighting color is. There are more sophisticated ways that you can do with multivariate transforms that you can use with the x-rite ColorChecker chart, and this is what I do. You might want to start off simple with just simple multiplication by a factor, unless you think you're up to the more sophisticated methods.
See attachment for a more in depth discussion of how to color calibrate your images.
so i have been reading about x-rite ColorChecker chart,and tested the Method you recommended regarding the the white spot,is there a way to calibrate a camera using information already exsisted on the image? for example i can easly detect red color on my image feed and can i use a saved value to calibrate the camera ?multiplaying by a factor doesnot seems to help me a lot since i picked a point and multiplyed the whole image by factors one for each RGB .
If you don't want to do calibrated color analysis then you can filter on whatever you have. I do that in several different ways (different color spaces) in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862.
Or you can try the Color Thresholder on the Apps tab of the MATLAB tool ribbon.

Sign in to comment.

More Answers (1)

Ah
Ah on 12 Dec 2016
very intresting way i will try it in the next weeks,i will read about x-rite ColorChecker chart and report back.thank you again for help

Categories

Find more on Agriculture in Help Center and File Exchange

Asked:

Ah
on 3 Dec 2016

Commented:

on 21 Dec 2016

Community Treasure Hunt

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

Start Hunting!