假设有,
Mat img = imread("../1.png", 0);
int v = 800, u = 500;
要获得图像img在 ( u , v ) (u,v) (u,v)处的灰度值,我之前是这样做,
uchar a = img.at<uchar>(v, u);
最近发现也可以这样写,
uchar b = img.ptr<uchar>(v)[u];
假设有,
Mat img = imread("../1.png", 0);
int v = 800, u = 500;
要获得图像img在 ( u , v ) (u,v) (u,v)处的灰度值,我之前是这样做,
uchar a = img.at<uchar>(v, u);
最近发现也可以这样写,
uchar b = img.ptr<uchar>(v)[u];