[PYTHON] Line art extraction of illustrations

Line art extraction from illustrations

I use it occasionally, so make a note.

import cv2

#read image
img = cv2.imread('image.png',0)

#edge extraction (Laplacian of Gaussian)
img = cv2.GaussianBlur(img,(3,3),0)
lap = cv2.Laplacian(img,cv2.CV_32F)
edge = 255-cv2.convertScaleAbs(lap)

#save
cv2.imwrite('image_edge.png',edge)

Recommended Posts

Line art extraction of illustrations
Topic extraction of Japanese text 1 Basics
Plot of regression line by residual plot
Notify LINE of train operation information
10 selections of data extraction by pandas.DataFrame.query