实验23
1. Experimental Purpose
Learn the principles of Canny edge detection, master the method of reading images, and display the images before and after edge detection on the LCD.
2. Experimental Principle
Edge Detection
In digital images, edge refers to the part of the image where the local changes are most significant. Edges mainly exist between objects and objects, and between objects and backgrounds. They are discontinuities in local image characteristics, such as grayscale mutations, texture structure icons, color icons, etc. Although the reasons for the edge points of images vary, they are all points where the grayscale is discontinuous or changes sharply on the graphics. Image edges are divided into step-shaped, slope-shaped, and roof-shaped.
The edge is actually a collection of points on the image where the gray level changes rapidly. The calculation method is through derivatives and differentials.
Derivative: The slope of a point on a continuous function. The larger the derivative, the greater the rate of change. The greater the rate of change, the closer it is to the "edge". However, it is not commonly used in computers because at a slope of 90 degrees, the derivative is infinite, and it is difficult for computers to represent these infinite things.
Differentiation: On a continuous function, a change of x by dx causes a change of y by dy. The larger the dy value, the greater the change. Then, the differential of the entire image is calculated, and the size of dy is the strength of the edge. The relationship between differentiation and derivative: dy = f '(x) dx.
Canny edge detection
Canny edge detection is a technique for extracting useful structural information from different visual objects and greatly reducing the amount of data to be processed. It has been widely used in various computer vision systems. The general standards for edge detection include:
(1) Detecting edges with a low error rate means capturing as many edges as possible in the image as accurately as possible.
(2) The detected edge should be precisely located at the center of the true edge.
(3) A given edge in an image should be marked only once, and, where possible, image noise should not produce false edges.
To meet these requirements, Canny uses the calculus of variations. The optimal function in the Canny detector is described by the sum of four exponential terms, which can be approximated by the first-order derivative of the Gaussian function.
Among the commonly used edge detection methods, the Canny edge detection algorithm is one of the methods with strict definitions that can provide good and reliable detection. Because it has the advantages of meeting the three criteria of edge detection and a simple implementation process, it has become one of the most popular algorithms for edge detection.
The Canny edge detection operator is a multi-level edge detection algorithm. The goal of Canny is to find an optimal edge detection algorithm. The meaning of optimal edge detection is:
(1) Optimal detection: The algorithm can identify as many actual edges in the image as possible, and the probability of missing a real edge and the probability of falsely detecting a non-edge are as small as possible;
(2) Optimal positioning criterion: the position of the detected edge point is closest to the position of the actual edge point, or the degree to which the detected edge deviates from the actual edge of the object due to noise is minimized;
(3) One-to-one correspondence between detection points and edge points: The edge points detected by the operator should correspond to the actual edge points. To meet these requirements, Canny used the calculus of variations, which is a method for finding functions that optimize specific functions. The optimal detection is represented by four exponential function terms, but it is very close to the first-order derivative of the Gaussian function.
Steps of Canny edge detection
(1) Apply Gaussian filtering to smooth the image in order to remove noise;
(2) Find the intensity gradients of the image;
(3) Apply non-maximum suppression technology to eliminate edge false detection;
(4) Applying a double threshold method to determine the possible (potential) boundary;
(5) Use hysteresis techniques to track boundaries.
For example, with double thresholds t1 and t2 (t1≦t2), points greater than t2 are definitely edges, and points less than t1 are definitely not edges. For points between t1 and t2, a search is initiated through the already determined edge points. Points that can be reached are edges, and points that cannot be reached are not edges.
programming
In the program flow design, the peripheral enable configuration must be performed first, followed by the LCD pin multiplexing configuration and LCD interrupt configuration, and then the LCD display is initialized. Finally, the BMP image in the project directory is read and edge detection is performed, and the image before and after edge detection is displayed on the LCD.
Video Analysis and Vision Library
VLIB is a TI software library that accelerates video analytics development and improves performance by up to 10 times. VLIB is an extensible library optimized for C6x DSP cores. The collection of more than 40 cores includes implementations of background modeling and subtraction, object feature extraction, tracking and recognition, and low-level pixel processing.
Includes Windows and Linux installation executables for C64x+, C674x, and C66x processors. Each executable installs a component package repository, a documentation directory, an Eclipse plug-in directory, and an extended component directory structure containing component libraries, header files, and test examples.
The TMS320C6748 processor uses vlib_c674x_3_3_2_0.
It will be installed to the installation path of CCS5.5. After the installation is complete, the corresponding folder will appear. Source code path: \vlib_c674x_3_3_2_0\packages\ti\vlib\src
3. Operation phenomenon
Laboratory equipment
The hardware interface used in this experiment is LCD, and the required hardware is the experimental board, emulator, LCD and power supply.
Operational phenomenon
Hardware Hookup
(1) Connect the emulator to the computer's USB port.
(2) Set the dip switch to DEBUG mode 01111, connect the power supply of the experimental box, and turn on the power switch to power on.
Software Operation
Import the project and select the corresponding project in the Demo folder
Compile the project and generate an executable file
Connect CCS to the experiment box and load the program
After the program is loaded, click Run Program
After running the program, the Console window of CCS will print relevant information and the LCD will display the title.
After a short wait, the image processing is complete and the LCD will display the image before and after edge detection processing.
After the experiment is over, first click the yellow button to pause the program, then click the red button to exit the connection between CCS and the experimental box, and finally turn off the power of the experimental box.