custom preview function for video data
Afficher commentaires plus anciens
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)
1 commentaire
GEO GEP
le 4 Juil 2012
Réponses (0)
Catégories
En savoir plus sur Image Preview and Device Configuration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!