i have needs to resize dhw rgb image, conversions not allowed (slow), i want to just resize with proper proportions, i just started that and asking if anyone here already know best algo for that
cv::Mat YoloV8::resizeRawImage(MainDataUnit unit)
{
const auto& inputDims = m_trtEngine->getInputDims();
cv::Mat mat(inputDims[0].d[1],inputDims[0].d[2],CV_8UC3); // dimension values unrelated, just for right allocated size
assert(unit.params->layout == eDepth_Height_Width);
assert(unit.params->type == eDataUnitType::eRGBImage);
if (unit.params->height != inputDims[0].d[1] || unit.params->width != inputDims[0].d[2]) {
// resize unit.data8 to mat
}
m_imgHeight = mat.rows;
m_imgWidth = mat.cols;
m_ratio = 1.f / std::min(inputDims[0].d[2] / static_cast<float>(mat.cols), inputDims[0].d[1] / static_cast<float>(mat.rows));
return mat;
}