gpt4 book ai didi

python - 如何在 OpenCV 中获取图像的宽度和高度?

转载 作者:IT老高 更新时间:2023-10-28 12:33:58 29 4
gpt4 key购买 nike

我想获取图像的宽度和高度,我该如何在 OpenCV 中做到这一点?

例如:

Mat src = imread("path_to_image");
cout << src.width;

是吗?

最佳答案

你可以使用rowscols:

cout << "Width : " << src.cols << endl;
cout << "Height: " << src.rows << endl;

size():

cout << "Width : " << src.size().width << endl;
cout << "Height: " << src.size().height << endl;

大小

cout << "Width : " << src.size[1] << endl;
cout << "Height: " << src.size[0] << endl;

关于python - 如何在 OpenCV 中获取图像的宽度和高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32971241/

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