天天看點

視覺SLAM十四講 第8章

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.5.3) /imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<1>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::<unnamed>::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 1

           

發現問題為,輸入的圖檔應為3通道,但被我将COLOR_GRAY2RGB錯寫成了COLOR_RGB2GRAY,生成了單通道的圖,導緻出現這個錯誤。

繼續閱讀