OpenCV 格式字符串

opencv format string

本文关键字:字符串 格式 OpenCV      更新时间:2023-10-16

请帮助我有这段代码,我想添加到这个 x 和 y 位置

cv::Rect r = some thing;
std::cout << cv::format("%d, %s (%dx%d)n", i+1, outfile.c_str(), r.width, r.height);

如何像这样添加 x 和 y我试试这个,但它没有用

std::cout << cv::format("%d, %s (%dx%d)n", i+1, outfile.c_str(), r.width, r.height, r.x, r.y);

我试过它不起作用

但是当我添加 r.x 和 r.y 并替换为 r,高度和 r.width 时,它的工作,但我想要高度和宽度以及 x 和 y

      std::cout << cv::format("%d, %s (%dx%d)n", i+1, outfile.c_str(), r.x, r.y);

添加更多格式说明符(每个项目一个(:

std::cout << cv::format("%d, %s (%dx%d)(%d %d)n", i+1, outfile.c_str(), r.width, r.height, r.x, r.y);