Welcome to Raspbot repository
3.Edge detection
The purpose of edge detection is to significantly reduce the image data size while retaining the original image attributes.
Canny edge detection is to extract useful structural information from different visual objects, which can greatly reduce the amount of data need to be processed. It has been widely used in various computer vision systems.
Standards for edge detection:
Detect edges with a low error rate.
The detected edge should be accurately positioned at the center of the actual edge.
The given edges in the image should only be marked once, the noise of the image should not produce false edges.
Canny edge detection algorithm can be divided into the following 5 steps:
1) Use a Gaussian filter to smooth the image and filter out noise.
2) Calculate the gradient intensity and direction of each pixel in the image.
3) Apply Non-Maximum Suppression to eliminate the spurious response caused by edge detection.
4) Apply Double-Threshold detection to determine the true edges and potential edges.
5) Finalize edge detection by suppressing isolated weak edges.
Code path:
/home/pi/Yahboom_Project/Raspbot/1.OpenCV_course/03IP_Draw_text_line_segments/ 03_1edge_detection1.ipynb
|
Two comparison picture
img_bgr2rgb1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img_bgr2rgb1)
plt.show()
img_bgr2rgb1 = cv2.cvtColor(dst, cv2.COLOR_BGR2RGB)
plt.imshow(img_bgr2rgb1)
plt.show()

[Original picture] [Edge detection]
Code path:
/home/pi/Yahboom_Project/1.OpenCV_course/03IP_Draw_text_line_segments 03_2edge_detection2.ipynb
|
|
|
After running the following program, binarization picture will be displayed in the jupyterLab control interface, as shown below.
