This example shows how to capture and view video images from a Camera Link camera attached to the Bitflow™ Neon-CLB frame grabber board. Images are acquired with the model dxpcImMultiTarget running on the target computer and viewed with the model dxpcImMultiHost running on the host computer. dxpcImMultiTarget is a multirate multitasking model. Images are captured at 30Hz and then compressed and transmitted to the host computer at 10 Hz.
Computer Vision System Toolbox™
Bitflow Neon-CLB frame grabber installed in the target computer
Bitflow SDK installed on the host computer
Camera Link camera supported by the Bitflow Neon-CLB frame grabber
% Open the model. mdlOpen = 0; systems = find_system('type', 'block_diagram'); if isempty(strmatch('dxpcImMultiTarget', systems, 'exact')) mdlOpen = 1; open_system('dxpcImMultiTarget'); end
% Build the model and download to the target computer, TargetPC1. set_param('dxpcImMultiTarget','RTWVerbose','off'); % Configure for a non-Verbose build. rtwbuild('dxpcImMultiTarget'); % Build and download application.
### Starting xPC Target build procedure for model: dxpcImMultiTarget Warning: This model contains blocks that do not handle sample time changes at runtime. To avoid incorrect results, only change the sample time in the original model, then rebuild the model. ### Successful completion of build procedure for model: dxpcImMultiTarget ### Looking for target: TargetPC2 ### Download model onto target: TargetPC2
% Close the target model if we opened it. if (mdlOpen) bdclose('dxpcImMultiTarget'); end
This model receives compressed images sent by dxpcImMultiTarget, decompresses the images, and renders them to a video display.
% Open the model. mdlOpen = 0; systems = find_system('type', 'block_diagram'); if isempty(strmatch('dxpcImMultiHost', systems, 'exact')) mdlOpen = 1; open_system('dxpcImMultiHost'); end
% Using the xPC Target(TM) object variables |tg|, start the target model. start(tg); % Start the target model. pause(1); % Wait for 1 sec. % Start the host model. set_param(bdroot,'SimulationCommand','start'); % Start the host model. pause(10); % Wait for 10 sec.
% Render the video display. open_system([bdroot,'/To Video Display']);
% Plot the image size. open_system([bdroot,'/Scope']);
stop(tg); % Stop the target model. set_param(bdroot,'SimulationCommand','stop'); % Stop the host model. % Close the host model if we opened it. if (mdlOpen) bdclose('dxpcImMultiHost'); end % EOF dxpcImMultiDemo.m