如何显示图像大小以保持原始矩阵的大小
数据
是一个512-BY-512矩阵,由imagesc
可视化,但原始的512By-512尺寸无法保存,并且图像大小只能保存为800 x 800通过设置以下内容。
data = rand(512,512);
x = [0 0];
y = [512 512];
figure('position',[200,200,512,512]);
% image(log10(data(1:64,1:64)),'CDataMapping','scaled');
% figure;
imagesc(x,y,log10(data));
axis image;
axis off
axis equal
axis square
truesize([512 512])
% set(gca,'XTick',[])
% set(gca,'YTick',[])
set (gcf,'Position',[100,100,512,512]);
% truesize(fig,[512 512]);
set(gca,'Position',[0 0 1 1])
axis normal;
saveas(gca,strcat('tumor','.jpg'))
print -djpeg99 'foo.jpg'
data
is a 512-by-512 matrix, visualized by imagesc
, but the original 512-by-512 size cannot be saved, and the image size can only be saved as 800-by-800 by setting the following.
data = rand(512,512);
x = [0 0];
y = [512 512];
figure('position',[200,200,512,512]);
% image(log10(data(1:64,1:64)),'CDataMapping','scaled');
% figure;
imagesc(x,y,log10(data));
axis image;
axis off
axis equal
axis square
truesize([512 512])
% set(gca,'XTick',[])
% set(gca,'YTick',[])
set (gcf,'Position',[100,100,512,512]);
% truesize(fig,[512 512]);
set(gca,'Position',[0 0 1 1])
axis normal;
saveas(gca,strcat('tumor','.jpg'))
print -djpeg99 'foo.jpg'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
imwrite
将您输入的数据用作数据像素值生成指定大小的图像。
这是512 by-512灰度图像的一个示例:
如果要产生颜色图像,则需要输入3通道矩阵,例如
imwrite(rand(512,512,3),' bar.jpg')
。(颜色)编码在文档中另有指定。
imwrite
uses the data you input as the pixel values to generate an image of the specified size.This is an example of a 512-by-512 grayscale image:
If you want to produce a colour image, you need to input a 3-channel matrix, for example
imwrite(rand(512, 512, 3), 'bar.jpg')
.The (colour) encoding is otherwise specified in the documentation.