读取图像的像素值

时间:2015-01-15 11:37:43

标签: opencv

如何在c ++中的open cv中读取灰度CV_8U图像的像素值? 我试过这段代码:

srcimg=imread("/home/bindu/gesture recognition/processed image/paddedimage/P1/G8/6.jpg");

cvtColor(srcimg, img, CV_BGR2GRAY);
cout<<grayimg.depth();
cout<<grayimg.channels();
imshow("image",srcimg);
for(i=0;i<img.rows;i++)
{
  for(j=0;j<img.cols;j++)
  {
   cout<<" "<<img.at<uchar>(Point(i,j));
  }
}

0 个答案:

没有答案