白底opencv(python)有没有边缘检测?

Is there any edge detection in opencv(python) with white background?

OpenCV 中是否有类似 canny 的边缘检测过滤器,但我希望背景为白色,边缘为黑色

我不认为有这样的概念,但你可以这样实现

import cv2
import numpy as np
img = cv2.imread("arch.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

edges = cv2.Canny(gray,100,200)
ret,th2 = cv2.threshold(edges,100,255,cv2.THRESH_BINARY_INV)


cv2.imshow("img",th2)
cv2.waitKey(0)
cv2.destroyAllWindows()