The Laplacian filter detects edges by computing second‑order derivatives.
import cv2 def laplacian_filter(img): gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) return cv2.Laplacian(gray, cv2.CV_64F)