Is there a good method for painting over an image in a MATLAB GUI without lag?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am working on a computer vision project that requires hand-labeled data. To acquire this data, I created a MATLAB GUI that takes as input a raw image, displays the image, allows the user to "paint" over the image where a certain object exists (using click-and-drag type operations), and returns a binary mask, where ones correspond to pixels that the user painted over.
Some technical details...I am using the WindowButtonDownFcn to set the "Selected" property of the figure (so painting starts whenever the user clicks somewhere on the image), the WindowButtonMotionFcn to color pixels during painting, and the WindowButtonUpFcn to stop painting a stroke (by setting the "Selected" property back to "off").
In the WindowButtonMotionFcn (during painting), I get the "CurrentPoint" on the image, add it to an array of previously selected points, then call a rendering function to update the image. The problem is that the image updates take too long, which causes an annoying delay between where I am painting and when it appears on the image.
Does anyone have any experience with this or suggestions on how to speed it up?
Other details that may be helpful...when the user clicks on the image, the "CurrentPoint" is only a single pixel. My images are roughly 600x800 pixels, so I need to incorporate a brush that allows the painted pixels to be visible. Right now, I am using imdilate and strel to enlarge the "paintbrush", but I think this is slowing things down a lot.
Would drawnow or refreshdata help me out here? I can't tell from the documentation.
2 Kommentare
KAE
am 18 Jul. 2017
I am assuming the slowdown is when you are running it as a GUI from Matlab, not as a compiled exe. I am noticing the latter is much slower for a similar application.
SURESH BHANOTH
am 27 Mai 2019
Bearbeitet: SURESH BHANOTH
am 7 Jun. 2019
Mr. Matthew Eicholtz I am working on a computer vision project that requires hand-labeled data. To acquire this data, I created a MATLAB GUI that takes as input a raw image, displays the image, allows the user to "paint" over the image where a certain object exists (using click-and-drag type operations), and returns a binary mask, where ones correspond to pixels that the user painted over.
Some technical details...I am using the WindowButtonDownFcn to set the "Selected" property of the figure (so painting starts whenever the user clicks somewhere on the image), the WindowButtonMotionFcn to color pixels during painting, and the WindowButtonUpFcn to stop painting a stroke (by setting the "Selected" property back to "off"
thanks in advance
Antworten (2)
Image Analyst
am 9 Aug. 2014
Bearbeitet: Image Analyst
am 9 Aug. 2014
For what it's worth, Brett has a 4 part series on emulating Photoshop on Steve's blog here: http://blogs.mathworks.com/steve/2012/11/13/image-effects-part-1/. Not sure if it talks about the paintbrush tool though.
2 Kommentare
Image Analyst
am 11 Aug. 2014
Would you be willing to outline a region instead of "painting" it? If so, use imfreehand(), or roipolyold(). See attached demos.
Dima Lisin
am 11 Aug. 2014
Do you need to label arbitrarily shaped regions, or would rectangles be sufficient? In the latter case, please try the Training Image Labeler app in the Computer Vision System Toolbox.
Siehe auch
Kategorien
Mehr zu Image Preview and Device Configuration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!