필터 지우기
필터 지우기

How to prevent overwriting of the frames in preview output window

조회 수: 2 (최근 30일)
praveen
praveen 2011년 6월 3일
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
praveen
praveen 2011년 6월 11일
Hello?!!! i have been waiting long for an answer..
Please help....

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
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
praveen
praveen 2011년 6월 14일
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 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!

Translated by