matlab - Converting a RGB image to grayscale based on the intensity of one color channel -
this question has answer here:
i'm working images similar this: a cell image, , want extract red-pink sections. of i'm using img(:,:,1)
pull out red values produces binary image. wanted know if there way extract "red" values , produce grayscale image based on degree of "redness" or intensity. awesome.
you visualizing result using imshow
automatically set color limits of axes between 0
, 1
. image rgb , values of red channel going range 0
255
. because of this, if specify 1 input imshow
, image values > 1
appear white , zero-values black. image isn't binary, appears way.
you want either display image imagesc
automatically scale color limits match data:
imagesc(img(:,:,1)); colormap gray
or can specify second input imshow
cause scale fit data range:
imshow(img(:,:,1), [])
the reason isn't issue when visualizing channels if specify red, green, , blue channels, considered true color image , axes color limits ignored.
Comments
Post a Comment