gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 3)
edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 7, 7)
cv2.imwrite("./uotput_image.jpg", edges)
它出現下面錯誤。
error Traceback (most recent call last)
<ipython-input-2-d3dd0507c5b7> in <module>()
9 img = cv2.imread("people1.jpg")
---> 10 gray = cv2.cvtColor(img, cv2.COLORBGR2GRAY)
11 gray = cv2.medianBlur(gray, 3)
12 edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPIVETHRESHMEANC, cv2.THRESHBINARY, 7, 7)
error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !src.empty() in function 'cvtColor'
請問我該怎麼辦?