Why only selecting Green channel of color image for binarize ?
12 次查看(过去 30 天)
显示 更早的评论
hi, can anyone give the reason selecting the green channel from the color image for binarize that image, why not red and blue channels.
0 个评论
回答(3 个)
Walter Roberson
2017-2-24
The human eye is most sensitive to green, so using green is an inexpensive replacement for doing an rgb to intensity conversion.
(To be more accurate, the blue cones are much more sensitive to light. But there are a lot fewer blue cones and most of them are outside of region of sharp focus, so the overall contribution to the brain is comparable to the other two types.)
2 个评论
Walter Roberson
2017-2-25
Depending on how the document is illuminated and upon the kind of paper and upon the inks, there might be other reasons why a particular color channel is a good idea.
Image Analyst
2017-2-25
The green channel usually has the most light in it, with typical light sources like sunlight. There are also twice as many green pixels in digital cameras as red or blue pixels - just look at any Bayer color array. These two facts mean that often/usually the green channel will have less noise than the red or blue channel.
There are several considerations that go into how you convert a color image into a gray scale image. You could use rgb2gray(), or take one particular color channel, or take a weighted sum of channels using something like pca() or kmeans() - demos attached. Like Walter said, it really depends on what your image is and what you're trying to extract.
LAXMI PRIYANKA
2020-4-15
iam trying to apply clahe to the extracted green channel of my image
i get the following errors
i have also attached the coding
cold anyone help me in this regard
Error using adapthisteq
Expected input number 1, I, to be two-dimensional.
Error in adapthisteq>parseInputs (line 416)
validateattributes(I, {'uint8', 'uint16', 'double', 'int16', 'single'}, ...
Error in adapthisteq (line 154)
[I, selectedRange, fullRange, numTiles, dimTile, clipLimit, numBins, ...
2 个评论
Walter Roberson
2020-4-15
adapthisteq can only be applied to grayscale images.
Your code gets a file name from the user, and imred() and imresize() to 512, then sends im2uint8() of that to adapthisteq. That assumes that the image in the file is already grayscale. That is true for some kinds of files, but not all. In particular, it is rare for .jpg to be grayscale even if they look grayscale.
Note: your line
[xRes,yRes]=size(input_img);
is broken if input_img might be RGB.
Image Analyst
2020-4-15
Never use just two outputs for images, or else you can run into the problem like you did. Always include a third return argument just in case it's RGB:
[rows, columns, numberOfColorChannels] = size(input_img);
Also note that you had xRes in the rows place. Well, x is for columns, not rows. So if you wanted to stick with that terminilogy you'd need to do it this way:
[yRes, xRes, numberOfColorChannels] = size(input_img);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!