Creating RGB images from .Mat arrays with imaginary entries
1 view (last 30 days)
Show older comments
I have a series of .mat files which contain raw image data that is unscaled and contains imaginary entries. I can display these images by loading the .mat and then using imagesc(abs(file(:,:,#))); where # indicates a single positive integer. This properly displays the scaled image, but I cannot do any operations on the image. Creating a handle such as img1 = imagesc(...) and then using imwrite to create an RGB image does not work and imread tells me that I need to imput a string as the target but then I cannot get the modulus with abs or reference a single 2-d array, which results in a matrix dimensions error. What is the best way to read from a .mat slice and convert it to a scaled rgb image?
0 Comments
Answers (2)
Sean de Wolski
on 19 May 2011
You could extract just the real components using:
doc real
or just the imaginary ones using
doc imag
E.g.
Irgbreal = real(Irgb);
6 Comments
Sean de Wolski
on 19 May 2011
No it is not. If you are pulling just one slice of it, it has no G/B components. You may be visualizing it as an RGB image with some pseudocolor, but it does not have enough information to be RGB.
Christopher
on 19 May 2011
2 Comments
Sean de Wolski
on 19 May 2011
I would leave it as grayscale unless you need to impress some lawyers or politicians ;)
The intensity map is the information you have so you might as well view it as such in grayscale.
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!