How can i save the output of " imagesc " as the exact resolution ?

15 views (last 30 days)
I am doing some image processing and as a result i got a matrix with values between -1 and 1. I am presenting the matrix using "imagesc". this code for example is giving the same result:
x1=linspace( 0,360 ,1024)*pi/180;
x2=2.*x2;
x=[x1 ;x2];
y = cos(repmat(x,1280/2,1));
ax=figure; imagesc(y);colorbar;colormap(ax,jet)
I want to save the image exactly as it presented using "imagesc" with the source resolution [1024 X 1280]. I have been tried this solution (but it did not work):
(from: https://stackoverflow.com/questions/18265592/save-exact-image-output-from-imagesc-in-matlab)et(gca,'XTick',[]) % Remove the ticks in the x axis!
set(gca,'YTick',[]) % Remove the ticks in the y axis
set(gca,'Position',[0 0 1 1]) % Make the axes occupy the hole figure
saveas(gcf,'Figure','png')
saveas(gcf,'Figure','png')
I need to save it as is it with the same resolution for future analysis and show
Thank you
Marwan

Answers (1)

Rik
Rik on 21 Feb 2018
Look into imwrite (you might need ind2rgb first).

Categories

Find more on Images 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!