gpt4 book ai didi

c++ - 在 C++ (OpenCV) 中读取像素值

转载 作者:搜寻专家 更新时间:2023-10-31 00:45:37 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Pixel access in OpenCV 2.2

我想知道如何使用 Mat 类在 C++ 中读取像素值(整数/ float 格式)?

很多人都问过同样的问题,但没有具体可行的答案。

我有以下代码可以编译但没有给出正确的结果。

void Block(cv::Mat &image)
{
for(int row = 0; row < image.rows; ++row)
{

for (int col = 0; col < image.cols; ++col)
{
cout<<image.at<int>(row, col)<<endl ;

}
}

}

上面的代码打印垃圾值。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com