resize() with high quality (Feature #3921)


Added by Robby Longhorn over 10 years ago. Updated over 10 years ago.


Status:Cancelled Start date:2014-09-26
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Difficulty: Pull request:

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

Revision 60a51b82
Added by Vadim Pisarevsky almost 10 years ago

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

Also available in: Atom PDF