python - Failure to use adaptiveThreshold: CV_8UC1 in function adaptiveThreshold -


i have used opencv python , encountered 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 received:

cv2.error: /home/phuong/opencv_src/opencv/modules/imgproc/src/thresh.cpp:1280: error: (-215) src.type() == cv_8uc1 in function adaptivethreshold 

do have install else?

you should load file

src.create(rows, cols, cv_8uc1); src = imread(your-file, cv_8uc1); 

and after

adaptivethreshold(src, dst, 255, adaptive_thresh_gaussian_c, thresh_binary, 75, 10); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -