Imshow(Image,Map) remap pixel intensities
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
RuiQi
le 27 Mar 2016
Modifié(e) : Image Analyst
le 27 Mar 2016
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 commentaires
Réponse acceptée
Walter Roberson
le 27 Mar 2016
MappedIntensity = MapArray(double(Intensity)+1);
image(MappedIntensity);
colormap(gray(256))
0 commentaires
Plus de réponses (1)
Image Analyst
le 27 Mar 2016
Modifié(e) : Image Analyst
le 27 Mar 2016
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 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!