MCPcopy Create free account
hub / github.com/cyrusbehr/tensorrt-cpp-api / resizeKeepAspectRatioPadRightBottom

Method resizeKeepAspectRatioPadRightBottom

src/engine.h:760–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758
759template <typename T>
760cv::cuda::GpuMat Engine<T>::resizeKeepAspectRatioPadRightBottom(const cv::cuda::GpuMat &input, size_t height, size_t width,
761 const cv::Scalar &bgcolor) {
762 float r = std::min(width / (input.cols * 1.0), height / (input.rows * 1.0));
763 int unpad_w = r * input.cols;
764 int unpad_h = r * input.rows;
765 cv::cuda::GpuMat re(unpad_h, unpad_w, CV_8UC3);
766 cv::cuda::resize(input, re, re.size());
767 cv::cuda::GpuMat out(height, width, CV_8UC3, bgcolor);
768 re.copyTo(out(cv::Rect(0, 0, re.cols, re.rows)));
769 return out;
770}
771
772template <typename T>
773void Engine<T>::transformOutput(std::vector<std::vector<std::vector<T>>> &input, std::vector<std::vector<T>> &output) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected