How to prevent overwriting of the frames in preview output window

1 view (last 30 days)
praveen on 3 Jun 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 Comment
praveen on 11 Jun 2011
Hello?!!! i have been waiting long for an answer..
Please help....

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 11 Jun 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.
Walter Roberson
Walter Roberson on 14 Jun 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by