how to save the figure into image
with the same size
I = imread('peppers.png'); %# Load a
sample
imageimshow(I); %# Display it
[r,c,d] = size(I); %# Get the
image size
set(gca,'Units','normalized','Position',[0 0 1 1]); %# Modify axes
size
set(gcf,'Units','pixels','Position',[200 200 c
r]); %# Modify figure
size
hold on;
plot(100,100,'r*'); %# Plot something
over the image
f = getframe(gcf); %# Capture the
current
window
imwrite(f.cdata,'image2.jpg'); %# Save the
frame data
imshow(vid(:,:, row));
hold on;
text(5, 18,
strcat('#',num2str(row)), 'Color','y', 'FontWeight','bold','FontSize',20);
rectangle('Position',round(a.BoundingBox),'LineWidth',4,'EdgeColor','g');
hold off;
pause(0.01);
s_res = sprintf('mouse/F%.5d.jpg',
row);
set(gca,'position',[0
0 1 1]);
saveas(gcf,s_res)
加载中,请稍候......