Re: [hugin-ptx] High-Quality Computational Imaging Through Simple Lenses

264 views
Skip to first unread message

Carlos Eduardo G. Carvalho (Cartola)

unread,
Oct 1, 2013, 9:24:14 AM10/1/13
to hugi...@googlegroups.com
Looks nice. It seams like a sharp function that doesn't add noise.

Don't know if can be used into hugin, but if GIMP has a filter like this it already would help me.

Thanks,



2013/9/30 kevin <ke...@bluelavalamp.net>
Would this be something that would be useful for hugin to have built into it? 

http://www.cs.ubc.ca/labs/imager/tr/2013/SimpleLensImaging/index.html



--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/f374f60f-d243-41b7-80d1-b610ab7c8487%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Carlos Eduardo G. Carvalho (Cartola)

unread,
Oct 1, 2013, 9:39:34 AM10/1/13
to hugi...@googlegroups.com
Did someone take a look at the code? What are those *.m files? Matlab scripts?

Thanks,
2013/10/1 Carlos Eduardo G. Carvalho (Cartola) <cart...@gmail.com>

Frederic Da Vitoria

unread,
Oct 1, 2013, 9:48:18 AM10/1/13
to hugin-ptx
I had the same question and I found references to matlab in many files.

2013/10/1 Carlos Eduardo G. Carvalho (Cartola) <cart...@gmail.com>

Did someone take a look at the code? What are those *.m files? Matlab scripts?

2013/10/1 Carlos Eduardo G. Carvalho (Cartola) <cart...@gmail.com>
Looks nice. It seams like a sharp function that doesn't add noise.

Don't know if can be used into hugin, but if GIMP has a filter like this it already would help me.

Thanks,



2013/9/30 kevin <ke...@bluelavalamp.net>
Would this be something that would be useful for hugin to have built into it? 

http://www.cs.ubc.ca/labs/imager/tr/2013/SimpleLensImaging/index.html

--
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org

Matthew Petroff

unread,
Oct 1, 2013, 12:56:41 PM10/1/13
to hugi...@googlegroups.com
It ran fine for me in MATLAB R2010a, taking about 20 minutes to process a 384 x 288 pixel image. It's very computationally intensive. I also tried running it in GNU Octave, but it didn't work since Octave is missing the edgetaper function, among others.

-Matthew

Carlos Eduardo G. Carvalho (Cartola)

unread,
Oct 1, 2013, 1:11:49 PM10/1/13
to hugi...@googlegroups.com

2013/10/1 Matthew Petroff <mat...@mpetroff.net>

It ran fine for me in MATLAB R2010a, taking about 20 minutes to process a 384 x 288 pixel image. It's very computationally intensive. I also tried running it in GNU Octave, but it didn't work since Octave is missing the edgetaper function, among others.

-Matthew

Good to have some feedback. As I don't have Matlab and Octave already didn't work, do you think converting to Python could work? I found a couple of converters, but I am still downloading them.

Lukas Jirkovsky

unread,
Oct 1, 2013, 1:19:54 PM10/1/13
to hugi...@googlegroups.com
On Tue, Oct 1, 2013 at 7:11 PM, Carlos Eduardo G. Carvalho (Cartola)
<cart...@gmail.com> wrote:
> Good to have some feedback. As I don't have Matlab and Octave already didn't
> work, do you think converting to Python could work? I found a couple of
> converters, but I am still downloading them.

Even if it worked, it would be likely much slower than the Matlab
version, because Matlab provides many highly optimized functions while
Python has little to no optimizations (maybe pypy would be better).

Lukas

Carlos Eduardo G. Carvalho (Cartola)

unread,
Oct 1, 2013, 1:26:13 PM10/1/13
to hugi...@googlegroups.com
Ok, but I just wanted to try, despite of the time it could take. Just sharing opinions, cause if someone says that there is only 1% of chance that it will work, then I can give up earlier and save some time. :)

Thanks,
2013/10/1 Lukas Jirkovsky <l.jir...@gmail.com>
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+...@googlegroups.com.

Matthew Petroff

