フィルターのクリア

Pixels and their locations

2 ビュー (過去 30 日間)
med-sweng
med-sweng 2014 年 2 月 26 日
回答済み: Image Analyst 2014 年 2 月 26 日
For instance, I have a grayscale image. For that image, say that I'm interested in viewing pixels with intensity value 77. For that, I did the following:
imshow(I(I==77))
But, in this case, I got a figure with something like a vertical thin line and doesn't show a meaningful image.
It seems we should refer to the locations of those pixels.
What should we do in this case in order to retrieve a meaningful image showing the pixels of interest?
Thanks.

採用された回答

Image Analyst
Image Analyst 2014 年 2 月 26 日
That's because (I==77) is a 2D binary image (true/false) but when you pass a binary/logical image into an array in MATLAB, you get a column vector out. What you want to do is to mask the image:
mask = (I==77); C% Create binary (logical) mask.
maskedImage = I .* uint8(mask); % Multiply mask by image.
imshow(maskedImage); % Display maskedImage

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by