basically, i am supposed to create a image with circles and lines... not using plot function. because the final output is to pop out by imshow().or image().or imagesc()... and the created image will contiune the color processing.
3 Answers
The simplest way is to draw it as usual, then use getframe
to grab an image of the figure.
EDIT: I don't have time for much detail, but look at the following:
- line: http://www.mathworks.co.uk/help/techdoc/ref/line.html
- circle: http://www.mathworks.com/matlabcentral/fileexchange/2876
- axis properties: http://www.mathworks.co.uk/help/techdoc/ref/axes_props.html (You may want to set 'Visible', 'off', 'Position', [0 0 1 1], 'DataAspectRatio', [1 1 1])
- getframe: http://www.mathworks.co.uk/help/techdoc/ref/getframe.html
The MATLAB help is really very useful.
-
Thanks a lot! i'm doing school project now. actually i am starting from zero, i have little knowledge about matlab. my objective is to create a basic image of body tissue(further more i also need to do the color processing). do you have any suggestions on the topics i need to learn if i want to get these work done? because i really don't know how to start....– zuoCommented Sep 26, 2011 at 2:20
-
I'm not really sure what you are asking but you can start by up-voting and accepting an answer.– NzbuuCommented Sep 27, 2011 at 8:43
If you are trying to draw lines and circles directly on a raster image (matrix of pixels), then check out the Bresenham line-drawing algorithm and its variants for circles.
I am sure you can find existing implementations for them on FEX
Another possibility is to show the image (IMSHOW, IMAGESC, ..), use the plotting functions as usual (PLOT, LINE, ...), then grab the displayed figure as image again using GETFRAME as Nzbuu suggested.
Use the matlab function "rectangle" and specify the 'Curvature" parameter to one. i.e.
rectangle('Position',[0 0 100 100],'Curvature',[1 1])
This is obviously counter intuitive, but in Matlab, rectangle is the function you use to draw ellipses and circles.
Here is the appropriate mathworks doc: