Mat mat = imread("baby.jpg"); Mat p = mat.col(20).row(20); uchar* ptr = (uchar*) p.data; int B = ptr[0]; int G = ptr[1]; int R = ptr[2]; cout<<"res:"<<B<<" "<<G<<" "<<R<<" "<<endl;