image reading error

asked 2017-03-26 14:37:14 -0500

error: ........\opencv\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor

Help me out.

edit retag flag offensive close merge delete

Comments

This is not a problem in image reading. You are calling cvtColor with a conversion type that expects 3 or 4 channel input, and the image you give it is not 3 or 4 channels.

Tetragramm gravatar imageTetragramm ( 2017-03-26 17:23:22 -0500 )edit

you are talking about RGBA channels is it? if images are storing into jpg format we will get only 3 channels, there were some different images into jpg i tried that to.., please give me some solution..

idealvijay gravatar imageidealvijay ( 2017-03-28 01:28:05 -0500 )edit

RGB would be 3, RGBA would be 4. Either should work Just after your imread(), call image.channels() to get the number of channels it has. If it's grayscale, you'll only have 1.

Tetragramm gravatar imageTetragramm ( 2017-03-28 17:19:23 -0500 )edit