我有一个numpy数组。如何将其转换为cv2可以在OpenCV 3.0中操作的图像类型?例如:
smaller = np.empty([h, w])
image = np.zeros_like(smaller)
cv2.fillPoly(image, [cnt], 255)
lines = cv2.HoughLinesP(image, 1, math.pi/90, 2, None, 30, 1);
结果
OpenCV Error: Assertion failed (image.type() == CV_8UC1) in HoughLinesProbabilistic, file /tmp/opencv320150728-16719-neh6hn/opencv-3.0.0/modules/imgproc/src/hough.cpp, line 424