Patch: fix automatic correction of lens chromatic aberration

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch: fix automatic correction of lens chromatic aberration

Matthias Welwarsky
Hello,

the attached patch fixes CA correction in the lens auto-correction tool. The fix
consists of two parts:
1.) set Alpha component of corrected pixel to "fully opaque", otherwise
corrected image is not visible (trivial)
2.) Implement sub-pixel interpolation in class DImg, necessary for CA and CI
correction with lensfun.
There are two new pixel color accessor functions: getSubPixelColor() and
getSubPixelColorFast(). The first one uses Lanczos interpolation to compute
subpixel colors, the second one bilinear interpolation. Lanczos yields better
results, but is a lot slower than bilinear. Before using getSubPixelColor(),
prepareSubPixelAccess() needs to be called to precompute the Lanczos kernel.

Lanczos implementation was adapted from ufraw, Bilinear was implemented
according to Wikipedia description.

I would be happy to hear comments on how to optimize the computation, it's
probably not optimal yet.

regards,
        matthias

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

lenscorrection-ca-fix.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Gilles Caulier-4
Matthias,

Thanks a lots. this patch solve a task from my TODO list.

This patch is a good candidate to go to 0.11 development branch and, if it doesn't break i18n, in 0.10 (trunk) before finale release.

Marcel, Andi, can you check this patch for me and guide Matthias on the right way. I'm very busy here to prepare my evening classes presentation for next Wednesday. To test, just use these pictures :

http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/

Thanks in advance.

Gilles Caulier

2009/3/8 Matthias Welwarsky <[hidden email]>
Hello,

the attached patch fixes CA correction in the lens auto-correction tool. The fix
consists of two parts:
1.) set Alpha component of corrected pixel to "fully opaque", otherwise
corrected image is not visible (trivial)
2.) Implement sub-pixel interpolation in class DImg, necessary for CA and CI
correction with lensfun.
There are two new pixel color accessor functions: getSubPixelColor() and
getSubPixelColorFast(). The first one uses Lanczos interpolation to compute
subpixel colors, the second one bilinear interpolation. Lanczos yields better
results, but is a lot slower than bilinear. Before using getSubPixelColor(),
prepareSubPixelAccess() needs to be called to precompute the Lanczos kernel.

Lanczos implementation was adapted from ufraw, Bilinear was implemented
according to Wikipedia description.

I would be happy to hear comments on how to optimize the computation, it's
probably not optimal yet.

regards,
       matthias

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel



_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Bugzilla from andi.clemens@gmx.net
I will take a look it the patch now...

Andi

On Sunday 08 March 2009 19:51:12 Gilles Caulier wrote:

> Matthias,
>
> Thanks a lots. this patch solve a task from my TODO list.
>
> This patch is a good candidate to go to 0.11 development branch and, if it
> doesn't break i18n, in 0.10 (trunk) before finale release.
>
> Marcel, Andi, can you check this patch for me and guide Matthias on the
> right way. I'm very busy here to prepare my evening classes presentation
> for next Wednesday. To test, just use these pictures :
>
> http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/
>
> Thanks in advance.
>
> Gilles Caulier
>
> 2009/3/8 Matthias Welwarsky <[hidden email]>
>
> > Hello,
> >
> > the attached patch fixes CA correction in the lens auto-correction tool.
> > The fix
> > consists of two parts:
> > 1.) set Alpha component of corrected pixel to "fully opaque", otherwise
> > corrected image is not visible (trivial)
> > 2.) Implement sub-pixel interpolation in class DImg, necessary for CA and
> > CI
> > correction with lensfun.
> > There are two new pixel color accessor functions: getSubPixelColor() and
> > getSubPixelColorFast(). The first one uses Lanczos interpolation to
> > compute subpixel colors, the second one bilinear interpolation. Lanczos
> > yields better
> > results, but is a lot slower than bilinear. Before using
> > getSubPixelColor(),
> > prepareSubPixelAccess() needs to be called to precompute the Lanczos
> > kernel.
> >
> > Lanczos implementation was adapted from ufraw, Bilinear was implemented
> > according to Wikipedia description.
> >
> > I would be happy to hear comments on how to optimize the computation,
> > it's probably not optimal yet.
> >
> > regards,
> >         matthias
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > [hidden email]
> > https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Matthias Welwarsky
On Monday 09 March 2009 11:30:27 Andi Clemens wrote:
> I will take a look it the patch now...