unread,
Oct 1, 2013, 5:57:04 PM10/1/13
to hugi...@googlegroups.com
I don't think any converters will work due to the use of functions from the Image Processing Toolbox. I think the easiest way to run it without MATLAB is to write a edgetaper function for GNU Octave, which isn't exactly the easiest thing to do.

-Matthew

Terry Duell

unread,
Oct 1, 2013, 6:58:57 PM10/1/13
to hugi...@googlegroups.com
Hello All,

On Mon, 30 Sep 2013 19:53:08 +1000, kevin <ke...@bluelavalamp.net> wrote:

> Would this be something that would be useful for hugin to have built into
> it?
>
> http://www.cs.ubc.ca/labs/imager/tr/2013/SimpleLensImaging/index.html
>

I have spent a Lot of time investigating many deblur methods, and most are
average at best.
Some are quite good, or seem to be, until you place your deblurred image
in amongst other sharp images in a pano, and that is when you really see
how much better the deblur needs to be.
I have yet to look at this method, but if it relies on finding a blur
kernel, or point spread function, that is uniform for the whole image, it
is probably not going to give good results for all cases.
When I have tested the code I may change my mind.
I have a set of overlapping images, provided by John Gooch, that include a
blurred image, and I have used this set as my fundamental test for any
deblur code. Anyone who would like to test deblur code with these images
should contact me off list.

Cheers,
--
Regards,
Terry Duell

Carlos Eduardo G. Carvalho (Cartola)

unread,
Oct 1, 2013, 7:06:47 PM10/1/13
to hugi...@googlegroups.com
Well, I have ginven up trying to test this software. Tried two matlab 2 python converters, but don't think it is an easy task and I don't have the skill to pass through the problems that will appear.

If someone, someday, have an alternative good deblur, please announce here :)

Thanks,
2013/10/1 Terry Duell <tdu...@iinet.net.au>
--
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
---You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.

To unsubscribe from this group and stop receiving emails from it, send an email to hugin-ptx+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/op.w4assjcsrs0ygh%40localhost.

Matthew Petroff

unread,
Oct 1, 2013, 7:41:06 PM10/1/13
to hugi...@googlegroups.com
Terry,

I read the paper, and I don't think you'll be able to use your existing images. The technique is based on first calibrating a lens to find spatially varying point spread functions via a patch-based method and then using the known blur kernel to correct subsequent images. Without properly calibrated point spread functions, it won't work, and none of the downloads provide their calibration target or code to generate the point spread functions. It also only corrects for blurs inherent in the lens optics, not motion blurs.

-Matthew

Terry Duell

unread,
Oct 1, 2013, 7:51:38 PM10/1/13
to hugi...@googlegroups.com
Hello Matthew,

On Wed, 02 Oct 2013 09:41:06 +1000, Matthew Petroff <mat...@mpetroff.net>
wrote:

> Terry,
>
> I read the paper, and I don't think you'll be able to use your existing
> images. The technique is based on first calibrating a lens to find
> spatially varying point spread functions via a patch-based method and
> then
> using the known blur kernel to correct subsequent images. Without
> properly
> calibrated point spread functions, it won't work, and none of the
> downloads
> provide their calibration target or code to generate the point spread
> functions. It also only corrects for blurs inherent in the lens optics,
> not
> motion blurs.

Thanks for that info.
I have downloaded the paper and the code, and was about to read the paper.
You have saved me the trouble. My interest is motion blur.

paul womack

unread,
Oct 2, 2013, 5:34:56 AM10/2/13
to hugi...@googlegroups.com
Matthew Petroff wrote:
> Terry,
>
> I read the paper, and I don't think you'll be able to use your existing images. The technique is based on first calibrating a lens to find spatially varying point spread functions via a patch-based method and then using the known blur kernel to correct subsequent images. Without properly calibrated point spread functions, it won't work, and none of the downloads provide their calibration target or code to generate the point spread functions. It also only corrects for blurs inherent in the lens
> optics, not motion blurs.

Yes; I think it's intended as a contributing part of lens design.

