I want to get the most significant bit of a Grey image, but when I try to run this script, it just gives me a depth error: 'const class cv::_InputArray &,const class cv::_OutputArray &,int)'
Unsupported depth of input image: 'VDepth::contains(depth)' where 'depth' is 6 (CV_64F)'
I have other college colleges that can run this script just fine, but I am unable to. . .
import cv2
import numpy as np
img = cv2.imread("lenac.tif")
x_img_g = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
y = x_img_g > 128
cv2.imshow("BW", y*1.0)
Traceback (most recent call last): File "C:\ISEL\2018-2019\Semestre_Verao\CSM\TP1\teste.py", line 9, in <module>
cv2.imshow("BW", y*1.0)
cv2.error: OpenCV(4.0.0) c:\projects\opencv-python\opencv\modules\imgproc\src\color.hpp:261: error: (-2:Unspecified error) in function '__cdecl cv::CvtHelper<struct cv::Set<1,-1,-1>,struct cv::Set<3,4,-1>,struct cv::Set<0,2,5>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)' > Unsupported depth of input image: > 'VDepth::contains(depth)' > where > 'depth' is 6 (CV_64F)
cv2.cvtColor, correct? (In future, please attach complete backtrace) | What's thedtypeofimg? - Dan Mašek