Pages: 1 ... 6 7 [8] 9 10 ... 18   Go Down

Author Topic: Deconvolution sharpening revisited  (Read 266071 times)

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Deconvolution sharpening revisited
« Reply #140 on: August 02, 2010, 09:30:42 pm »

As usual, there is a continuum between "most accurate, system and situation specific" and "good enough most of the time, easy to use and generic".   There is the DxO approach that tailors everything to s specific ombination of body, lens, focal length etc but then somebody has to accumulate all that data.  I guess I'm in the second camp -- I would like to know whether a Gaussian PSF or something else is "good enough" for most bodies and lense and exposure parameters, most of the time.  My hunch is that a single Gaussian is not optimal, and am wondering whether there is a single PSF, or maybe a one-parameter family of PSF's, that is good enough for the majority of situations one encounters in practice, given the practical limitations on what can be recovered through deconvolution.
Logged
emil

Daniel Browning

  • Full Member
  • ***
  • Offline Offline
  • Posts: 142
Deconvolution sharpening revisited
« Reply #141 on: August 04, 2010, 07:37:49 pm »

Quote from: ejmartin
Is there anywhere one can find the typical PSF or spectral power distribution of the typical AA filter?

Not that I know of. The most I've seen is a Pretty Picture on page four of "How to Read MTF Curves", by H. H. Nasse.

EDIT: Beat to the punch by Bill (two and a half days, no less).
« Last Edit: August 04, 2010, 07:45:03 pm by Daniel Browning »
Logged
--Daniel

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
RL deconvolution using Photoshop
« Reply #142 on: August 15, 2010, 10:12:45 am »

To gain some insight into how it works, here is a recipe for RL deconvolution using Photoshop commands:

1. Duplicate the ORIGINAL blurry image, call it "COPY1"

2. Duplicate COPY1, call it "COPY2"

3. Blur COPY2 with the PSF. For a gaussian, use Gaussian Blur. Other PSFs can be defined with the Custom Filter.

4. Divide the ORIGINAL blurry image by COPY2, with the result in COPY2.

5. Blur COPY2 with the PSF (as in step 3).

6. Multiply COPY1 by COPY2, with the result in COPY1. (Apply Image with Blending Mode: Multiply)

7. Go to step #2 and repeat for the number of iterations you want. Each iteration gets a little sharper. The final result is in COPY1.

