Balti2016 / aforge

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

Bug in source file RotateBicubic.cs #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is a bug in the bicubic image rotation source code.

See these lines in the source file "RotateBiCubic.cs":

                            for ( int n = -1; n < 3; n++ )
                            {
                                // get Y cooefficient
                                k1 = Interpolation.BiCubicKernel( dy -
(float) n );
                                [...]

                                for ( int m = -1; m < 3; m++ )
                                {
                                    // get X cooefficient
                                    k2 = k1 * Interpolation.BiCubicKernel(
(float) m - dx );

The interpolation mechanism is the same along the two axis, so either k1 or
k2 is wrong. I suppose it's the latter, so the last line should be:

k2 = k1 * Interpolation.BiCubicKernel( dx - (float) m);

Original issue reported on code.google.com by briandam...@gmail.com on 4 Apr 2009 at 5:51

GoogleCodeExporter commented 9 years ago
I am not really sure it will affect result somehow. You will not see difference 
on 
the result image.

I believe the difference in calculating k1 and k2 is cause by the fact that in 
Cartesian coordinates system Y axis goes up (upper point has bigger Y value). 
But in 
images it is on the opposite - Y axis goes down.

Original comment by andrew.k...@gmail.com on 4 Apr 2009 at 6:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
> I am not really sure it will affect result somehow. You will not see 
difference on
> the result image.

The difference is not noticeable, but I was worried about whether it was 
logically
correct.

> I believe the difference in calculating k1 and k2 is cause by the fact that in
> Cartesian coordinates system Y axis goes up (upper point has bigger Y value).
> But in images it is on the opposite - Y axis goes down.

That can explain the difference, thanks for pointing this out! So it's not a bug
after all. I suppose I'm not the only one who will be confused by the 
difference, so
I suggest adding a comment to the source code, explaining the situation.

Thanks for the explanation, and I'm sorry about the disturbance I caused by 
raising
this issue.

Best regards

Brian

Original comment by briandam...@gmail.com on 6 Apr 2009 at 5:25

GoogleCodeExporter commented 9 years ago
Yes, you right. The comment in source code should help.

Actually there is no big difference in any case. It just depends on which 
image's 
corner is taken as (0, 0) point - start of coordinates system.

Original comment by andrew.k...@gmail.com on 6 Apr 2009 at 5:29

GoogleCodeExporter commented 9 years ago
The is closed after the above clarification.

Original comment by andrew.k...@gmail.com on 1 Jun 2009 at 10:34