Getting error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/color.hpp:257 error
Hi, I tried to find the LBP on Hyperspectral Image after computing first 3 Principal Component Analysis. I am getting the following error.
error Traceback (most recent call last)
in ()
1 img_bgr=pcdata
----> 2 img_gray = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2GRAY)
error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/color.hpp:257: error: (-2:Unspecified error) in function 'cv::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::Set<3, 4>; VDcn = cv::Set<1>; VDepth = cv::Set<0, 2, 5>; cv::SizePolicy sizePolicy = (cv::SizePolicy)2u; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
Unsupported depth of input image:
'VDepth::contains(depth)'
where
'depth' is 6 (CV_64F)
this does not make any sense to me. why is it there ?
we probably need to see, what your pcadata is, and how it got derived.
at least, there's no PCA here
I tried the LBP code in Google colab. I applied it to Hyperspectral image which is of dimension 145x145x200. I reduced it to 3 principal component bands by applying PCA resulting in dimension 145x145x3 and stored it in pcdata numpy array. This is given below.
Copy lbp.py from https://github.com/arsho/local_binary... In img_gray = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2GRAY) line of main function I am getting the error.
link text
could you try to update your question with the code, so it is in context, and maybe we can try to reproduce it ?
also, please try to print out shapes / types after relevant operations
Comment box is not sufficient for pasting the code. How can I share the code in .ipynb format to you. I am new to this forum.
no, unfortunately you cannot share an .ipynb here, theres nothing to run it.
cvtColor(img_bgr,COLOR_BGR2GRAY);
with latest master you get the correct information:
i also doubt, that this is the correct way to apply LBP to your 3 component pca output.
Please find the code in this link. https://colab.research.google.com/dri...
Hi berak, I am not getting any error and able to execute by modifying the code as below
But how far the use of unsigned int is correct in PCA result I don't know. Can you check this.