我正在尝试在二进制图像中找到轮廓,这是一个 numpy 数组
a = np.array(np.random.rand(1024,768),dtype='float32')
_, t2 = cv2.threshold(a,127,255,0)
im2, contours, hierarchy = cv2.findContours(t2,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
当我尝试运行该代码时,出现此错误
OpenCV Error: Unsupported format or combination of formats
([Start]FindContours supports only CV_8UC1 images when
mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only)
in cvStartFindContours