Downscale image to max OpenGL texture
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user