フィルターのクリア

Imshow(Image,Map) remap pixel intensities

2 ビュー (過去 30 日間)
RuiQi
RuiQi 2016 年 3 月 27 日
編集済み: Image Analyst 2016 年 3 月 27 日
Hello,
I have an image and a map which is a column vector with 256 rows. Each row says what the new pixel value should be for example below.
row - pixel intensity
1 - 0
2 - 0.5
3 - 1
So for the above, a pixel with intensity 0 should get mapped to 0 and pixel intensity of 1 should get mapped to 0.5 because matlab indexing starts from 1. I tried using matlab function imshow(image,map) but it does not work. Help please

採用された回答

Walter Roberson
Walter Roberson 2016 年 3 月 27 日
MappedIntensity = MapArray(double(Intensity)+1);
image(MappedIntensity);
colormap(gray(256))

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 3 月 27 日
編集済み: Image Analyst 2016 年 3 月 27 日
There is a function specially made for this. It's called intlut. It remaps the gray levels according to a look up table (which you called map) just like you want. Here is the code:
remappedImage = intlut(originalGrayImage, map);
However it only works with integers, so for your example you'd have to multiply your map by 2 and then divide the image by 2
remappedImage = intlut(originalGrayImage, uint8(2*map)) / 2;

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by