opencv,访问灰度图像的像素
【代码】opencv,访问灰度图像的像素。
·
Mat cur_img = imread(ph, IMREAD_GRAYSCALE);
cout << cur_img.cols << " " << cur_img.rows;
for (int i = 0; i < picture_height; i++) {
uchar* data = cur_img.ptr<uchar>(i); //获取第i行的首地址
for (int j = 0; j < picture_width; j++) {
int res = data[j];
cout << "cur_data=" << res <<endl;
}
}
更多推荐
所有评论(0)