I've taken another look into it, seems its not complete yet. Geometry and
distortion correction also need subpixel access, and I've found that it
doesn't work any more if I check "16 bits color depth" in the "Raw Conversion"
settings.

>
> Andi
>
> On Sunday 08 March 2009 19:51:12 Gilles Caulier wrote:
> > Matthias,
> >
> > Thanks a lots. this patch solve a task from my TODO list.
> >
> > This patch is a good candidate to go to 0.11 development branch and, if
> > it doesn't break i18n, in 0.10 (trunk) before finale release.
> >
> > Marcel, Andi, can you check this patch for me and guide Matthias on the
> > right way. I'm very busy here to prepare my evening classes presentation
> > for next Wednesday. To test, just use these pictures :
> >
> > http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/
> >
> > Thanks in advance.
> >
> > Gilles Caulier
> >
> > 2009/3/8 Matthias Welwarsky <[hidden email]>
> >
> > > Hello,
> > >
> > > the attached patch fixes CA correction in the lens auto-correction
> > > tool. The fix
> > > consists of two parts:
> > > 1.) set Alpha component of corrected pixel to "fully opaque", otherwise
> > > corrected image is not visible (trivial)
> > > 2.) Implement sub-pixel interpolation in class DImg, necessary for CA
> > > and CI
> > > correction with lensfun.
> > > There are two new pixel color accessor functions: getSubPixelColor()
> > > and getSubPixelColorFast(). The first one uses Lanczos interpolation to
> > > compute subpixel colors, the second one bilinear interpolation. Lanczos
> > > yields better
> > > results, but is a lot slower than bilinear. Before using
> > > getSubPixelColor(),
> > > prepareSubPixelAccess() needs to be called to precompute the Lanczos
> > > kernel.
> > >
> > > Lanczos implementation was adapted from ufraw, Bilinear was implemented
> > > according to Wikipedia description.
> > >
> > > I would be happy to hear comments on how to optimize the computation,
> > > it's probably not optimal yet.
> > >
> > > regards,
> > >         matthias
> > >
> > > _______________________________________________
> > > Digikam-devel mailing list
> > > [hidden email]
> > > https://mail.kde.org/mailman/listinfo/digikam-devel
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Bugzilla from andi.clemens@gmx.net
Ok so I'll wait for another update...

Andi

On Tuesday 10 March 2009 08:56:48 Matthias Welwarsky wrote:

> On Monday 09 March 2009 11:30:27 Andi Clemens wrote:
> > I will take a look it the patch now...
>
> I've taken another look into it, seems its not complete yet. Geometry and
> distortion correction also need subpixel access, and I've found that it
> doesn't work any more if I check "16 bits color depth" in the "Raw
> Conversion" settings.
>
> > Andi
> >
> > On Sunday 08 March 2009 19:51:12 Gilles Caulier wrote:
> > > Matthias,
> > >
> > > Thanks a lots. this patch solve a task from my TODO list.
> > >
> > > This patch is a good candidate to go to 0.11 development branch and, if
> > > it doesn't break i18n, in 0.10 (trunk) before finale release.
> > >
> > > Marcel, Andi, can you check this patch for me and guide Matthias on the
> > > right way. I'm very busy here to prepare my evening classes
> > > presentation for next Wednesday. To test, just use these pictures :
> > >
> > > http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/
> > >
> > > Thanks in advance.
> > >
> > > Gilles Caulier
> > >
> > > 2009/3/8 Matthias Welwarsky <[hidden email]>
> > >
> > > > Hello,
> > > >
> > > > the attached patch fixes CA correction in the lens auto-correction
> > > > tool. The fix
> > > > consists of two parts:
> > > > 1.) set Alpha component of corrected pixel to "fully opaque",
> > > > otherwise corrected image is not visible (trivial)
> > > > 2.) Implement sub-pixel interpolation in class DImg, necessary for CA
> > > > and CI
> > > > correction with lensfun.
> > > > There are two new pixel color accessor functions: getSubPixelColor()
> > > > and getSubPixelColorFast(). The first one uses Lanczos interpolation
> > > > to compute subpixel colors, the second one bilinear interpolation.
> > > > Lanczos yields better
> > > > results, but is a lot slower than bilinear. Before using
> > > > getSubPixelColor(),
> > > > prepareSubPixelAccess() needs to be called to precompute the Lanczos
> > > > kernel.
> > > >
> > > > Lanczos implementation was adapted from ufraw, Bilinear was
> > > > implemented according to Wikipedia description.
> > > >
> > > > I would be happy to hear comments on how to optimize the computation,
> > > > it's probably not optimal yet.
> > > >
> > > > regards,
> > > >         matthias
> > > >
> > > > _______________________________________________
> > > > Digikam-devel mailing list
> > > > [hidden email]
> > > > https://mail.kde.org/mailman/listinfo/digikam-devel
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > [hidden email]
> > https://mail.kde.org/mailman/listinfo/digikam-devel
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Matthias Welwarsky
On Tuesday 10 March 2009 09:14:43 Andi Clemens wrote:
> Ok so I'll wait for another update...

