surprisingly substituing 'UpdatePreviewWindowFcn' by 'FramesAcquiredFcn' solves the flickering problem, but introduces lag due to (constant) memory access (one frame per trigger)
custom preview function for video data
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, i m trying to write a custom preview function for processing video data. Due to camera constraints i can only use one resolution.. However video data within preview function can be processed at lower resolutions.
The problem is a strange axe flicker when subsampling/viewing the original video data for processing.. I was able to reproduce it by using a web camera and a simple script:
function test002
close all;clear all;
vid = videoinput('winvideo');
hFig = figure;
subsample=2;
vidRes = get(vid, 'VideoResolution');
imWidth = vidRes(1)/subsample;
imHeight = vidRes(2)/subsample;
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(imHeight, imWidth, nBands) );
setappdata(hImage,'UpdatePreviewWindowFcn',@mypreview_fcn);
preview(vid, hImage);
end
function mypreview_fcn(obj,event,himage)
data=event.Data;
subsample=2;
data_sub=data(1:subsample:end,1:subsample:end,:);
set(himage,'CData',data_sub);
end
Any ideas?? (tried doubleBuffering, and resizing figure)
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Preview and Device Configuration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!