Transform a 2D plot into a black and white image
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello.
I want to do something and i can not really think of any method to do it.
Here is the idea, I want to be able to transform a 2D closed shape plot ( like a square, a circle, a triangle,... ) into a 2D image, with the "interior" of the closed shape filled with white pixel, and the exterior of the shape with black pixels.
Do you think it is feasible, and if yes, by which means ?
Thank you very much !
2 comentarios
jonas
el 23 de Mzo. de 2018
Editada: jonas
el 23 de Mzo. de 2018
Not sure exactly what you want as output, but I made you an image of a white square on a black background. Change data in fill to obtain any arbitrary shape
figure;
fill([-.5 .5 .5 -.5],[-.5 -.5 .5 .5],'w')
axis([-1 1 -1 1])
set(gca,'visible','off')
set(gcf,'color',[0 0 0])
F = getframe(gcf);
figure;
imshow(F.cdata)
Respuestas (0)
Ver también
Categorías
Más información sobre Convert Image Type en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!