How to convert rgb mat file image to give original image - Please help!

5 views (last 30 days)
Hello, I have tried many times without success to convert the mat file I have attached here to its original image (the jpg image also attached). I tried imagesc but the colours in the created image are not same. Can someone please help.

Accepted Answer

Image Analyst
Image Analyst on 1 Nov 2015
The mat file contains a floating point gray scale image. To know how the values in the double array (your image) should be colormapped into the particular purple and yellow RGB image you showed, you'll have to know the colormap that was used when that image was displayed like that. Or you can guess and try to come up with your own colormap that matches that one as best as you can.
s=load('Ir_6712.mat')
imshow(s.Ir_6712, []);
% guess at a colormap. Tweak until you get what you want.
colormap(flipud(hsv(256)));
colorbar
caxis([293,306])
impixelinfo();

More Answers (1)

Walter Roberson
Walter Roberson on 1 Nov 2015
If you started with the color image and processed it to produce that matrix, the transformation is probably not reversible.
If you started with the matrix and someone processed it to produce the image and now you want to match what they did, then you might have a chance.

Community Treasure Hunt

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

Start Hunting!