Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Check this code,

Mat src = imread("t1.jpg",1);
if(src.empty()){ 
 cout<<"Cannot load image....!"<<endl;
 return -1;
}

vector<Mat> spl;
split(src,spl);
imshow("spl1",spl[0]);//b
imshow("spl2",spl[1]);//g
imshow("spl3",spl[2]);//r

Important thing is check you are able to load image successfully using Mat::empty