SInce all lens design involves compromises between various abberations,
if some abberations can be post-removed in software, these abberations
can be given less weight in the lens design process.

BugBear

Terry Duell

unread,
Oct 3, 2013, 7:16:32 PM10/3/13
to hugi...@googlegroups.com
Hello Matthew,

On Wed, 02 Oct 2013 09:41:06 +1000, Matthew Petroff <mat...@mpetroff.net>
wrote:

> Terry,
>
> I read the paper, and I don't think you'll be able to use your existing
> images. The technique is based on first calibrating a lens to find
> spatially varying point spread functions via a patch-based method and
> then
> using the known blur kernel to correct subsequent images. Without
> properly
> calibrated point spread functions, it won't work, and none of the
> downloads
> provide their calibration target or code to generate the point spread
> functions. It also only corrects for blurs inherent in the lens optics,
> not motion blurs.
>

I have a bit more of a think about this, and I am inclined to think that
the method may be applicable to the correction of any image, if one can
estimate the PSF.
If I understand it correctly, their approach is to derive, by test, a PSF
for the lens, then apply that PSF to correcting the image .
If one has other methods of deriving the PSF from the subject image (or
from a sharp and blurred pair as might be the case for pano work) then one
could use their method to apply that PSF to correcting the image.
A look in the "kernels" directory of the code package shows a kernel
"motion_blur.png" and some others that have the characteristics of motion
blur.
The above is a tad academic right now as the only means I have of testing
this is to use the code package with Octave.
As you have said, some of the Matlab functions that are used are not
available for Octave, and I'm not sure how I will go getting over that
hurdle.

Matthew Petroff

unread,
Oct 4, 2013, 10:48:50 AM10/4/13
to hugi...@googlegroups.com
Terry,

I modified the MATLAB script to only run their algorithm and use the provided motion blur blur kernel on a full size image. Here are the results when run on an 18MP photo I had:

Original:
http://i.imgur.com/rRwaKbc.jpg

Blurred:
http://i.imgur.com/NyGg6JN.jpg

Deconvoluted:
http://i.imgur.com/fCeOTGy.jpg

The script takes the original image, applies the blur kernel, adds Gaussian noise to both the blurred image and the blur kernel, and then runs the deconvolution. It took an hour and a half, maxing out all four cores of my 4.2GHz Ivy Bridge processor. If you have any images you want me to test, I'd be happy to do so. We just need a good way to estimate an image's blur kernel.

-Matthew

Terry Duell

unread,
Oct 4, 2013, 7:00:53 PM10/4/13
to hugi...@googlegroups.com
Hello Matthew,

On Sat, 05 Oct 2013 00:48:50 +1000, Matthew Petroff <mat...@mpetroff.net>
wrote:

> Terry,
>
> I modified the MATLAB script to only run their algorithm and use the
> provided motion blur blur kernel on a full size image. Here are the
> results
> when run on an 18MP photo I had:
>
> Original:
> http://i.imgur.com/rRwaKbc.jpg
>
> Blurred:
> http://i.imgur.com/NyGg6JN.jpg
>
> Deconvoluted:
> http://i.imgur.com/fCeOTGy.jpg

The results look quite good.
Almost all the examples I have seen of non-blind deconvolution, where the
example image is blurred by a given kernel and then de-blurred using that
kernel, come out looking good.

>
> The script takes the original image, applies the blur kernel, adds
> Gaussian noise to both the blurred image and the blur kernel, and then
> runs the
> deconvolution. It took an hour and a half, maxing out all four cores of
> my 4.2GHz Ivy Bridge processor.

I'm not surprised, that is a big image and it is quite an intensive
process.


> If you have any images you want me to test,
> I'd be happy to do so. We just need a good way to estimate an image's
> blur kernel.

This is the difficult bit. I have worked with a few different approaches
to estimating the blur kernel. It has been a while now since I was deeply
engrossed in this stuff, so I'll have to have a look back in my archives
and refresh my memory a tad.
Give me bit of time, and I'll see if I can get a reasonable kernel for my
test image.
Reply all
Reply to author
Forward
0 new messages