save large image/figure
14 ビュー (過去 30 日間)
古いコメントを表示
I have a large mxn (~300,000 x 75) element matrix that I would like to save as an image or pdf without any compression. I'm currently using imagesc() to display. I've used the print function to set my own resolution but I'm having difficulty achieving the desired result. The image is a large time series that I would like to save in such a way that I may zoom in over a region, and transmit the complete series to others without any losses. Is there a simple method to save large , essentially banner sized, images / figures?
0 件のコメント
採用された回答
Image Analyst
2015 年 5 月 19 日
Why not save it as a PNG format image file with imwrite()?
Or just save the variable as a .mat file with save()?
4 件のコメント
Image Analyst
2015 年 5 月 20 日
Well the easiest way to do that is with the Image Processing Toolbox which you said you don't have. You would be able to use functions like rgb2ind() and ind2rgb(). You can do it manually without too much trouble though if you know how you want to quantize your colors. rgb2ind() helps out there because it figures out the colormap and indexes for you.
その他の回答 (2 件)
Ingrid
2015 年 5 月 19 日
I always use the export_fig figure for saving images since this doesn't crop the figure so you might want to look at this?
0 件のコメント
GeorgeLab
2015 年 5 月 19 日
編集済み: GeorgeLab
2015 年 5 月 19 日
8 件のコメント
Image Analyst
2015 年 6 月 30 日
Well obviously if you set Visible to off, the figure will be not visible and so what is there for export_fig() to save???
This works:
RGBImage = imread('peppers.png');
% Display figure with image in an axes.
imshow(RGBImage);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% filename = sprintf('ROI_%s.bmp', Img{imageCount})
% export_fig(filename, '-a2')
If the image is only 75 pixels high and 300 thousand wide, then it will show up on the screen as just a line because of the extreme aspect ratio. Why don't you just save it with imwrite()? I mean, there's no way you could put any annotation on that image anyway, and saving annotation is the main advantage export_fig() has over imwrite().
Keyes34
2015 年 6 月 30 日
編集済み: Keyes34
2015 年 6 月 30 日
Oh. I see. Well then. Thought the guy's suggestion above would work.
To be honest, export_fig was mainly for this part of my code. Contour lines don't appear in imwrite, but they do in export_fig.
figure,imshow(RGBImage); hold on; %Hold for contour lines.
contour(Marked_ROI,[0 0],'b','LineWidth',2); %hold off;tried here b4
%Marked_ROI is a binary image.
filename = sprintf('ROI_%s.bmp', Img{imageCount});
imwrite(RGBImage, filename);
hold off;
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!