gpt4 book ai didi

c++ - 打开CV : count pixel from the left edge of the image

转载 作者:行者123 更新时间:2023-11-28 03:35:57 24 4
gpt4 key购买 nike

我想知道如何制作一个循环来计算图像像素,从图像的左边缘开始计算像素

如何使用 C++ opencv 实现

最佳答案

您不需要自己构建循环,它已经为您完成了。

cv::Mat img = cv::imread("img.jpg");
std::cout << img.total() << std::endl;

第一行将您的图像加载到标准 C++ OpenCV 容器 Mat 中。第二行打印 Mat 的底层数组中的元素数,如果是图像,这等于该图像的像素总数。

如果这些结构对您来说是新的,您应该从阅读 these 开始教程。

关于c++ - 打开CV : count pixel from the left edge of the image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10863856/

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