获得某点像素值
//获得某点像素值
int get_pixel(Mat & img, Point pt) {
int width = img.cols; //图片宽度
int height = img.rows; //图片宽度t;//图片高度
uchar* ptr = (uchar*) img.data + pt.y * width; //获得灰度值数据指针
int intensity = ptr[pt.x];
return intensity;
}
获得某点像素值
//获得某点像素值
int get_pixel(Mat & img, Point pt) {
int width = img.cols; //图片宽度
int height = img.rows; //图片宽度t;//图片高度
uchar* ptr = (uchar*) img.data + pt.y * width; //获得灰度值数据指针
int intensity = ptr[pt.x];
return intensity;
}