%% Live Image Acquisition and Histogram Display
%
% This example shows how to use Simulink(R) blocks to display live video 
% stream and a histogram of its RGB values side by side.
%
% Image Acquisition Toolbox(TM) provides a Simulink 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 the Logitech(R) Quickcam(R) Zoom webcam into Simulink.  This example 
% uses the Histogram block in DSP System Toolbox(TM) to calculate the 
% histograms of R, G, and B values in each video frame.
%
% This example requires Simulink, DSP System Toolbox and Computer Vision 
% Toolbox(TM) to open and run the model. 


%%
%
% <matlab:web('https://www.mathworks.com/videos/live-image-acquisition-and-histogram-display-101514.html','-browser') Watch
% histogram display on live video stream>. (10 seconds)
%
%

%%

% Copyright 2006-2017 The MathWorks, Inc.

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

%%
%
close_system('demoimaqsl_rgbhistogram_win');

%% Live Video Input
% The input video is acquired live from a winvideo image acquisition device
% (Logitech Quickcam Zoom). In this example, the block acquires RGB frames 
% from the Logitech camera and outputs them into the Simulink model at every 
% simulation time step. The data type output from the block is uint8. 

%% Histogram Display Results
% The example displays the histograms of R, G, and B values in the RGB 
% Histogram window and displays the original RGB video in the viewer window.
%
% <<../demoimaqsl_rgbhistogram_outputs.png>>

%%
% Even though a winvideo Logitech webcam 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_rgbhistogram_win.slx')) demoimaqsl_rgbhistogram_win.slx>
%
% Platform independent: <matlab:open(fullfile(matlabroot,'examples','imaq','demoimaqsl_rgbhistogram_all.slx')) demoimaqsl_rgbhistogram_all.slx>
%
% Windows-only example model contains the To Video Display block (supported 
% only on Windows) from Computer Vision System Toolbox and supports code 
% generation. The platform independent version consists of Video Viewer 
% block and does not support code generation.
