Something like this, in which I have coded an arbitrary 95% cutoff:
maxred = max(max(IMG(:,:,1)));
deep_red = IMG(:,:,1) .* (IMG(:,:,1) >= 0.95 * maxred);
deep_red(1,1,3) = 0;
However, this algorithm as given has a limitation that as coded it cannot tell the difference between a point that is "deep red" and one that is "deep purple" or "bright white", because the algorithm is not paying attention to the green or blue content of pixels. This might or might not be a problem for your purposes.
I note that your image has some bright yellow pixels: bright yellow is low red with high green and high blue, so if you want to include the locations that are shown as yellow, then you cannot check only the red plane. If you do want to include them, then would you want them to show up in the original yellow in the processed image, or would you want them to show up recolored to bright red?
I have a suspicion that what you what is closer to this:
gscale = rgb2gray(IMG);
thresh = 0.95 * max(gscale(:));
deep_red = gscale .* (gscale >= thresh);
deep_red(1,1,3) = 0;
0 Comments
Sign in to comment.