I think I've fixed it, but no time to test. Will post an update tonight.

>
> Andi
>
> On Tuesday 10 March 2009 08:56:48 Matthias Welwarsky wrote:
> > On Monday 09 March 2009 11:30:27 Andi Clemens wrote:
> > > I will take a look it the patch now...
> >
> > I've taken another look into it, seems its not complete yet. Geometry and
> > distortion correction also need subpixel access, and I've found that it
> > doesn't work any more if I check "16 bits color depth" in the "Raw
> > Conversion" settings.
> >
> > > Andi
> > >
> > > On Sunday 08 March 2009 19:51:12 Gilles Caulier wrote:
> > > > Matthias,
> > > >
> > > > Thanks a lots. this patch solve a task from my TODO list.
> > > >
> > > > This patch is a good candidate to go to 0.11 development branch and,
> > > > if it doesn't break i18n, in 0.10 (trunk) before finale release.
> > > >
> > > > Marcel, Andi, can you check this patch for me and guide Matthias on
> > > > the right way. I'm very busy here to prepare my evening classes
> > > > presentation for next Wednesday. To test, just use these pictures :
> > > >
> > > > http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/
> > > >
> > > > Thanks in advance.
> > > >
> > > > Gilles Caulier
> > > >
> > > > 2009/3/8 Matthias Welwarsky <[hidden email]>
> > > >
> > > > > Hello,
> > > > >
> > > > > the attached patch fixes CA correction in the lens auto-correction
> > > > > tool. The fix
> > > > > consists of two parts:
> > > > > 1.) set Alpha component of corrected pixel to "fully opaque",
> > > > > otherwise corrected image is not visible (trivial)
> > > > > 2.) Implement sub-pixel interpolation in class DImg, necessary for
> > > > > CA and CI
> > > > > correction with lensfun.
> > > > > There are two new pixel color accessor functions:
> > > > > getSubPixelColor() and getSubPixelColorFast(). The first one uses
> > > > > Lanczos interpolation to compute subpixel colors, the second one
> > > > > bilinear interpolation. Lanczos yields better
> > > > > results, but is a lot slower than bilinear. Before using
> > > > > getSubPixelColor(),
> > > > > prepareSubPixelAccess() needs to be called to precompute the
> > > > > Lanczos kernel.
> > > > >
> > > > > Lanczos implementation was adapted from ufraw, Bilinear was
> > > > > implemented according to Wikipedia description.
> > > > >
> > > > > I would be happy to hear comments on how to optimize the
> > > > > computation, it's probably not optimal yet.
> > > > >
> > > > > regards,
> > > > >         matthias
> > > > >
> > > > > _______________________________________________
> > > > > Digikam-devel mailing list
> > > > > [hidden email]
> > > > > https://mail.kde.org/mailman/listinfo/digikam-devel
> > >
> > > _______________________________________________
> > > Digikam-devel mailing list
> > > [hidden email]
> > > https://mail.kde.org/mailman/listinfo/digikam-devel
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > [hidden email]
> > https://mail.kde.org/mailman/listinfo/digikam-devel
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Gilles Caulier-4
Matthias, Andi,

It will be better to use bugzilla and post new entry with patch than mailing list. Look here :

