Imshow(Image,Map) remap pixel intensities
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Walter Roberson
2016년 3월 27일
MappedIntensity = MapArray(double(Intensity)+1);
image(MappedIntensity);
colormap(gray(256))
댓글 수: 0
추가 답변 (1개)
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;
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!