<< Chapter < Page | Chapter >> Page > |
The Video Viewer1 window displays the original image with a white line drawn over the longest line in the image.
You may repeat the simulation here to experiment the various algorithms with different thresholds.
Open the “ stills_R_W.mdl ” Simulink model (generated in the " A Framework for Image Processing with the DSK6416 " module).
Copy the "Line Detection" block from "LineDetection.mdl".
Connect the various blocks as shown in . Save the model (LineDetectionPictureDSK6416.mdl).
Build the project. Double-click the “Build Project” block.
Load the project. Double-click the “Load Project” block.
Run the target. Double-click the “Run” block.
Plotting the input and output in MATLAB, you will see :
In this session we will show how to create the lane detection model, as an extension of the Line Detection Model, introduced in the previous chapter.
Open the “ video_sim.mdl ” Simulink model (generated in the " A Framework for Video Processing with the DM6437 DVDP " module). Copy the “line Detection” block in this model into the “video_sim.mdl”, and connect it to the I/O blocks as follows:
Double-Click the “Line Detection” block. In the open window, add the “Submatrix block from the Signal Processing Toolbox (EIhter from the “Math Functions / Matrices and Linear Algebra / Matrix Operations” group or from the “Signal Management / Indexing” group. Connect it between the input node and the “Edge Detection Block” as follows:
Configure the “Submatrix” block as follows:
This will define the Region of Interest (ROI). Rename the block to “Define ROI”
Select the “Edge Detection Block”, and create a Subsystem for the “Enhanced Detection”, as shown in the following picture:
The model should look as follows:
Double Click the “Enhanced Edge Detection” block. Rename the Input port to “ROI”, and the output port to “Binary Image”
Add to it the blocks shown in the following table:
Block | Library | Quantity |
2-D Histogram | Video and Image Processing Blockset / Statistics | 1 |
Maximum | Signal Processing Blockset/ Statistics | 1 |
Data Type Conversion | Simulink/ Signal Attributes | 1 |
Bias | Simulink / Math Operations | 1 |
Gain | Simulink / Math Operations | 1 |
Relational Operator | Simulink / Logic and Bit Operations | 1 |
Logical Operator | Simulink / Logic and Bit Operations | 1 |
Place the blocks so that your model resembles the following figure. Create the “Calculated threshold based on histogram” with the selected blocks.
The model should look as shown in the following picture. Create the “Histogram based binary thresholding” with the selected blocks.
Double-click the “Hough Algorithm” block in the model. You should change it to select the two longest lines.
You should change the configuration of the selector blocks as follows:
Add an “Embedded MATLAB function” block (from the “Simulink/User-Defined Functions” group). Double-Click the block and enter the following MATLAB function:
Notification Switch
Would you like to follow the 'From matlab and simulink to real-time with ti dsp's' conversation and receive update notifications?