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)