可以使用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)
用CV_IMAGE_ELEM(src,uchar,y,x)