save the output figure as binary image
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
mohammed alany
el 16 de Feb. de 2020
Comentada: mohammed alany
el 17 de Feb. de 2020
i am plotting rectangle like in the code bellow,
rectangle('Position',[96 539-450 214 161], 'FaceColor',[0 .5 .5])
axis([0 559 0 539])
i want to save the output figure as binary image "in workspace" without border and exact area.
as a result the binary image must be like 559x539
any help?
Respuesta aceptada
Subhadeep Koley
el 16 de Feb. de 2020
Editada: Subhadeep Koley
el 16 de Feb. de 2020
The below code will save the figure as an image in the worksapce.
clc; close all;
rectangle('Position',[0 0 539 539], 'FaceColor',[0 .5 .5],...
'LineStyle', 'none');
axis tight; axis off;
frm = getframe(gcf);
img = frame2im(frm);
img = imresize(img, [539, 539], 'bicubic');
figure; imshow(img);
But, if you convert the image to binary (as you stated in your question) then all the color information (which you added using FaceColor) will be lost. And the image will become a black blob.
8 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!