MATLAB Examples

Video Surveillance Over TCP/IP Network

This example shows how to do video surveillance over the TCP/IP network using Simulink®.

Instrument Control Toolbox™ provides Simulink® blocks for sending and receiving data over TCP/IP and UDP networks. This example uses the TCP/IP Send and Receive blocks to perform Video Surveillance. The Simulink model shows a video surveillance recording on your Texas Instruments™ DSP platform using Embedded Coder™ (for TI's C6000™). The motion detection algorithm is implemented in Simulink and deployed to a TIC6000 signal processor.

This example requires Simulink, Computer Vision System Toolbox™, DSP System Toolbox™ and Embedded Coder™ (for TI's C6000™) to open the model. The example also requires the following hardware TMS320C6416 DSK / EVM board, D.signT DSK-91C111 Ethernet daughter card for C6416 DSK target and Ethernet cable.


Host Model

The following figure shows the algorithm which runs on the host side machine and communicates with the target using the TCP/IP Send and Receive blocks. The model communicates with the target at port number 49000. The TCP/IP blocks are configured to send and receive data in blocking mode.

Target Model

The following figure shows the target side example model.

The following figure shows the Surveillance Algorithm which is executued on the target C6416. The algorithm is implemented using blocks from Simulink, DSP System Toolbox™ and Embedded Coder and is converted to C using Simulink® Coder™.


While the generated code is running on the target, a host side Simulink model simultaneously sends video frames to the target via TCP/IP protocol. The target receives video frames sent by the host side Simulink model, computes the sum of the absolute value of differences (SAD) between successive video frames, and returns an estimate of motion. When the motion estimate value exceeds a threshold, the target increments a counter and sends the corresponding frame back to the host using the TCP/IP block. You can also adjust the motion threshold using the host side Simulink model.

Running the Example

Open the target model and double click "Build Reload & Run" to build, load and run the DSP code. Once the code is generated, it will bring up the host side model. Run the host side model to watch the video surveillance algorithm using motion detection.