Extracting image from a figure without gray border.

9 vues (au cours des 30 derniers jours)
Simone Cordella
Simone Cordella le 12 Avr 2017
Hi,
I'm having a problem with extracting an image that I plot in a figure:
fig = figure
imshow(myimage)
%At the end I extract the plot from the figure in this way
Sf=getframe(fig);
[X,map]=frame2im(Sf);
So in X I obtain the plot, the problem is that the X image, contain also the grey boarder that matlab display around the plot in the figure. How can I save in X only the plot without the gray boarder?

Réponses (1)

KSSV
KSSV le 12 Avr 2017
You try this:
set(gca,'position',[0 0 1 1],'units','normalized')
  1 commentaire
Nicholas Richmond
Nicholas Richmond le 7 Sep 2017
Many thanks, this did the trick for me.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by