How do i threshold a green channel of an RGB image using average and standard deviation of the image.
2 views (last 30 days)
Show older comments
I want to threshold green channel of an RGB image, i have the average, standard deviation, and variance of the RGB component both the foreground and the background, how do i do this?
0 Comments
Answers (1)
Image Analyst
on 17 Mar 2013
If you already have "both the foreground and the background", as you said, then you must have thresholded it already or else come up with some way of specifying what is foreground and what is background. But you can threshold it again to find different foreground and background:
thresholdValue = some function of average & std dev in the first foreground & background.
% Get new foreground based on values determined from first pass
% at guessing what the foreground and background were.
binaryImage = greenChannel > thresholdValue; % Or can use <, <=, or >=
2 Comments
Image Analyst
on 18 Mar 2013
It's okay except for the lack of comments and variable names that are not descriptive. Please add comments and give your variables names that describe what they are.
See Also
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!