Grayscale to Jet image
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I wrote a simple program where I stacked and put 1024 images in a matrix variable. Now, after some signal processing(hilbert transform) done on them when I am seeing those images, they are shown in grayscale. I need to convert those images to jet colormap to see some different perspective.
What I tried:
- I went to Edit>Colormap but there I see only one option of RGB which is already selected.
- Looked through MATLAB forums and found rgbImage = ind2rgb(grayImage, jet(256)); but when I tried implementing this in my code to show "bz" it gives me error like this:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> ind2rgb at 27
r = zeros(size(a)); r(:) = cm(a,1);
Please help and let me know what can I do to show the image in some different colors like blue and other or preferably JET. I am using MATLAB 2010. Thanks in advance,
Cheers!
1 Commento
Walter Roberson
il 18 Set 2017
Is grayimage in the range 0 to 1 or is it double precision used to store integers 0, 1, etc., or is it double precision used to store integers 1, 2, etc. with 0 not being possible? Or is it uint8() data?
Risposte (2)
Cam Salzberger
il 18 Set 2017
Modificato: Cam Salzberger
il 18 Set 2017
Hello Rahul,
The reason "ind2rgb" probably failed is that it's likely a double image. That means that all the values are between 0 and 1, rather than being the necessary integer values as an indexed image would be. You could possibly use "ind2rgb" after first doing im2uint8, if you wanted to go that route.
However, this situation is kind of what imagesc is for, at least in terms of displaying it. If you call imagesc on the image, then set the colormap of the figure to jet, you may get the view you're looking for.
If you're looking to write it out to another image file, you might try my first suggestion.
-Cam
EDIT:
Walter makes a good point. You'd probably want to do im2uint8(I)+1 to put it in the range of [1 256], rather than [0 255], to allow for indexing.
1 Commento
Walter Roberson
il 18 Set 2017
ind2rgb knows about data types to know whether to add 1 automatically
Rahul Thakur
il 18 Set 2017
1 Commento
Walter Roberson
il 19 Set 2017
colormap() to change color maps.
How were you thinking that you would like to convey the complex component as color information?
Vedere anche
Categorie
Scopri di più su Blue in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!