1.取出图片中坐标(i,j)处的像数值
unsigned char getValue(IplImage* img, int x,int y,int channels)
{
if( (x > (img->height -1))|| (x<0) )
return 0;
if( (y > (img->width -1))|| (y<0) )
return 0;
if(channels > (img->nChannels) )
return 0;
if(NULL != img->imageData)
{
return img->imageData[x * img->widthStep + y*img->nChannels + (channels - 1)];
}
}