Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

A Framework for Video Processing with the DM6437 DVDP

A Framework for Video Processing with the DM6437 DVDP


Introduction

This chapter describes general procedures for reading and writing video streamss. The scripts and models created in this chapter will be the basis for the other video processing chapters.

Hardware and Software Requirements

This laboratory was originally developed using the following hardware and software:

  • MATLAB® R2008a
  • Code Composer Studio (CCS) v3.3
  • Texas Instruments DM6437 Digital Video Development Platform (DVDP) .
  • Video camera and screen.

Related Files

Simulation

Start by creating a new model in Simulink®.

  1. Open the Simulink library browser and add the "From Multimedia File" from the "Sources" group of the Video and Image Processing Blockset (Please refer to Figure 1).
    Figure 1: The "From Multimedia File" Simulink Block
    Figure 1 (graphics1.png)
  2. Double Click and select the “vipmem_Y.avi” input file(Please refer to Figure 2).
    Figure 2: Source Block Configuration
    Figure 2 (graphics2.png)
  3. In order to display the picture the "Video Viewer" from the "Sinks" group of the Video and Image Processing Blockset will be used.
    Figure 3: The "To Video Display" Block
    Figure 3 (graphics3.png)
    Figure 4: Configuring the Video Viewer
    Figure 4 (graphics4.png)
  4. Connect the three blocks as shown in Figure 5.
    Figure 5: Displaying a Video-Clip
    Figure 5 (graphics5.png)
  5. Run the model, you should see the video clip. A single frame is shown mage shown in Figure 6.
    Figure 6: The Video Display
    Figure 6 (graphics6.png)
  6. Save your model (We used the name “Video_sim.mdl", that you may find it here).

Real-Time Processing with the DM6437 DVDP

Using a Camera and a Display

The procedure for capture/display video using the DM6437 is shown in Figure 7.

Figure 7: Using the Video I/O of the DM6437 board
Figure 7 (graphics7.png)

CCS Code Generation

This procedure is similar to the one developed for stills pictures. Video will be capture/display using a camera and a monitor. Image acquisition and Processing will run in a DSP/BIOS task.

  1. Open the “stills_R_W.mdl”
  2. Delete the “From RTDX” and “To RTDX” blocks
  3. Add the "Task" block from the "DSP/BIOS library" group of the "Target Support Package TC6" Blockset.
  4. Add the “Function- Call Subsystem” from the “Ports & Subsystems" group of the "Simulink" Blockset (Please refer to Figure 8).
    Figure 8: The "Function-Call Subsystem" Block
    Figure 8 (graphics8.png)
  5. Rename “Function- Call Subsystem” to “Video Processing” and connect it to the “Task” block.
  6. Save the model as “Video_R_W.mdl”. Your model should look as follows1:
    Figure 9: The Video Processing Model Template
    Figure 9 (graphics9.png)
  7. Double-click the “Task” block and make the same changes as shown in Figure 34.
    Figure 10: Configuring a "Task"
    Figure 10 (graphics10.png)
  8. Double-click the “Video Processing” block. A new window will be opened.
  9. In the new window, add the "Video Capture" and "Video Display" from the "DM6437 EVM Board Support" group of the ""Target Support Package TC6" Blockset as shown in Figure 11.
    Figure 11: The "Video Capture" block
    Figure 11 (graphics11.png)
  10. Double-click the “Video Capture” block and change the Sample Time (and the Video capture mode only if you are using the components in the PAL mode) as shown in Figure 12.
    Figure 12: Video Capture Configuration
    Figure 12 (graphics12.png)
  11. Double-click the “Video Display” block and change the Video capture mode only if you are using the components in the PAL2 mode as shown in Figure 13.
    Figure 13: Video Display Configuration
    Figure 13 (graphics13.png)
  12. Connect the blocks as shown in Figure 14.
    Figure 14: Capturing and Displaying Video
    Figure 14 (graphics14.png)
  13. Generate code & create project. Double-click the " Generate code &.." block.
  14. Build the project. Double-click the “Build Project” block.
  15. Load the project. Double-click the “Load Project” block.
  16. Run the target. Double-click the “Run” block. This model can be found here.

Using the TCP/IP Interface

This section will describe a Simulink model used to generate code for capturing and displaying video frames from/to the PC target using the TCP/IP protocol3.

Figure 15: Capturing and Displaying Video Using the TCP/IP port
Figure 15 (graphics15.png)
  1. Create a new Simulink model
  2. Open the Simulink library browser and add the "C6437EVM" from the "Target Support Package TC6" group of the " C6000 Target Preferences" Blockset (Please refer to Figure 16).
    Figure 16: The "C6437EVM" Block
    Figure 16 (graphics16.png)
    We now need to create Simulink dedicated block to execute CCS commands.
  3. Drag in an empty subsystem into the model (Simulink->Ports & Subsystem-> Subsystem).
  4. Delete its contents
  5. Format it: Give it a name. In our example we use “Bulid / Reload & Run".
  6. Right click on the Subsystem, choose “Block Properties”. Go to the Callbacks tab, and under OpenFcn* enter: “RW_tcpip_script('RW_pcl_tcpip');”, as shown in the following picture:
    Figure 17: Creating the “Bulid / Reload & Run” Simulink block
    Figure 17 (graphics17.png)
  7. Add the "Task" block from the "DSP/BIOS library" group of the "Target Support Package TC6" Blockset.
  8. Add the “Function- Call Subsystem” from the “Ports & Subsystems" group of the "Simulink" Blockset (Please refer to Figure 18).
    Figure 18: The "Function-Call Subsystem" Block
    Figure 18 (graphics18.png)
  9. Rename “Function- Call Subsystem” to “R_W Algorithm” and connect it to the “Task” block.
  10. Add the "IP Config" block from "Target Support Package™ TC6->DM6437 EVM Board Support"
  11. Save the model as “RW_dm6437_tcpip.mdl”. Your model should look as follows:
    Figure 19: The " RW_dm6437_tcpip.mdl " Model
    Figure 19 (graphics19.png)
  12. Double-click the “Task” block and make the same changes as shown in Figure 20.
    Figure 20: "Task" Configuration
    Figure 20 (graphics20.png)
  13. Double-click the “IP Config” block and make the same changes as shown in Figure 21.
    Figure 21: “IP Config” Configuration
    Figure 21 (graphics21.png)
  14. Double-click the “R_W Algorithm” block. A new window will be opened.
  15. In the new window, add the "TCP/IP Recive", "TCP/IP Send", "Byte Unpack" and "Byte Pack" from the "C6000 DSP Communication Libary" group of the ""Target Support Package TC6" Blockset as shown in Figure 22.
    Figure 22: The "TCP/IP Receive" and "TCP/IP Send" blocks
    Figure 22 (graphics22.png)
  16. Connect the blocks as shown in Figure 23.
    Figure 23: The “R_W Algorithm” block
    Figure 23 (graphics23.png)
  17. Double-click the “TCP/IP Receive” block and make the same changes as shown in Figure 24.
    Figure 24: "TCP/IP Receive" Configuration
    (a) Main Screen
    Figure 24(a) (graphics24.png)
    (b) Data Types
    Figure 24(b) (graphics25.png)
    .
  18. Double-click the “TCP/IP Send” block and configure it as shown in Figure 25:
    Figure 25: "TCP/IP Send" Configuration
    Figure 25 (graphics26.png)
  19. Double-click the “Byte Unpack” block and configure it as shown in Figure 26.
    Figure 26: " Byte Unpack " Configuration
    Figure 26 (graphics27.png)
  20. Double-click the “Byte pack” block and configure it as shown in Figure 27.
    Figure 27: " Byte Pack " Configuration
    Figure 27 (graphics28.png)
  21. Open a new m-file, copy the following code and save it as "RW_tcpip_script.m" at the same directory as the model.
  22. Create another new Simulink model. Add the "Byte Pack" from the "C6000 DSP Communication Libary" group of the ""Target Support Package TC6" Blockset as shown before and the "TCP/IP Receive", "TCP/IP Send" from the "Instrument Control Toolbox" blockset.
  23. Configure the " TCP/IP Receive " and " TCP/IP Send " blocks :
    Figure 28: "TCP/IP Receive" "TCP/IP Send" Blocks Configuration
    (a) "TCP/IP Receive"
    Figure 28(a) (graphics29.png)
    (b) TCP/IP Send
    Figure 28(b) (graphics30.png)
  24. Add the "To Video Display" from the "DM6437 EVM Board Support" group of the ""Target Support Package TC6" Blockset , also add the "From Multimedia File" from " Signal Processing Sources" group of the "Signal Processing blockset".
  25. Configure the " From Multimedia File " block
    Figure 29: "From Multimedia File" Configuration
    (a) "TCP/IP Receive"
    Figure 29(a) (graphics31.png)
    (b) TCP/IP Send
    Figure 29(b) (graphics32.png)
  26. Add the “Subsystem” from the “Ports & Subsystems" group of the "Simulink" Blockset as shown before.
  27. Rename “Function- Call Subsystem” to “Display”.Double-click the “Display” block. A new window will be opened. In the new window, add the "Byte Unpack" and " To Video Display " as shown before, add the "Reshape" from the "Math Operations" grope of the "Simulink" blockset. (Configurations are the same as before).
  28. Connect the blocks as follows:
    Figure 30: The "Display" block
    Figure 30 (graphics33.png)
  29. Your model should look as follows:
  30. Save it as “RW_pcl_tcpip.mdl”.
  31. Build load and run the project. Double-click the "Build / Reload & Run" block.
  32. Running the script, you will see the video captured and displayed. A single frame is shown in Figure 32.
    Figure 31: Capturing and Displaying Video Using TCP/IP
    (a) The Captured Video
    Figure 31(a) (graphics35.png)
    (b) The Displayed Video
    Figure 31(b) (graphics36.png)
  33. This model can be found here.

FOOTNOTES

  1. You may add a title to the model, as done here ( ”Video Processing Template”)
  2. If the camera video capture mode is NTSC you should choose this option
  3. You should allocate an IP address to the DM6437 DVDP, as described in the board documentation.

0 comments:

Post a Comment

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.