How to save image as pixel by pixel size and without white background
이전 댓글 표시
Hello, I would like to seek help for the image save as bmp.file with pixel by pixel size and without white background.

clear all; close all; clc
X = [-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150;-150,-125,-100,-75,-50,-25,0,25,50,75,100,125,150];
Y = [-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150,-150;-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125,-125;-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100;-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75,-75;-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50;-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25;0,0,0,0,0,0,0,0,0,0,0,0,0;25,25,25,25,25,25,25,25,25,25,25,25,25;50,50,50,50,50,50,50,50,50,50,50,50,50;75,75,75,75,75,75,75,75,75,75,75,75,75;100,100,100,100,100,100,100,100,100,100,100,100,100;125,125,125,125,125,125,125,125,125,125,125,125,125;150,150,150,150,150,150,150,150,150,150,150,150,150];
r_M = [27,19,12,8,3,3,1,0,0,3,9,15,23;30,20,14,9,5,3,1,0,0,3,7,12,21;33,23,15,11,6,3,2,1,2,4,7,13,20;33,23,15,12,7,4,2,2,2,4,7,12,19;30,20,16,13,8,5,3,3,4,5,7,12,20;27,20,16,14,9,6,4,4,5,5,7,12,21;27,20,16,14,8,5,3,3,4,4,6,11,20;27,19,15,13,7,5,3,2,3,4,6,12,21;25,18,14,12,6,4,2,2,3,4,6,11,21;28,19,15,13,7,4,2,2,3,4,7,13,23;29,19,15,13,8,5,3,2,2,4,7,15,25;33,22,17,14,8,5,3,2,2,3,5,12,23;37,25,19,15,8,6,4,2,1,2,2,10,19];
figure(3)
contourf(X,Y,r_M,2560,'LineColor','none')
shading interp
axis square
% colorbar
% caxis([0 4])
colormap(flipud(gray(256)));
set(gca,'xtick',[])
set(gca,'ytick',[])
% %-------save compensation hologram-------
name = 'hologram';
fpath = 'C:\Users\Admin\Desktop';
saveas(gca, fullfile(fpath, name), 'bmp');
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
