我正在尝试在opencv中设置treshold的值(请参见下面的代码)如何将其设置为0.5?
import cv2
import numpy as np
# import image
image = cv2.imread('photo1.png')
# grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)
# binary
ret, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY_INV, 0.5)
cv2.imshow('threshold', thresh)
它返回我没有想像我想要的东西。谢谢:)