我需要使用 Python 帮助和 OpenCV 将第一张图像转换为第二张图像。请帮我做到这一点!
样本输入
样本输出
使用此代码 -
import cv2 img = cv2.imread(r'image.png',1) retval,threshold = cv2.threshold(img,20,255,cv2.THRESH_BINARY) cv2.imshow("Threshold",threshold) cv2.waitKey(0)
输出 -