Pages: [1] 2   Go Down

Author Topic: app for Mac OS X 10.6 for deconvolution  (Read 11469 times)

mjk

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
app for Mac OS X 10.6 for deconvolution
« on: July 11, 2011, 12:44:07 pm »

hi,
i'm new to these forums. I posted on photo.net an announcement of two mac apps, one is for decovolution using caron-algorithm and another for upscaling images preserving edges using neural-networks. Apps are free, tested on mac mini 8GB memory and widescreen display and an old macbook, the app window looks like fitting on different screen resolutions. Andrew Rodney pointed me kindly to LL-forums, as here have been discussions about deconvolution. The code is located http://www.mattikoskinenphoto.com/code sources will be available later, after commenting them more properly and cleaning the code.

have fun

-matti
Logged

Jeremy Roussak

  • Administrator
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 8961
    • site
Re: app for Mac OS X 10.6 for deconvolution
« Reply #1 on: July 11, 2011, 12:53:57 pm »

That's very kind of you. I'll certainly try them out and I'm sure there are people here, far more expert than I, who will be able to provide constructive comment.

Jeremy
Logged

kirkt

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 604
Re: app for Mac OS X 10.6 for deconvolution
« Reply #2 on: July 11, 2011, 06:53:56 pm »

I will give them a shot and report back. Thanks foe the effort!

Kirk
Logged

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #3 on: July 13, 2011, 04:02:40 am »

I'll try it too!
Thanks!
Logged
Rolleiflex USA

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: app for Mac OS X 10.6 for deconvolution
« Reply #4 on: July 13, 2011, 08:35:41 am »

I'll try it too!
Thanks!

Since I'm not a Mac person, I won't be able to try it out. Publishing the code would possibly allow to compile a Windows version for a large audience. It would be interesting to see some results that can be compared with other methods (such as tested in this thread).

This image would be a nice one to test. With some relatively low contrast, yet very fine, detail which is blurred by a simulated f/32 diffraction effect it will tell something about the deconvolution capabilities. We've already seen that a very good recovery is possible, so it's interesting to see what the James Caron method can do.

Another image sample was introduced (reply 208) in that thread, which has some more high contrast features as well. It wil be easier to detect ringing artifacts with that image, and noise in the sky.

Looking forward to the results.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #5 on: July 13, 2011, 03:23:32 pm »

It's working pretty well actually!  Some rough edges around the GUI but still the results are quite good and its working fairly fast - about 10 seconds for a 30mb jpeg file on my Mac Pro.
I tried to donate money using the paypal link on your page but was given an error. Fix it and I'll send some money as I can already see some benefit from your program.

Thanks,
Eric

Logged
Rolleiflex USA

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #6 on: July 13, 2011, 03:38:11 pm »

Bart,
Here's your image done with Caron with the following parameters - 1e-7 Sigma, 0.45 Alpha, 3 Smooth, and Use psf tiles checked.
Eric

Edit - sorry could not upload as a png so resaved as jpeg - now compressed but you can see the deconvolution effect.
Logged
Rolleiflex USA

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #7 on: July 13, 2011, 03:44:12 pm »

Bart,
The windmill image looked great in the preview but threw an error on trying to save it - something about an incompatible file for Open CL.  Don't have more time to play with this right now but will come back later and post some crops of one of my own images that I thought was a really great result.
Eric
Logged
Rolleiflex USA

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: app for Mac OS X 10.6 for deconvolution
« Reply #8 on: July 13, 2011, 05:35:53 pm »

Bart,
Here's your image done with Caron with the following parameters - 1e-7 Sigma, 0.45 Alpha, 3 Smooth, and Use psf tiles checked.
Eric

Hi Eric,

Thanks for the test. It looks a bit coarse and noisy, compared to the earlier attempts with other methods as shown in the thread I mentioned. Also, the overall brightness increased but I understand that that issue is being looked into.

Quote
Edit - sorry could not upload as a png so resaved as jpeg - now compressed but you can see the deconvolution effect.

JPEG output is not an issue, it's supposed to be the end result after all other postprocessing. I just supplied a 16-bit PNG as input to avoid losses to the input data as much as possible, so that the deconvolution algorithms have relatively uncorrupted data to crunch.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

