| 87 | |
| 88 | |
| 89 | void ResizeFrame(const cv::Mat& frame, cv::Mat& dest, const common::Size& aspectRatio) |
| 90 | { |
| 91 | if(&dest != &frame) |
| 92 | { |
| 93 | double longEdgeInput = std::max(frame.rows, frame.cols); |
| 94 | double longEdgeOutput = std::max(aspectRatio.m_Width, aspectRatio.m_Height); |
| 95 | const double resizeFactor = longEdgeOutput/longEdgeInput; |
| 96 | cv::resize(frame, dest, cv::Size(0, 0), resizeFactor, resizeFactor, DefaultResizeFlag); |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | const std::string warningMessage{"Resize was not performed because resized frame references the source frame."}; |
| 101 | ARMNN_LOG(warning) << warningMessage; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /** Pad a frame with zeros (add rows and columns to the end) */ |
| 106 | void PadFrame(const cv::Mat& src, cv::Mat& dest, const int bottom, const int right) |