View Full Version : how to sharpen big details?
feisty2
11th March 2013, 11:21
I'd like to know if there's a way to sharpen big details and avoid sharpening edges
I tried a lot of things but didn't get ideal results
so here's a frame
http://thumbnails107.imagebam.com/24260/0194ce242591156.jpg (http://www.imagebam.com/image/0194ce242591156)
it looks blurry, I want to sharpen details like Britney's eyelash
If I use strong sharpening like mcsharp (sharp=1)
I get this
http://thumbnails108.imagebam.com/24260/8af879242591169.jpg (http://www.imagebam.com/image/8af879242591169)
yes, the eyelash looks clear but edges are oversharped,the whole image texture just looks terrible...
and If I use strong sharpening+edgemask (like lsfmod (edgemode=-1),tcanny....)
I get this
http://thumbnails106.imagebam.com/24260/9e7745242591181.jpg (http://www.imagebam.com/image/9e7745242591181)
only very small details like noise and grains get sharped, big details like eyelash still look blurry
so,what can I do about it? any ideas?
:thanks:
feisty2
11th March 2013, 14:41
I just tried SeeSaw but it still sharpens some edges ,not strong as using sharpeners directly tho
Do I have any other choice?
bxyhxyh
12th March 2013, 18:17
I'd like to know if there's a way to sharpen big details and avoid sharpening edges
Have you tried xsharpen?
StainlessS
12th March 2013, 20:33
If you can you manage this project, can you tell me the difference between detail and edge.
(And dont say detail is what you do want and edge is what you dont want)
EDIT: And also noise.
feisty2
13th March 2013, 04:26
If you can you manage this project, can yo&u tell me the difference between detail and edge.
(And dont say detail is what you do want and edge is what you dont want)
I guess edge is strong and clear, I'd like to sharpen weak and blurry details
osgZach
13th March 2013, 07:53
Couldn't you do something like use a mask to sharpen only what you want? Or take the pixels from the sharpened areas you want and put them onto the image?
(no I don't know how to do that, just tossing out ideas)
Poutnik
13th March 2013, 08:27
I guess edge is strong and clear, I'd like to sharpen weak and blurry details
In my understanding edge is strong contrast between regions, including line as a special region,
while details are either textures or very small area elements, with weak to strong contrast wrt surroundings.
But I agree the difference can be rather vague , sometimes.
Edit> Funny distinguishing:
Edges you see at the first look.
Details you see at the second one.
feisty2
13th March 2013, 08:40
Couldn't you do something like use a mask to sharpen only what you want? Or take the pixels from the sharpened areas you want and put them onto the image?
(no I don't know how to do that, just tossing out ideas)
yes, the main idea is to create a edge mask, but u see, weak detail (only if it's big enough) is included in the mask too, so it's very hard to sharpen big and weak detail
pandy
13th March 2013, 12:10
http://registry.gimp.org/node/11742
joka
13th March 2013, 13:48
Unfortunately we can not use wavelets. However look at this
http://people.csail.mit.edu/sparis/publi/2011/siggraph/Paris_11_Local_Laplacian_Filters_lowres.pdf
Reading the article I remembered Didées NonLinUSM that looks verry similar. I scripted it, but sorry, for some reasons I can not retest it. No warranty for typo's.
Function bandpassfilter(clip i, float "sigma", float "alpha", int "rad1", int "rad2", float "ldmp") {
sigma = Default(sigma, 0.2) * 255
alpha = Default(alpha, 0.7)
ldmp = Default(ldmp, 8)
rad1 = Default(rad1, 1)
rad2 = Default(rad2, rad1 * 2)
gx = (rad1 == 1) ? i : i.bicubicresize(i.width()/rad1/4*4, i.height()/rad1/4*4).bicubicresize(i.width(), i.height(),1,0)
gy = i.bicubicresize(i.width()/rad2/4*4, i.height()/rad2/4*4).bicubicresize(i.width(), i.height(),1,0)
mt_makediff(gx, gy)
mt_lut("x 128 - abs "+string(sigma)+" >= "+
\ "128 "+
\ "x 128 - abs "+string(sigma)+" / "+string(alpha)+" ^ "+string(sigma)+" * x 128 - x 128 - abs 0.001 + / * x 128 - 2 ^ x 128 - 2 ^ "+string(ldmp)+" + / * x 128 - - 128 + "+
\ "? "
\ ,U=1,V=1)
mt_adddiff(i).mergechroma(i)
Return last }
The parameters are named as in the article. ldmp is taken from NonlinUSM to handle the noise.
rad1=1 is for the highest frequencies (you don't need). Call it with rad1=2 and maybe in additional with rad1=4, rad1=8, ....
feisty2
13th March 2013, 15:31
Unfortunately we can not use wavelets. However look at this
http://people.csail.mit.edu/sparis/publi/2011/siggraph/Paris_11_Local_Laplacian_Filters_lowres.pdf
Reading the article I remembered Didées NonLinUSM that looks verry similar. I scripted it, but sorry, for some reasons I can not retest it. No warranty for typo's.
Function bandpassfilter(clip i, float "sigma", float "alpha", int "rad1", int "rad2", float "ldmp") {
sigma = Default(sigma, 0.2) * 255
alpha = Default(alpha, 0.7)
ldmp = Default(ldmp, 8)
rad1 = Default(rad1, 1)
rad2 = Default(rad2, rad1 * 2)
gx = (rad1 == 1) ? i : i.bicubicresize(i.width()/rad1/4*4, i.height()/rad1/4*4).bicubicresize(i.width(), i.height(),1,0)
gy = i.bicubicresize(i.width()/rad2/4*4, i.height()/rad2/4*4).bicubicresize(i.width(), i.height(),1,0)
mt_makediff(gx, gy)
mt_lut("x 128 - abs "+string(sigma)+" >= "+
\ "128 "+
\ "x 128 - abs "+string(sigma)+" / "+string(alpha)+" ^ "+string(sigma)+" * x 128 - x 128 - abs 0.001 + / * x 128 - 2 ^ x 128 - 2 ^ "+string(ldmp)+" + / * x 128 - - 128 + "+
\ "? "
\ ,U=1,V=1)
mt_adddiff(i).mergechroma(i)
Return last }
The parameters are named as in the article. ldmp is taken from NonlinUSM to handle the noise.
rad1=1 is for the highest frequencies (you don't need). Call it with rad1=2 and maybe in additional with rad1=4, rad1=8, ....
thx! I'll try
pandy
14th March 2013, 12:47
Unfortunately we can not use wavelets.
We can't because there is no plugin for Avisynth or there is another reason.
As source for wavelet decompose exist http://registry.gimp.org/files/wavelet-decompose-0.1.2.tar.gz perhaps emulating in a crude way Gimp architecture can solve this problem.
StainlessS
14th March 2013, 14:53
VagueDenoise is wavelet based and comes with source (lots of asm).
pandy
14th March 2013, 15:01
VagueDenoise is wavelet based and comes with source (lots of asm).
Aaah then seems that lack of wavelet is not Avisynth limitation but just lack of plugin - ok now i understand - i was just curious is there any reason (technical) why wavelets decomposition can't be implemented as plugin for Avisynth.
*.mp4 guy
14th March 2013, 15:04
You don't actually want to sharpen "big details". This is a case where you need a very selective sharpener. Also, the source has aliasing, so that will be a problem.
StainlessS
14th March 2013, 15:06
I seem to recall that one of the developers of VagueDenoise (Fizick I think) did not quite understand
wavelets or how they worked, and so would think it might be a very demanding task for any developer,
very definitely beyond me.
pandy
14th March 2013, 16:32
I seem to recall that one of the developers of VagueDenoise (Fizick I think) did not quite understand
wavelets or how they worked, and so would think it might be a very demanding task for any developer,
very definitely beyond me.
Me either - i just know that wavelets can be useful in areas where other methods can't provide good results and vice versa - sometimes wavelets can be less than optimal - wavelet decomposition and chance to operate selectively only in part of signal bandwidth/spectrum (sharpen "large" details) seems to be optimal wavelet use.
joka
15th March 2013, 09:25
@pandy
Sorry for the unclear statement regarding wavelets. Of course it is possible to make a plug-in based on wavelets. But I do not know a plug-in that is ready for use for feisty2's problem.
@feisty2
The solution I proposed is based on the idea to splitt it in levels of details and process each level separately. Rad1 and rad2 select the "frequency band". Sigma influences the decision if it is detail (<Sigma) or egde (> sigma). Alpha is relevant for boosting (<1.0) or reduce / denoise details (>1.0). Ldmp is required to reduce noice. In my tests I had to use ldmp also for higher levels.
If you set rad2 = 2* rad1 you can create about 6 or 7 levels (bicubiresize fails with rad > 128 on a HD source - that results in a frame size less 8x8).
The sricpt is 1 level, so I proposed to call it twice or 3 times starting with the second level (rad=2).
Sorry again for not testing it finally. I cutted this one level out of a a recursive script. Reason was to enable it to start with a higher level (not to process the first already sharp level).
Hoever, I proposed this way because I thinks masking is not the rigth way to solve the problem.
StainlessS
15th March 2013, 10:53
Maybe V.C. Mohan has an interest in wavlets or other techniques for dealing with "large details", perhaps he can comment.
Here are V.C's plugs, very interesting.
EDIT: Oops, forgot the link:
http://avisynth.org/vcmohan/
feisty2
15th March 2013, 15:02
You don't actually want to sharpen "big details". This is a case where you need a very selective sharpener. Also, the source has aliasing, so that will be a problem.
so,where can I find this selective sharpener? thx
and aliasing isn't really a problem,just use a little supersample process with eedi and it will be fixed :)
sorry everyone, I'm just a new avs learner and know nothing about software development, I can tell wavelet is a great idea but I have no idea how to do it :stupid:
lisztfr9
16th March 2013, 15:12
Unfortunately we can not use wavelets. However look at this
http://people.csail.mit.edu/sparis/publi/2011/siggraph/Paris_11_Local_Laplacian_Filters_lowres.pdf
Reading the article I remembered Didées NonLinUSM that looks verry similar. I scripted it, but sorry, for some reasons I can not retest it. No warranty for typo's.
gx = (rad1 == 1) ? i : i.bicubicresize(i.width()/rad1/4*4, i.height()/rad1/4*4).bicubicresize(i.width(), i.height(),1,0)
gy = i.bicubicresize(i.width()/rad2/4*4, i.height()/rad2/4*4).bicubicresize(i.width(), i.height(),1,0)
mt_makediff(gx, gy)
mt_lut("x 128 - abs "+string(sigma)+" >= "+
\ "128 "+
\ "x 128 - abs "+string(sigma)+" / "+string(alpha)+" ^ "+string(sigma)+" * x 128 - x 128 - abs 0.001 + / * x 128 - 2 ^ x 128 - 2 ^ "+string(ldmp)+" + / * x 128 - - 128 + "+
\ "? "
\ ,U=1,V=1)
mt_adddiff(i).mergechroma(i)
Return last }
....
I'm just wondering why Didée did use that kind of blurring using a resizing, instead of a simple blur command. And the resizing parameter using rad/4 is not that strong...
BTW originally it was :
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)
Thanks, L
joka
20th March 2013, 13:53
@ lisztfr9
The blur depends on rad. The /4*4 is to enshure that height and width can be divided by 4.
In NonLinUSM rad is defined as float. So you need the round(...) to come to integer. I defined rad1 and rad2 as int, so it is an integer operation already.
turbojet
26th March 2013, 22:19
If you don't mind sharpening during playback by using pixel shaders instead. LumaSharpen (http://forum.doom9.org/showthread.php?p=1541796#post1541796) does a fantastic job at sharpening everything but the high contrast edges. I don't know of an avisynth alternative that can compete closest is probably limitedsharpen but it still sharpens some high contrast edges.
wonkey_monkey
27th March 2013, 00:30
The original version of my fusion plugin implemented a filter called "undersharpen" which could enhance a particular level of an image which had been decomposed into a Laplacian pyramid. I think, though - looking at file modification times - that I may have overwritten it. If there's any interest, it's a pretty simple thing for me put together again.
David
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.