francois

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 13791
Re: app for Mac OS X 10.6 for deconvolution
« Reply #9 on: July 14, 2011, 03:18:43 am »

Bart,
The windmill image looked great in the preview but threw an error on trying to save it - something about an incompatible file for Open CL.

Got the same result  :(
Logged
Francois

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #10 on: July 14, 2011, 04:24:58 am »

Bart,
I think this worked a lot better with higher resolution files with fine detail.  I haven't seen many programs for the Mac that are this easy.  There was one program for astronomers that could not handle large files, and another raw therapee?  that was a comprehensive image edit program but it was not stable.  Matti's program is very fast and easy to use. 

One issue is that it needs to save out the files as jpeg and not png and it would be helpful if it could save the files with the profiles.

Eric
Logged
Rolleiflex USA

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #11 on: July 14, 2011, 05:03:57 am »

Here's an image I just worked....  It's from a test I was doing with the Aptus 12 (80mega pix) to see how much detail would be lost as I stopped the lens down. Shot was taken at f/23 - well beyond diffraction limits.   First full frame to show what part of the image was taken, and then the 100% crops - unsharpened, and deconvoluted using sigma value of 1e-4, Alpha of .38   psf of 20 tiles
Logged
Rolleiflex USA

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #12 on: July 14, 2011, 05:06:54 am »

btw - the deconvoluted image is a much better result than can be achieved using C1 sharpening.  I think Leaf Capture is better for fine detail as is LR3  - but I haven't made that comparison yet.   Still as the cameras push the pixel size down, this kind of processing will become valuable.
Logged
Rolleiflex USA

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: app for Mac OS X 10.6 for deconvolution
« Reply #13 on: July 14, 2011, 07:32:28 am »

btw - the deconvoluted image is a much better result than can be achieved using C1 sharpening.  I think Leaf Capture is better for fine detail as is LR3  - but I haven't made that comparison yet.   Still as the cameras push the pixel size down, this kind of processing will become valuable.

Hi Eric,

Yes, I've been advocating the use of deconvolution sharpening for a long time. It's the only way to really increase (or actually restore) resolution at the pixel level. As sensel density increases, actual system resolution will increase. However, with increased sensel density, the per pixel resolution will go down and the effects of diffraction will not help either. Deconvolution can do a lot to restore a lot of that per pixel resolution, so crops and larger output will also benefit more.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #14 on: July 14, 2011, 01:36:35 pm »

Probably, hopefully the big software makers are also well aware of this and are working on building this in.  I think LR3 already has partial implementation maybe others do as well.
Logged
Rolleiflex USA

ErikKaffehr

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 11311
    • Echophoto
Re: app for Mac OS X 10.6 for deconvolution
« Reply #15 on: July 15, 2011, 12:46:39 am »

Hi,

Yes, according to Eric Chan moving the detail slider fully to the right employs deconvolution. It works quite well in my view. Problem is that for deconvolution you really need a PSF (Point Spread Function).

I also use Topaz In Focus, sometimes, it can guess PDSF but I don't know how well.

Best regards
Erik




Probably, hopefully the big software makers are also well aware of this and are working on building this in.  I think LR3 already has partial implementation maybe others do as well.
Logged
Erik Kaffehr
 

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: app for Mac OS X 10.6 for deconvolution
« Reply #16 on: July 15, 2011, 03:39:44 am »

Hi,

Yes, according to Eric Chan moving the detail slider fully to the right employs deconvolution. It works quite well in my view. Problem is that for deconvolution you really need a PSF (Point Spread Function).

Hi Erik,

I asume Photoshop ACR and Smart Sharpen (advanced mode) use the Radius slider to simulate a PSF shape, perhaps something like a Gaussian. Anyway, Smart Sharpening does not seem as effective as a dedicated deconvolver.

Quote
I also use Topaz In Focus, sometimes, it can guess PDSF but I don't know how well.

Actually, the estimate function of InFocus seems to function quite well. However, it needs some reasonable contrasty edges in various directions in order to find enough clues. It cannot save this PSF (it only saves the slider settings), so it has to be able and find it in the image itself. It's not possible to use a similar setup (distance/aperture) and build a reference to save and use in another image. A workaround would be to enlarge the canvas of an image and add some detail from another image for InFocus to work with. InFocus currently has issues with structures that have a slightly different PSF, such as at a different distance fom the focus plane in the DOF zone. It doesn't take much to create artifacts, forcing one to reduce the amount and thus effectiveness. They'll probably improve it in an upcoming release they say they are working on.

RawTherapee will work reasonably well, when you can find a stable V3 alpha release. The previous stable V2 version also allowed to use the Richardson Lucy deconvolution on e.g. TIFFs, so that would be an alternative.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: app for Mac OS X 10.6 for deconvolution
« Reply #17 on: July 18, 2011, 11:06:39 am »

Yes, I've been advocating the use of deconvolution sharpening for a long time. It's the only way to really increase (or actually restore) resolution at the pixel level.

Bart, do you think using deconvolution over undemosaiced data (i.e. deconvolute the RAW R, G1/G2 and B channels separately) prior to demosaicing could mean some advantage?. Since diffraction is wavelength dependent, a different PSF for each RAW channel could provide more accurate deconvolution of the information. Also the deconvolution process (PSF estimation + deconvolution) wouldn't be fooled by any undesired characteristic of the demosaicing algorithm.

Care should be taken that each RAW channel is individually sampled at half the spatial frequency as the final image.

This is a series of images representing the B channel (pure RAW undemosaiced data) for several lenses (Hexanon AR 40mm f/1.8, S-M-C Takumar 50mm f/1.4 and Canon 24-70 f/2.8 ) and appertures:






This is exactly what the sensor saw, intuitively this should be the domain where deconvolution would work best.

Regards
« Last Edit: July 19, 2011, 07:15:23 am by Guillermo Luijk »
Logged

EricWHiss

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2639
    • Rolleiflex USA
Re: app for Mac OS X 10.6 for deconvolution
« Reply #18 on: July 19, 2011, 11:57:22 pm »

I've tested now Topaz In Focus, LR3 detail slider, Raw Therapee (couldn't get it to be stable and work), and Caron.   I really think Caron is working best.  LR3 is different but also showing some nice results. Topaz well worked but not as good as the others.   I tried to post crops from all last night but for some reason the uploading wasn't working - all the crops were about 3mb. 

