OpenCV中是否有像canny这样的边缘检测滤镜,但我希望背景为白色,边缘为黑色
答案 0 :(得分:1)
我不认为有这样的概念,但是您可以通过这种方式实现
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()