开发者

How can i create circles in a image ....not using plot function?

开发者 https://www.devze.com 2023-04-06 18:08 出处:网络
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()...

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开发者_JAVA百科 created image will contiune the color processing.


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.


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:

http://www.mathworks.com/help/techdoc/ref/rectangle.html

0

精彩评论

暂无评论...
验证码 换一张
取 消