How to prevent overwriting of the frames in preview output window

1 vue (au cours des 30 derniers jours)
praveen
praveen le 3 Juin 2011
I am coding a program to * acquire frames from the webcam ==> draw a bounding box using a custom UpdatePreviewWindowFcn==> update the CData of an image object(himage) and display it using the preview(vidobj,himage) function.*
The program works correctly without any error but the problem is, it displays the frames one over the other in the figure window.
i.e.. The boundingbox which was drawn on the previous frame, continues to be shown on the next frames also.
1. How do i clear the figure window each time before displaying the frame (in himage) or tell me other way so that only the boundingbox of the current frame is visible
2. When I'm using preview(videoobj,himage) , the output is displayed in a figure window and it is not maximized, it is displayed in a smaller window even if i use the resolution as 1024x768. (himage is init to be zeros(768,1024,3) )
3. & I'm not clear with CData of an image. Please explain me about this and please help me understand the following
I'm using a custom function for UpdatePreviewWindowFcn.
i. Why to use preview(videoobject,himage)? i didn't understand this " displays live video data for video input object obj in the image object specified by the handle himage." well.
What is the advantage of using an image object and displaying it's data over using the "handle to the image object that is being updated" which is passed as the third parameter to my custom fuction .
  1 commentaire
praveen
praveen le 11 Juin 2011
Hello?!!! i have been waiting long for an answer..
Please help....

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 11 Juin 2011
1. See the documentation for clf, cla, and delete(). Also consider the possibility of not drawing a new bounding box each time and instead update the previous bounding box to the new size and position.
  4 commentaires
praveen
praveen le 14 Juin 2011
Thank you Mr. Roberson !
I worked on your suggestion and Solved my problem 1!
Though, only updating the rectangle's postition didn't seem to solve the problem.
it works for me when i use :
----------------------------------------------------
rh=rectangle(...)
set(rh,'EraseMode','xor');
set(rh,'Position',...) %updating
-----------------------------------------------------------
Even if i change the erasemode to 'normal' or 'background' it wasn't working 4 me.
Thx..
Now waiting for answers to my other questions......
Walter Roberson
Walter Roberson le 14 Juin 2011
CData of an image object is the property of the object that stores the pixel values. set() new values for the CData property and arrange to have the display updated and the image on the screen will change. This is documented in the "image properties" documentation.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by