Is there a good method for painting over an image in a MATLAB GUI without lag?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
KAE
il 18 Lug 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
il 27 Mag 2019
Modificato: SURESH BHANOTH
il 7 Giu 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
Risposte (2)
Image Analyst
il 9 Ago 2014
Modificato: Image Analyst
il 9 Ago 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 Commenti
Image Analyst
il 11 Ago 2014
Would you be willing to outline a region instead of "painting" it? If so, use imfreehand(), or roipolyold(). See attached demos.
Dima Lisin
il 11 Ago 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.
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!