%% Edge Detection on Live Video Stream
%
% This example shows how to use the From Video Device block to detect the 
% edges of objects in a live video stream.
%
% Image Acquisition Toolbox(TM) provides a Simulink(R) block to acquire live
% image data from image acquisition devices into Simulink models.
%
% This example uses the From Video Device block to acquire live image data
% from a Hamamatsu C8484 camera into Simulink.  The Prewitt 
% method is applied to find the edges of objects in the input video stream. 
%
% This example requires Simulink, and Computer Vision Toolbox(TM) to
% open and run the model. 



%%
%
% <https://www.mathworks.com/videos/edge-detection-on-live-video-stream-101453.html 
% Watch edge detection on live video>. (9 seconds)
%
%

%%

% Copyright 2006-2018 The MathWorks, Inc.


%% Example Model
% The following figure shows the example model using the From Video Device
% block.
%
open_system('demoimaqsl_edgedetection_win');

%%
%
close_system('demoimaqsl_edgedetection_win');

%% Live Video Input
% The input video is acquired live from a Hamamatsu image acquisition device
% (C8484). In this example, the block acquires intensity data from the 
% camera and outputs it into the Simulink model at every simulation time 
% step. The data type output from the block is single. 

%% Edge Detection Analysis
% This example uses Computer Vision Toolbox to find the edges 
% of objects in the video input. When you run the model, you can 
% double-click the Edge Detection block and adjust the threshold 
% parameter while the simulation is running. The higher you make the
% threshold, the smaller the amount of edges the example finds in the video
% stream.
%
% <<../demoimaqsl_edgedetection_outputs.png>>

%%
% Even though a Hamamatsu camera was used for this example, this model 
% can be easily updated to connect your models to other supported image 
% acquisition devices. This provides you the flexibility to use the same 
% Simulink model with different image acquisition hardware.

%% Available Example Versions
%
% Windows(R) only: <matlab:open(fullfile(matlabroot,'examples','imaq','demoimaqsl_edgedetection_win.slx')) demoimaqsl_edgedetection_win.slx>
%
% Platform independent: <matlab:open(fullfile(matlabroot,'examples','imaq','demoimaqsl_edgedetection_all.slx')) demoimaqsl_edgedetection_all.slx>
%
% Windows-only example model contains the To Video Display block (supported 
% only on Windows) from Computer Vision Toolbox and supports code 
% generation. The platform independent version consists of Video Viewer 
% block and does not support code generation.
