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