how to update image preview every frame?

조회 수: 6 (최근 30일)
Dylan
Dylan 2012년 8월 13일
Hi,
I am trying to use the Image Acquisition Toolbox to view a video stream as it comes in. I want to process the image as it comes in, however. Setting the 'UpdatePreviewWindowFcn' works, but it only applies the processing to a few frames. The processing isn't too complicates, all I want to do is display the transpose of he image, and a plot of the integrated brightness along the x-axis and y-axis in 2 different subplots. Something like:
finaldata=event.Data;
finaldata=transpose(finaldata(:,:,1));
% Display image data(only first color level)
set(himage, 'CData', finaldata)
int_fr=sum((finaldata(:,:)));
int_fr2=sum(finaldata(:,:),2);
subplot(2,2,2)
plot(int_fr);
subplot(2,2,4)
plot(int_fr2);
(this is what I put in the preview function)
Is there any way to make sure this function is called every time I display a frame? Note: The image acquisition doesn't need to be too fast, so if I could just not display the frames for which this isn't being called, that would work too.
Thanks for any help, -d

답변 (2개)

bethel o
bethel o 2012년 8월 13일
I have not used the Image aquisition toolbox before. But can you not just put thus in the so called preview function just to test before doing anything complex.
finaldata=event.Data;
imshow(finalData(:,:,1),[])% require image processing toolbox, or you can just
%use image(), but your image aquisition toolbox shouls have somthing that can
%display image
drawnow

bethel o
bethel o 2012년 8월 13일
what about the function 'drawnow'? See link
  댓글 수: 1
Dylan
Dylan 2012년 8월 13일
Hmmm... doesn't seem to have any effect if I place it inside the 'UpdatePreviewWindowFcn'. Is that what you had in mind?

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

Community Treasure Hunt

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

Start Hunting!

Translated by