OpenCV C ++缩放功能

问题描述 投票:0回答:2
I am using an IP Camera for Human Detection using OpenCV dnn and C++, I need to implement zoom functionality to detect humans from a distance over 10 meters, but I found, performing zoom in a live video using c++ doesn't exist(please correct me, if I am wrong)

我尝试了以下代码来缩放视频

cv::Mat src, dst, tmp;
        tmp = src;
        dst = tmp;
        pyrUp(tmp, dst, cv::Size(tmp.cols * 2, tmp.rows * 2));
        frame.image = dst;

But, Image Pyramids did not zoom my video.

Can you please help me with a zoom function to achieve my objective.
c++ opencv zoom cctv
2个回答
0
投票
软件缩放通常称为选择图像区域(ROI)。您必须选择一个合适的ROI矩形。

cv::Rect roi(x, y, w, h); cv::Mat dst = src(roi);


-1
投票
如果要在每个方向上将图像缩小2倍,则可以通过以下方式调用该函数://指定fx和fy,然后让函数计算目标图像尺寸。

resize(src, dst, Size(), 0.5, 0.5, interpolation);

© www.soinside.com 2019 - 2024. All rights reserved.