OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor

asked 2017-04-11 11:52:55 -0600

jsmao gravatar image

My image datasets are all gray images,they all only have one channel,not three channels. I use SSD to do training and testing on my datasets with caffe. and I have one problem ,for example:

OpenCV Error: Assertion failed ((scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F)) in cvtColor, file /home/dell1714/NVIDIA/opencv/opencv-3.0.0/modules/imgproc/src/color.cpp, line 7946 terminate called after throwing an instance of 'cv::Exception'

what(): /home/dell1714/NVIDIA/opencv/opencv-3.0.0/modules/imgproc/src/color.cpp:7946: error: (-215) (scn == 3 || scn == 4) && (depth == CV_8U || depth == CV_32F) in function cvtColor

so how to solve this opencv problem,thanks a lot!

edit retag flag offensive close merge delete

Comments

could you please provide code? are you sure that file that you try to open exists? try to show it using opencv and see what happens

electron gravatar imageelectron ( 2017-04-26 11:02:41 -0600 )edit