https://bugs.kde.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=digikamimageplugins&component=Lens+Distortion

Gilles

2009/3/10 Matthias Welwarsky <[hidden email]>
On Tuesday 10 March 2009 09:14:43 Andi Clemens wrote:
> Ok so I'll wait for another update...

I think I've fixed it, but no time to test. Will post an update tonight.

>
> Andi
>
> On Tuesday 10 March 2009 08:56:48 Matthias Welwarsky wrote:
> > On Monday 09 March 2009 11:30:27 Andi Clemens wrote:
> > > I will take a look it the patch now...
> >
> > I've taken another look into it, seems its not complete yet. Geometry and
> > distortion correction also need subpixel access, and I've found that it
> > doesn't work any more if I check "16 bits color depth" in the "Raw
> > Conversion" settings.
> >
> > > Andi
> > >
> > > On Sunday 08 March 2009 19:51:12 Gilles Caulier wrote:
> > > > Matthias,
> > > >
> > > > Thanks a lots. this patch solve a task from my TODO list.
> > > >
> > > > This patch is a good candidate to go to 0.11 development branch and,
> > > > if it doesn't break i18n, in 0.10 (trunk) before finale release.
> > > >
> > > > Marcel, Andi, can you check this patch for me and guide Matthias on
> > > > the right way. I'm very busy here to prepare my evening classes
> > > > presentation for next Wednesday. To test, just use these pictures :
> > > >
> > > > http://digikam3rdparty.free.fr/TEST_IMAGES/LENSFUN/
> > > >
> > > > Thanks in advance.
> > > >
> > > > Gilles Caulier
> > > >
> > > > 2009/3/8 Matthias Welwarsky <[hidden email]>
> > > >
> > > > > Hello,
> > > > >
> > > > > the attached patch fixes CA correction in the lens auto-correction
> > > > > tool. The fix
> > > > > consists of two parts:
> > > > > 1.) set Alpha component of corrected pixel to "fully opaque",
> > > > > otherwise corrected image is not visible (trivial)
> > > > > 2.) Implement sub-pixel interpolation in class DImg, necessary for
> > > > > CA and CI
> > > > > correction with lensfun.
> > > > > There are two new pixel color accessor functions:
> > > > > getSubPixelColor() and getSubPixelColorFast(). The first one uses
> > > > > Lanczos interpolation to compute subpixel colors, the second one
> > > > > bilinear interpolation. Lanczos yields better
> > > > > results, but is a lot slower than bilinear. Before using
> > > > > getSubPixelColor(),
> > > > > prepareSubPixelAccess() needs to be called to precompute the
> > > > > Lanczos kernel.
> > > > >
> > > > > Lanczos implementation was adapted from ufraw, Bilinear was
> > > > > implemented according to Wikipedia description.
> > > > >
> > > > > I would be happy to hear comments on how to optimize the
> > > > > computation, it's probably not optimal yet.
> > > > >
> > > > > regards,
> > > > >         matthias
> > > > >
> > > > > _______________________________________________
> > > > > Digikam-devel mailing list
> > > > > [hidden email]
> > > > > https://mail.kde.org/mailman/listinfo/digikam-devel
> > >
> > > _______________________________________________
> > > Digikam-devel mailing list
> > > [hidden email]
> > > https://mail.kde.org/mailman/listinfo/digikam-devel
> >
> > _______________________________________________
> > Digikam-devel mailing list
> > [hidden email]
> > https://mail.kde.org/mailman/listinfo/digikam-devel
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Patch: fix automatic correction of lens chromatic aberration

Matthias Welwarsky
On Tuesday 10 March 2009 11:01:19 Gilles Caulier wrote:
> Matthias, Andi,
>
> It will be better to use bugzilla and post new entry with patch than
> mailing list.

https://bugs.kde.org/show_bug.cgi?id=186823

But I think it's not very efficient to communicate via bugzilla. It's a pain in
the neck to use. I'd actually perfer the mailing list.

The patch (attached for reference) corrects the 16bit problem in both Lanczos
and bilinear interpolation and also fixes a bug in the Lanczos implementation
that caused visible artifacts in distortion correction and false colors in CA
correction.

regards,
matthias


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

lenscorrection-ca-fix.patch (12K) Download Attachment