OndroNR / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Bicubic resize kernel is badly implemented #181

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Resize an image on photoshop
2. Resize the same image using aforge
3. Compare

What is the expected output? What do you see instead?
The images should be very similar but the aforge version is softer

What version of the product are you using?

Please provide any additional information below.
The problem lies in the kernel matrix.
I made a test application. Cleared the old implementation and did the following 
one from scratch based on Wikipedia definition. "a" factor set to -0.5. This 
code is not optimized.

double mx = x;
if(mx <0)
    mx=-mx;
if ( mx > 2.0 )
        return 0.0;
if(mx<=1)
{
        return 1.5*mx*mx*mx - 2.5*mx*mx+1;
}
else
{
    return -0.5*mx*mx*mx + 2.5*mx*mx - 4*mx + 2;
}

Image became much sharper than previously and comparable to Photoshop.

Original issue reported on code.google.com by mikemelg...@gmail.com on 7 Jan 2011 at 3:27

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 8 Jan 2011 at 10:41

GoogleCodeExporter commented 9 years ago
Changing bicubic kernel for resize and rotation image processing routines to 
the one described on Wikipedia (coefficient "a" is set to -0.5).

Committed in revision 1369. Will be released in version 2.1.5.

Original comment by andrew.k...@gmail.com on 8 Jan 2011 at 10:52

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 10 Jan 2011 at 10:39

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 12 Jan 2011 at 11:46