怎样输出OpenCV 中IplImage中imageData的像素值

2024-12-19 13:05:18
推荐回答(2个)
回答1:

可以使用opencv定义的宏来提取象素值
假设灰度图像image,存取其i行j列的象素可以这样:CV_IMAGE_ELEM(image, uchar, i, j)
如果是彩色图像就是
CV_IMAGE_ELEM(image, uchar, i, 3*j)
CV_IMAGE_ELEM(image, uchar, i, 3*j+1)
CV_IMAGE_ELEM(image, uchar, i, 3*j+2)

回答2:

用CV_IMAGE_ELEM(src,uchar,y,x)