[LINEOBJ,XS,YS] = FREEHANDDRAW(ax_handle,line_options)
Draw a smooth freehand line object on the current axis (default),or on the axis specified by handle in the first input argument. Left-click once to begin drawing, right-click to terminate, or double-click to close contour and terminate.
INPUT ARGUMENTS: First: axis handle (optional)
Additional: valid line property/value pairs
OUTPUT ARGUMENTS: 1) Handle to line object
(Note that output args 2 & 3 can also be extracted from the first output argument.)
Ex: [myobj,xs,ys] = freehanddraw(gca,'color','r','linewidth',3);
Written by Brett Shoelson, PhD
3/29/05. Modified 10/05/06 to allow double-click contour closure.
on R2014b on Ubuntu (12.04 LTS), I had to comment out line 82 :
since my figure does not have this field, but otherwise this function worked perfectly !
IMFREEHAND didn't exist when I wrote FREEHANDDRAW. I'm happy to see that you're using the new Toolbox functionality!
how is the following different from what the file outputs?
h = imfreehand;data=get(h);
These statements give the x, y data of an arbitrary freehand drawing on a figure.
I had been using this with R2008b and discovered that it's still "broken" in R2009b, but thanks to Paul Groot's helpful comment, it's now working again. However, now that the Image Processing Toolbox has imfreehand(), maybe you could use that instead.
Very nice work!
Noticed a small issue, which may only occur in recent (R2009a) releases: The DoubleBuffer property seems not always present in the oldvals structure at line 82. This could be solved by moving it to a separate line:
if isfield(oldvals, 'DoubleBuffer')
Very good work works very nicely !!!
Has anyone managed to merge the line object to the actual image one is drawing upon.... i.e change the value of the actual image pixels .. Thanks
Great, easy to use tool, thanks!
Works great. This saved me a ton of coding. I turned it into an eraser by making a mask of the points, dilating them, and applying the mask to the image. The only drawback with my application of this program is that the tool drops points if you move it too fast so you don't get perfectly continuous lines. Regardless, great program. Don't forget to input the axes you are working with, NOT the image. Easy mistake for NBs like me.
Mistakenly cited ability to draw in 3D. Function returns xy- data, NOT xyz data.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.