Downscale image to max OpenGL texture

This commit is contained in:
2023-02-10 09:11:38 +01:00
parent c47ecbedb8
commit 576df9c196
4 changed files with 20 additions and 3 deletions
+10
View File
@@ -410,3 +410,13 @@ void RawImage::scaleToUnit()
}
}
}
void RawImage::downscaleTo(uint32_t size)
{
if(size < width() || size < height())
{
double s = (double)size / std::max(width(), height());
cv::Size dsize(std::floor(width() * s), std::floor(height() * s));
cv::resize(m_img, m_img, dsize, 0, 0, cv::INTER_AREA);
}
}