Long story short, I'm pretty impressed with Caron so far, but at different settings than what the newer version is auto calculating.   

I'll try to upload my results again later. 
Logged
Rolleiflex USA

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: app for Mac OS X 10.6 for deconvolution
« Reply #19 on: July 20, 2011, 06:23:45 am »

Bart, do you think using deconvolution over undemosaiced data (i.e. deconvolute the RAW R, G1/G2 and B channels separately) prior to demosaicing could mean some advantage?. Since diffraction is wavelength dependent, a different PSF for each RAW channel could provide more accurate deconvolution of the information. Also the deconvolution process (PSF estimation + deconvolution) wouldn't be fooled by any undesired characteristic of the demosaicing algorithm.

Hi Guillermo,

Theoretically, and assuming it doesn't screw up subsequent demosaicing, I think it would be a benefit. The 3 color band PSFs could be optimzed for the CFA filter characteristics. However, the practical question will be how much will the benefit be compared to the current practice of deconvolving the RGB channels with the same PSF.

It's interesting to notice that the R/G/B resolution of a gray tone test target is virtually identical to the weighted luminance resolution. They have practically identical MTFs after demosaicing (as determined with Imatest). So the potential gain is in improving the chroma resolution, which isn't the most critical for human vision. How much that would improve the luminance resolution after demosaicing, remains to be seen. 

Quote
Care should be taken that each RAW channel is individually sampled at half the spatial frequency as the final image.

Possibly the easiest (from a programming point of view) approach would be to create 4 intermediate Raw images, just using the relevant R/G1/B/G2 channel sensel data, that would each be 1/4th of the full sensor size (which will also speed up the processing of each). These can then be deconvolved with the appropriate PSF for the spectral band. After that the full Raw data can be repopulated with resolution improved data, and normal demosaicing can take place. That could be an interesting thing for Emil Martinec to try, since he also has worked on the basis of the AMaZE demosaicing algorithm for RawTherapee.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==
Pages: [1] 2   Go Up