I have used openCV python and encountered an error.
img_blur = cv2.medianBlur(self.cropped_img,5) img_thresh_Gaussian = cv2.adaptiveThreshold(img_blur, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2) plt.subplot(1,1,1),plt.imshow(img_thresh_Gaussian, cmap = 'gray') plt.title("Image"), plt.xticks([]), plt.yticks([]) plt.show()
but I received:
cv2.error: /home/phuong/opencv_src/opencv/modules/imgproc/src/thresh.cpp:1280: error: (-215) src.type() == CV_8UC1 in function adaptiveThreshold
Do I have to install something else?
you should load your file like this
src.create(rows, cols, CV_8UC1); src = imread(your-file, CV_8UC1);
and after that
adaptiveThreshold(src, dst, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, 75, 10);
2.1m questions
2.1m answers
60 comments
56.9k users