Note that there is a little snag - step 4 requires dividing one image by another. As far as I know, only CS5 has the Divide Blend Mode (http://blogs.adobe.com/jnack/2010/05/video_new_blending_modes_in_photoshop_cs5.html), as does Gimp.

I don't have CS5, so I used a plugin to do the division in step 4. This is how COPY2 looks after that division step:



Full size here: https://sites.google.com/site/cliffpicsmisc/bart/RL_copy2_full.png

You can see that this is where the high frequencies are getting boosted, then applied as a mask in step 6 to the previous iteration.

Logged
Cliff

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Re: Deconvolution sharpening revisited
« Reply #143 on: August 15, 2010, 10:59:58 am »

Interesting.  I'd be curious to see how it does relative to RL in, say, RawTherapee -- applied to the same tiff image (RT takes tiffs as inputs).  The thing that I would worry about with doing the deconvolution in photoshop is roundoff errors, since all one has access to in PS is 16-bit integer math unless you jump through hoops with the HDR format.  How are you doing the division step in integer math?
Logged
emil

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Deconvolution sharpening revisited
« Reply #144 on: August 15, 2010, 12:14:59 pm »

Quote
Interesting.  I'd be curious to see how it does relative to RL in, say, RawTherapee -- applied to the same tiff image (RT takes tiffs as inputs).  The thing that I would worry about with doing the deconvolution in photoshop is roundoff errors, since all one has access to in PS is 16-bit integer math unless you jump through hoops with the HDR format.  How are you doing the division step in integer math?

Roundoff errors could be a problem after more than a few iterations. I've only tried 4 iterations, manually. Maybe someone with CS5 could try it, in an action, and let it run for a while. I don't think that switching to 32bit mode would change any of the steps, so no jumping through hoops?

For division, I used a plugin that makes the reciprocal (1/x), then multiplied by that in step 4.

I guess another way to do that (multiply by the reciprocal, instead of divide) would be to make a look-up table in Curves for the reciprocal. I'll try that later and post it if it works.
Logged
Cliff

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Re: Deconvolution sharpening revisited
« Reply #145 on: August 15, 2010, 01:03:54 pm »

OK, so your plugin presumably takes 1/x where x is an integer from 1 to 2^15-1=32767 (Photoshop internal format is signed integer IIRC), then multiplies back up by 32767 to restore the range, and truncates to integers.  I was wondering what it meant to divide two images, since the range of values could be anywhere from 1/32767 to 32767 (ignoring cases where one is dividing or mulitplying by zero).  For two nearly similar images such as the ratio of an image and its low-pass filter, most of the values would be near one which doesn't truncate nicely in integer math; I was wondering how that would be dealt with.  It looks like in your version the nearly equal values unpon division are being sent to a color value 203 (on my non-calibrated laptop).
Logged
emil

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Deconvolution sharpening revisited
« Reply #146 on: August 15, 2010, 02:07:52 pm »

For two nearly similar images such as the ratio of an image and its low-pass filter, most of the values would be near one which doesn't truncate nicely in integer math; I was wondering how that would be dealt with.  It looks like in your version the nearly equal values unpon division are being sent to a color value 203 (on my non-calibrated laptop).

After the division step the result looks black. The image mean is 3220/32768 (or 25 in 8 bit) in sRGB. I normalized it with the Exposure tool @ +7 before going to the next steps.

I suppose this should all be done in a linear space, too, instead of sRGB, still it seems to work.
Logged
Cliff

DeanSonneborn

  • Newbie
  • *
  • Offline Offline
  • Posts: 44
Re: Deconvolution sharpening revisited
« Reply #147 on: August 17, 2010, 12:19:52 am »

 While in the Lightroom forum someone mentioned this:

As per Eric Chan:
Quote from: madmanchan
... CR 5.7 uses the same new method as LR 3.0 (so that LR 3 users can use Edit-In-PS with CS4 and get the same results).

So since LR3 does deconvultion sharpening and CR 5.7 uses the same new method(s)...does that mean that CR 5.7 will perform deconvolution sharpening when the detail slider is moved all the way to the right? I tried to compare it with CS4 smart sharpening via lens blur settings and they do seem too have similar effects but I'm just not sure. Does anyone know if CR 5.7 is actually doing deconvolution hsarpening?
Logged

DeanSonneborn

  • Newbie
  • *
  • Offline Offline
  • Posts: 44
Re: Deconvolution sharpening revisited
« Reply #148 on: August 17, 2010, 12:26:37 am »

While in the Lightroom forum some one mentioned this:

As per Eric Chan:
Quote from: madmanchan
... CR 5.7 uses the same new method as LR 3.0 (so that LR 3 users can use Edit-In-PS with CS4 and get the same results).

So...since LR3 does deconvolution sharpening when the detail slider is moved all the way to the right and since CR 5.7 uses the same method(s) does that mean CD 5.7 also does deconvolution sharpening?  I've tried to compare it to CS4 smart sharpen via lens blur settings and it seems to have a similar appearance but I can not be sure. Does anyone know if CD 5.7 is really also doing deconvolution sharpening when the detail slider is moved all the way to the right?
Logged

joofa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 544
Re: Deconvolution sharpening revisited
« Reply #149 on: August 17, 2010, 01:53:01 am »

For two nearly similar images such as the ratio of an image and its low-pass filter, most of the values would be near one which doesn't truncate nicely in integer math; I was wondering how that would be dealt with.

Don't know if that is applicable here but a complicated floating point calculation is approximated by fixed point when direct integer math is not favorable.

For e.g., I took randomly 15/16*23/7*11/9*41/45*73/87*101/127=2.29 in floating point and just using 2 extra bits I got the answer as 2.

I think crames is kind of simulating that when he mentions "I normalized it with the Exposure tool @ +7 before going to the next steps."

Joofa
« Last Edit: August 17, 2010, 02:04:27 am by joofa »
Logged
Joofa
http://www.djjoofa.com
Download Photoshop and After Effects plugins

deejjjaaaa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1170
Re: Deconvolution sharpening revisited
« Reply #150 on: August 17, 2010, 12:50:59 pm »

So...since LR3 does deconvolution sharpening when the detail slider is moved all the way to the right

no, not "all the way" to the right - as Eric clarified it is a blend of USM and deconvolution methods, where the input from deconvolution is growing as you move the slider to the right... just when it is "all the way to the right" you probably have 100% pure deconvolution w/o any input from USM
Logged

bjanes

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 3387
Re: Deconvolution sharpening revisited
« Reply #151 on: August 17, 2010, 03:16:15 pm »

no, not "all the way" to the right - as Eric clarified it is a blend of USM and deconvolution methods, where the input from deconvolution is growing as you move the slider to the right... just when it is "all the way to the right" you probably have 100% pure deconvolution w/o any input from USM

Yes, that is my take on Eric's post. Now, what happens when the slider is all the way to the left? USM? However, detail of zero suppresses halos, which is different from the usual USM.

Regards,

Bill
Logged

deejjjaaaa

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1170
Re: Deconvolution sharpening revisited
« Reply #152 on: August 17, 2010, 05:05:01 pm »

Yes, that is my take on Eric's post. Now, what happens when the slider is all the way to the left? USM? However, detail of zero suppresses halos, which is different from the usual USM.

they should be using some proprietary modifications and not textbook formula
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1852
    • Frank Disilvestro
Re: Deconvolution sharpening revisited
« Reply #153 on: August 18, 2010, 08:35:11 am »


While in the Lightroom forum some one mentioned this:

As per Eric Chan:
Quote from: madmanchan
... CR 5.7 uses the same new method as LR 3.0 (so that LR 3 users can use Edit-In-PS with CS4 and get the same results).


As far as I understand, in the post from Eric Chan in the LR forum, he was mentioning that the demosaicing method was the same in LR2.7/ACR 5.7 as in LR 3, ACR 6. He was not talking about sharpening or noise reduction. Later he mentioned than in LR 3 and ACR 6 the three functions were optimized to work toghether (demosaicing, sharpening and NR). There is no implication that sharpening and NR have been changed in LR 2.7 and ACR 5.7

From a previous post in this thread, Eric Chan specify that for deconvolution sharpening only in LR3 /ACR 6, you should set the detail slider at 100%

ced

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 287
Re: Deconvolution sharpening revisited
« Reply #154 on: August 22, 2010, 05:28:34 am »

What is the problem with sharpening in Lab? see attached
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
Re: Deconvolution sharpening revisited
« Reply #155 on: August 22, 2010, 06:29:36 am »

What is the problem with sharpening in Lab? see attached

In general, converting to Lab and back to RGB mode risks losing certain colors/distinctions because the gamut remapping is a lossy process.

Which file did you sharpen, and which settings did you use?

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

ced

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 287
Re: Deconvolution sharpening revisited
« Reply #156 on: August 23, 2010, 04:50:11 am »

Bart Hi!  It was a convoluted file you uploaded but I would be happy to do it on a crop of the original from the camera.
The switch to Lab should not cause any shift in the colour values.
The file got a gauss blur on the a&b channels and a smart shrpn 100 - .2 on the L with a slight increase in saturation on the a&b because as you know blurring causes desaturation.
KR
Logged

John R Smith

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1357
  • Still crazy, after all these years
Re: Deconvolution sharpening revisited
« Reply #157 on: August 23, 2010, 05:19:38 am »

I have been playing around with the use of LR3 sharpening in Eric's suggested deconvolution mode, and it seems to work very well for subjects with lots of very fine detail. I usually end up with Detail 100, Radius 0.5 to 0.8, and Amount say 25 to 40. But it struck me that if this is deconvolution based sharpening, the routine cannot be using many iterations because the results are instantaneous. I had previously thought that for deconvolution to work it had to run thousands of iterations and was very processor-intensive.

John
Logged
Hasselblad 500 C/M, SWC and CFV-39 DB
an

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
Re: Deconvolution sharpening revisited
« Reply #158 on: August 23, 2010, 08:08:26 am »

Bart Hi!  It was a convoluted file you uploaded but I would be happy to do it on a crop of the original from the camera.

No, that's fine. It's the convolved 16-b/ch PNG file that needs to be used indeed. I just wondered, because I cannot reproduce your result with the settings you just gave. Could you double check if there was an accidental mix-up?

Quote
The switch to Lab should not cause any shift in the colour values.

Unfortunately it does. On the one hand you lose color precision (twice) due to rounding to integer numbers which results in mapping some colors to similar ones, thus losing the distinction, and you risk clipping of saturated colors. Then on the other hand you introduce a colorshift (how much depends on the amount of change in the L channel) when you change local contrast. Given a small radius correction it might amount to only a bit of shift for most of the image, but a shift will occur.

The following experiment will show you the potential magnitude of the issue:
  • In the Photoshop Color Picker dialog, specify a saturated Blue (R=0, G=0, B=255). Note that in the associated Lab coordinates, the b channel is clipped to the maximum that Photoshop allows.
  • Now change the L channel's value to a medium luminosity of, say, 54. Note that the RGB values gained significantly more Red than Green. This not only signifies a change in saturation, but also in color (BTW very noticeable in memory colors like with a blue sky).
  • Now return the L channel value back to 0, and note that the RGB values show a shift from the original color to a slightly Magenta version of the original one, the color has changed.

Quote
The file got a gauss blur on the a&b channels and a smart shrpn 100 - .2 on the L with a slight increase in saturation on the a&b because as you know blurring causes desaturation.

Thanks for sharing the settings, that will allow others to reproduce the results by using a similar approach. Yes, blurring the chromaticity will indeed change the saturation a bit, although only for the detail that changes significantly by the blur. By increasing the contrast of the ab channels, one does boost the saturation for the lower spatial frequencies more than the compensation for the blurred features.

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

ced

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 287
Re: Deconvolution sharpening revisited
« Reply #159 on: August 23, 2010, 10:54:35 am »

Please guide me to where the original crop png file can be found.
Logged
Pages: 1 ... 6 7 [8] 9 10 ... 18   Go Up