hi.i have a code that use indexedImage.output image is a RGB image with index.for each pixel i have R,G,B and index value.what is index?what show index value?

답변 (1개)

Image Analyst
Image Analyst 2014년 7월 14일

0 개 추천

The first (left most) index is the row, the middle index is the column, and the last (right most) index is the color. Specify those to get the value of a certain color channel at a certain location:
blueValue = rgbImage(row, column, 3); % Extract the blue value at this row,column location.

댓글 수: 12

fereshte
fereshte 2014년 7월 14일
편집: fereshte 2014년 7월 14일
can you explain me labeledImage in above code? why R,G,B values change in indexed image?and what does index?
thanks
Image Analyst
Image Analyst 2014년 7월 14일
Normally you would not do connected components labeling on an indexed image. It doesn't make sense. If I did that it must have been because you directly asked for it, but I would not normally do that since thresholding an indexed image is nonsense.
Paul
Paul 2015년 3월 25일
편집: Paul 2015년 3월 25일
Hi Image Analyst, How can I refer to the value of "index". For example, if I want to change the color of a pixel based on the "index" value, how can I do it? To be clear, this is what I want to do: e.g:
for i = 1 : length(image(:,1))
for j = 1: length(image(1,:))
if "index"(i,j) == 127
image(i,j) = 1;
else
image(i,j) = 0;
end
end
end
Thanks in advance. Paul
Image Analyst
Image Analyst 2015년 3월 25일
편집: Image Analyst 2015년 3월 25일
Don't name your image "image" - that's the name of a built-in function. To do what you tried to do, you simply use logical indexing:
grayScaleImage = grayScaleImage == 127;
Don't do any of those for loops, just do the one line above. It will set all original pixels with value of 127 to 1, and any other intensity will be set to 0.
Paul
Paul 2015년 3월 25일
Thanks Image Analyst. Maybe I was not clear enough. Let me use the image from fereshte (with your permission fereshte) to explain what I am trying to do (See the attached Image). We can see from this image that, we have:
  • first line ---> X: 21 Y: 42
  • 2nd line ---> Index: 148
  • 3rd line ---> RGB: 0.651, 0.651, 0.651
What I am trying to do is to change the value of each pixel with the Index = 148 in the image to 1 for example and assign 0 to all other pixel with different Index value. Please note that, when I am saying "Index", I am talking about the "Index" value in the 2nd line of the above bullets (corresponding to the Data cursor displayed in the image, in this case, Index = 148). Thanks again. Paul
OK, if it's an RGB image, then
grayScaleImage = rgbImage(:,:,2); % Extract one of the color channels.
grayScaleImage = uint8(255 * (grayScaleImage == 148));
% Make a new RGB output image
rgbOut = cat(3, grayScaleImage, grayScaleImage, grayScaleImage);
Paul
Paul 2015년 3월 26일
Thanks!
Sudheendran Vasudevan
Sudheendran Vasudevan 2020년 5월 16일
Hi Image Analyst,
I have a dead peixel in my image how to remove that
Image Analyst
Image Analyst 2020년 5월 16일
You can use a modified median filter to get rid of salt and pepper noise. I'm attaching the demo for that.
Vijaya yaduvanshi
Vijaya yaduvanshi 2021년 3월 4일
hi Image Analyst,
Im having Matlab 2015a version. In this version Nonlocal mean filter is not available for prepossessing step of my oral cancer images.Please tell me another filter of same quality.
Image Analyst
Image Analyst 2021년 3월 4일
I don't know. Just look around - there's medfilt2(), conv2(), imfilter(), etc.
Vijaya yaduvanshi
Vijaya yaduvanshi 2021년 3월 6일
All right.
Thank You so much

댓글을 달려면 로그인하십시오.

태그

질문:

2014년 7월 14일

댓글:

2021년 3월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by