How to prevent overwriting of the frames in preview output window
조회 수: 2 (최근 30일)
이전 댓글 표시
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개)
Walter Roberson
2011년 6월 11일
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
Walter Roberson
2011년 6월 14일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!