Call ret, thresh = cv2.threshold(seg, 127, 255, cv2.THRESH_BINARY)
for binarization, appear
cv2.error: OpenCV(4.5.5) /io/opencv/modules/imgproc/src/thresh.cpp:1659: error: (-210:Unsupported format or combination of formats) in function 'threshold'
My seg
array is of type np.int64
by default, but the above function requires uint8
, so adding the following statement to seg
can solve the problem
seg = seg.astype(np.uint8)