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