resize() with high quality (Feature #3921)
Description
For me it is incredible that such a huge library like OpenCV with lots of mathematical functions is not able to do such a basic thing as resize an image with high quality.
The few options that the resize() function gives all result in low quality.
I can try Linear, Cubic or any other option but the quality is far from high quality.
On the other hand when I use the following C# code I get high quality.
Why does OpenCV not implement an algorithm with results like the following code?
Bitmap i_Bmp = new Bitmap(s32_NewWidth, s32_NewHeight, PixelFormat.Format24bppRgb);
Graphics i_Graph = Graphics.FromImage(i_Bmp);
// NOTE: The cv::resize() function in OpenCV has a very bad quality.
// Resizing must be done here in C#.
i_Graph.InterpolationMode = InterpolationMode. HighQualityBilinear;
i_Graph.CompositingMode = CompositingMode. SourceCopy;
i_Graph.CompositingQuality = CompositingQuality.HighQuality;
i_Graph.SmoothingMode = SmoothingMode. HighQuality;
i_Graph.PixelOffsetMode = PixelOffsetMode. HighQuality;
Rectangle r_Dest = new Rectangle(0, 0, s32_NewWidth, s32_NewHeight);
i_Graph.DrawImage(i_In.mi_Bitmap, r_Dest, r_Crop.X, r_Crop.Y, r_Crop.Width, r_Crop.Height, GraphicsUnit.Pixel);
Associated revisions
Merge pull request #3921 from sergarrido:master
History
Updated by Vladislav Vinogradov over 10 years ago
Hello Rubby,
From .NET documentation:
HighQualityBilinear | Specifies high-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking.
OpenCV resize
function performs only resize operation with interpolation, without any pre-filtering,
the function is oriented to be simple and fast.
You can add pre-filtering for source image before calling resize
.
- Status changed from New to Cancelled