Log in

View Full Version : out of focus correction


Terka
13th August 2010, 09:07
Speaking generally, but want to use this on huge out of focus photos.
As written in 1st Limited sharpen post
The edges are S shaped:

_
_/
+- we can call them costant, linear, constant

Is it possible to use masktools to following task:
1. find the gradient (even if eg 10 pixels wide)
2. change the rising of the gradient by expanding the constant parts and inpanding the linear part?

2Bdecided
13th August 2010, 11:54
Aren't there algorithms more suited for this? e.g. deconvolution.

Admittedly the commercial things I've tried look more like over-sharpening, rather than magic (for reasons I think Didee has explained several times in the past!), but they do some good. e.g. Focus Magic. I think it depends on the actual nature of the "out of focus"-ness, and how well you set the parameters.


What you suggest would be great for anime, but maybe look strange for photos. Not sure what you're looking for is necessarily linear.

I'm sure someone smart will be along in a moment...!

Cheers,
David.

Didée
13th August 2010, 15:12
To shorten the waiting time until someone smart comes along, have a look at VCMohan's filters (http://avisynth.org/vcmohan/).

FQFocusDefocus and FQSharp>FQRestore seem appropriate. (Note I never tried them, hence I can't help.)

*.mp4 guy
13th August 2010, 22:18
FQFocusDefocus tends to hit a wall around the 1 to 2 pixel wide mark (as stated on the authors page), as is usually the case with sharpeners that actually function in real world usage. It is however quite good and surprisingly fast, though it will amplify noise. It looks much better then I remember it being in the past, but I might just be using it more in the manner it was intended to be used then I did previously. The one annoyance is tweaking the scale parameter so that the output is the correct brightness for the settings used.

I'm going to see If I can grok FQSharp.

In any case you should be able to get around 2 to 4 times more resolution out of a blurry image using avisynth. If you want something crazier then that, you will really have to post a representative example to get any more specific advice.

Also, if Didée doesn't know how to fix a 10px wide blur, theres a pretty significant chance that it isn't reasonably achievable. Before anyone asks, I definitely don't think I can do it either, but I'm always willing to waste some time on it, as its an interesting problem. IIRC VCMohan is pretty good at this stuff, so hopefully FQSharp will work, or he will show up, but I haven't seen him around in a while.

[edit] You might have to put this code in front of FQaharp/FQFocusDefocus even if they are progressive.
assumefieldbased().weave().assumeframebased().separatefields()Not sure why they want field separated stuff, but this works.

Wicket
28th June 2011, 06:00
Hello Folks,

I've struggled to deblur this, is there anyone out there who could have a crack at it, or give me a few pointers?

http://www.sendspace.com/file/d7s8tw

Thanks,

Wicket