namedWindow("output", CV_WINDOW_AUTOSIZE);
cvtColor(src,dst,CV_BGR2GRAY);
printf("output channels: %d\n",src.channels());//输出图像通道数
//输出像素值
int cols = src.cols;
int rows = src.rows;
const uchar* firstrow = dst.ptr<uchar>(0);//输出指定像素值
printf("first pixels value :%d ",*firstrow);
printf("cols:%d",cols);
cvtColor(src,dst,CV_BGR2GRAY);
printf("output channels: %d\n",src.channels());//输出图像通道数
//输出像素值
int cols = src.cols;
int rows = src.rows;
const uchar* firstrow = dst.ptr<uchar>(0);//输出指定像素值
printf("first pixels value :%d ",*firstrow);
printf("cols:%d",cols);
printf("rows:%d",rows);
如有错误请批评指正