User`s guide

2 Introduction
% Set up the push buttons
uicontrol('String', 'Start Preview',...
'Callback', 'previ ew( vid)',...
'Units','normalized',...
'Position',[0 0 0.15 .07]);
uicontrol('String', 'Stop Preview',...
'Callback', 'stopp rev iew(vid)',...
'Units','normalized',...
'Position',[.17 0 .15 .07]);
uicontrol('String', 'Close',...
'Callback', 'close (gc f)',...
'Units','normalized',...
'Position',[0.34 0 .1 5 .0 7]);
% Create the text label for the t imes tamp
hTextLabel = uicontrol ('style','text','St ring','Timestamp', . ..
'Units','normalized',...
'Position',[0.85 - .04 .15 .08]);
% Create the image object in which you want to
% display the video previe w data.
vidRes = get(vid, 'VideoResolution');
imWidth = vidRes(1);
imHeight = vidRes(2);
nBands = get(vid, 'NumberOfBands');
hImage = image( zeros(imHeight, imWidth, nBan ds) );
% Specify the size of the axes th at contains the image object
% so that it displays the image a t t he right resolution and
% centers it in the figure window.
figSize = get(hFig,'Po sition');
figWidth = figSize(3);
figHeight = figSize(4) ;
set(gca,'unit','pixels',...
'position',[ ((fi gWid th - imWidth)/2)...
((figHeight - imHeig ht)/2)...
imWidth imHeight ]);
% Set up the update preview window function.
setappdata(hImage,'UpdatePreviewWi ndowFcn',@mypreview_fcn);
2-16