image - matlab render graphical objects to a bitmap in memory -


this supposed simple think can't right...

i plot several graphical objects in figure , want bitmap of figure, maintains position on objects , dimensions of figure.

to give simple example, if plot 2 points in coordinates (0,0) , (200,200) expect rendering output matrix of size (200,200) pixels (0,0) , (200,200) have gray level of 255 , rest of pixels zeroed (this in case of 8-bit per pixel grayscale though 3i prefer color bitmap reflect colors of objects appear in original figure)

thanks

to answer own question, did render figure graphical objects bitmap in memory , keep in scale: used getframe , resized result size of axes. here goes:

% plot stuff on current axes, then...  set(gca, 'ydir', 'reverse'); xlim = get(gca, 'xlim'); ylim = get(gca, 'ylim'); rendered = getframe(gca); imagemat = imresize(rendered.cdata, [floor(ylim(2)), floor(xlim(2))]); 

here image sampled twice both inefficient in terms of processing time , gives degraded image. purposes it's ok still single-sample solution nice...


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -