In order for the computer to understand "what is in the image", the process of drawing the outline of the detection target and finding the feature from it is often taken.
In this article, I will post the result of doing the outline drawing part with Python + OpenCV in three ways.
We have prepared two images to be processed.
Nature and humans.
This is about this.
edge.py
import cv2
img = cv2.imread('xxxxxxx.jpg')
#Edge detection
edge_laplacian = cv2.Laplacian(img, -1)#Laplacian
edge_sobel = cv2.Sobel(img, -1, 0, 1)#Sobel
edge_canny = cv2.Canny(img, 10.0, 200.0)#Cany
#File export
cv2.imwrite('laplacian.jpg', edge_laplacian)
cv2.imwrite('sobel.jpg', edge_sobel)
cv2.imwrite('canny.jpg', edge_canny)
Laplacian ↓ Sobel ↓ Cany ↓
Laplacian ↓ Sobel ↓ Cany ↓
Recommended Posts