Log in

View Full Version : advice for sharp


byme
4th February 2011, 19:44
Seeking a sharp, it's more a Detail Enhancement
Sharp filters generally square the contours
The only ones that I found that increase the detail, are UnsharpMask and Sharpen (Internal Avisynth)
The problem of these two sharp is that increase also the dirt

There is a sharp that not squares (absolutely) and not writing dirt?

example:

SOURCE
http://file2.net/110204img2179io.png.html
http://file2.net/110204img3607vb.png.html
http://file2.net/110204img3325xt.png.html
http://file2.net/110204img1368rk.png.html


SHARP
http://file2.net/110204img761uy.png.html
http://file2.net/110204img7680tu.png.html

AviSource("D:\santa1.avi").ConvertToYUY2(Interlaced=False)

BorderControl(YTS=2, YBS=2, XLS=2, XRS=2)
vinverse()
UnDot()

ConvertToRGB32(Interlaced=False)
VD_UnsharpMask(2, 64, 0)

ConvertToYV12(Interlaced=False)

BlindDeHalo3(rx=3.0, ry=3.0, strength=64, interlaced=false)###lodamp=25.0, hidamp=25.0, sharpness=100
FastLineDarkenMOD2(strength=32, luma_cap=255, threshold=0, thinning=0)

GradFunkMirror()

#ConvertToYUY2(Interlaced=False)
#dfttest(sigma=0.5)

ConvertToRGB(Interlaced=False)


SHARP + DENOISE (dfttest + NeatVideo)
http://file2.net/110204img4423yr.png.html
http://file2.net/110204img7149lu.png.html

AviSource("D:\santa1.avi").ConvertToYUY2(Interlaced=False)

BorderControl(YTS=2, YBS=2, XLS=2, XRS=2)
vinverse()
UnDot()

ConvertToRGB32(Interlaced=False)
VD_UnsharpMask(2, 64, 0)

ConvertToYV12(Interlaced=False)

BlindDeHalo3(rx=3.0, ry=3.0, strength=64, interlaced=false)###lodamp=25.0, hidamp=25.0, sharpness=100
FastLineDarkenMOD2(strength=32, luma_cap=255, threshold=0, thinning=0)

GradFunkMirror()

ConvertToYUY2(Interlaced=False)
dfttest(sigma=0.5)

ConvertToRGB(Interlaced=False)


I like absolutely the BlindDeHalo3, whether that there are or no halos... because it refines the image

Nightshiver
4th February 2011, 19:48
As I stated in the thread you posted in earlier, we need VIDEO samples, not pictures.

Didée
4th February 2011, 21:08
I like absolutely the BlindDeHalo3, whether that there are or no halos... because it refines the image
You have discovered the (potential) beautiness of a principle called "energy normalization". :)

byme
4th February 2011, 21:25
but with ImageSource("") is not the same thing?

sample video (YV12)

http://www.mediafire.com/?y944ah3be42evz6

byme
4th February 2011, 21:28
You have discovered the (potential) beautiness of a principle called "energy normalization". :)

if you have other good suggestions for this "energy normalization"... :)

Didée
4th February 2011, 21:49
Difficult to advise, because good settings for a pleasing result are arbitrary. Do a little, and it won't change much. Do a little too much, and it looks bad again. Also it strongly depends on the source itself, and on the sharpening process used, and the sharpening strength. In that sense, it's really more an "artistic measure", rather than an automated tweak to use.

Basically, you would take the difference caused by the sharpener, blur that difference with a similar (or slightly bigger) radius than the one used by the sharpener, and apply that blurred difference inversely. Often needs an additional safety catch, so that the blurred difference stays in range of what a direct blur would do.

For reference, a rather conservative/careful implementation is in TGMC. It's the "Sbb" feature, which stands for "Sharpness back-blending". (However, TGMC does not have the intention to "enhance" the input, and so the differences due to Sbb are rather subtile.)

Dogway
4th February 2011, 22:05
Didée just a curiosity that was in my mind for a few days, why there isnt such thing as a temporal sharpening? everything I know on avisynth leads to some kind of blurring (denoise, aa, resize...)

Didée
4th February 2011, 22:16
Perhaps because ... it doesn't make sense?

I've posted that already somewhere, but once more ... here's a temporal sharpener:

a = last
b = a.temporalsoften(1,255,255,255,2)
a.mt_adddiff(mt_makediff(a,b,U=3,V=3),U=3,V=3) # this is "temporal sharpening"

Obviously, "temporal sharpening" in the sense of "enhancing the tempoal pixel differences" is mostly nonsense. Perhaps you had something different in mind?

Dogway
5th February 2011, 03:52
I feared it wouldnt make sense. What I mean is more about sampling, take also the temporal pixels for sampling the current pixels, which would even work on semistatic areas, maybe using some kind of motion estimation/compensation. Just thinking... I really would like a more intelligent sharpening that would estimate object details on temporal correlation. Most current sharpeners dont add anything new on the actual frame than what already is. Or maybe Im just describing what superreolution is about(?)...

byme
5th February 2011, 15:57
but then think that the best solution is the one that I adopted?

I would use the least possible denoise filters (especially dfttest, that flattening), but with the unsharpmask and sharpen seems to be necessary

Mini-Me
15th February 2011, 13:40
I feared it wouldnt make sense. What I mean is more about sampling, take also the temporal pixels for sampling the current pixels, which would even work on semistatic areas, maybe using some kind of motion estimation/compensation. Just thinking... I really would like a more intelligent sharpening that would estimate object details on temporal correlation. Most current sharpeners dont add anything new on the actual frame than what already is. Or maybe Im just describing what superreolution is about(?)...

Estimating object details based on information from nearby frames does sound very similar to "superresolution techniques." Even without something so sophisticated though, I think the concept of "temporal" or "motion-compensated" sharpening makes perfect sense if you look at it from the right angle. The idea is not to enhance temporal differences (which as Didee says would be counterproductive) but to enhance temporal similarities which are unlikely to be noise.

When you're sharpening, the last thing you want to do is sharpen noise. At the same time, you may not want to strongly denoise your source prior to sharpening either, lest you blur the crap out of it (perhaps you want to keep the current noise and grain levels, but you want to sharpen everything else). As a solution, you could use the temporal/motion compensation techniques from denoisers to cautiously locate "potentially" noisy areas, and then you can sharpen everything else. It doesn't have to be a binary decision either; you can sharpen various amounts depending on your degree of confidence that a particular area is genuine detail. Because you're not actually blurring anything - just selectively sharpening - you can use stronger temporal settings than you could during an actual denoising operation.

Without actually writing a temporal/motion compensating sharpening filter, a quick prototype might do the following:
Create a temporary denoised clip using strong settings with a motion-compensated denoiser.
Create an inverse mask from the difference between the source and the denoised clip, and scale it with levels.
Apply a sharpening filter to the source clip, using the inverse mask.
Alternately, a prototype might do this (although it might not work quite as well):
Create the strongly denoised clip.
Create a temporary clip with the difference between the source and denoised clip.
Sharpen the denoised clip.
Add the aforementioned difference clip back into the denoised and sharpened clip.

I doubt this idea is anywhere near new though. I've seen the term "contrasharpening" a few times on the forum, and even though I've never found a full explanation, I imagine from the name that it probably does something similar.

Didée
15th February 2011, 15:37
The 2nd one basically is the method used by SeeSaw(). ;)

Mini-Me
16th February 2011, 04:57
The 2nd one basically is the method used by SeeSaw(). ;)

Thanks for pointing that out. The thread on Seesaw is about 30 pages, and the OP is a bit vague, so I still had learning about that one on my "to do" list. ;) There's such a wealth of knowledge on these forums, but it would take ages to read through all the posts looking for the most informative ones. In a similar vein, could you point me to an explanation of contrasharpening? Also, do you know if any existing filters use the first method I outlined above?

Didée
16th February 2011, 10:37
"Contra-Sharp" = "use a [strong] sharpener, but don't allow the sharpener to add more than what has been removed previously."

The first method is not a complete plan (to me at least), it leaves several open questions. Primarily: how to create the mask from the denoise-difference. If you simply do not sharpen in those areas where some sort of noise has been removed, then there won't be much area left over to sharpen. Also, often there is detail "hidden below the noise level", in which case it's of course necessary to sharpen also in "noisy areas".)

SilaSurfer
16th February 2011, 18:15
ContraSharpening by Didée and SeeSaw again by Didée (Didée makes some great tools for AviSynth ;)), are for me the only logical Sharpening tools to use when one is denoising for example, to preserve or bring back whatever details were removed beforehand. With SeeSaw you are mixing sharpened and denoised source together and ContraSharpening does what the name itself tells you. For clean (no denoising) but soft sources for me is LSF(Lmode=3, Smode=4 - to get best out of both worlds), if I have a grainy source and if it can be improved (Seesaw with predenoised input clip) and if I have a source with nice already very prominent details denoising + ContraSharpening is enough. Just my opinion. :p

Dogway
16th February 2011, 19:02
The only pitfall of seesaw is its prone to leave/bring back some noise. No matter how I modify parameters. Normally I end up using contrasharpening which is good enough but its only a post-sharpening with an elaborated mask.

When I talk about temporal sharpening I dont refer to crispness, but to real object detailing. It might deal with ringing and edge enhancment nonetheless.

My thinking looks more about temporal denoising.

-Create Motion Mask.
-Compensate differences in n frames span to save in buffer only in low motion areas.
-Use that buffer to average in actual frame (maybe weighted and through a similarity mask)

For actual crispness recently Im liking mcawarpsharp

SilaSurfer
16th February 2011, 19:09
-Create Motion Mask.
-Compensate differences in n frames span to save in buffer only in low motion areas.
-Use that buffer to average in actual frame (maybe weighted and through a similarity mask)

For actual crispness recently Im liking mcawarpsharp

Could you post an example script? I'm interested to try it. :)

Dogway
16th February 2011, 19:16
I dont know the mechanics of making these things, but shouldn't be too hard to make one.

If you refer to mcawarpsharp, its a discussed thread (http://forum.doom9.org/showthread.php?t=159248). I edited the script a bit to make it easier, more accessible.
mcaWarpSharp.avsi (http://www.sendspace.com/file/qm304l)

SilaSurfer
17th February 2011, 15:52
Thanks Dogway for the script and your time. I'll try it out.

Edit:

Tried it on a film material, pretty nice. Just to ask you what "post" setting do you recommend?

Dogway
22nd February 2011, 12:08
default is 4, so 4 for more pleasing results. You might set 3 if you notice you lose some detail with 4. Read the avsi, and the thread to get an idea

SilaSurfer
22nd February 2011, 13:16
Thanks for the info!

buletti
26th February 2011, 15:21
I'm not sure if it's still of interest, but I just stumbled over Didee's annotated contra sharpening in one of my scripts.


denoised = unfiltered.denoise() # Apply denoiser of choice
s = denoised.minblur(1, 1) # Damp down remaining spots of the denoised clip.
allD = mt_makediff(unfiltered, denoised) # The difference achieved by the denoising.
ssD = mt_makediff(s, s.removegrain(11, -1)) # The difference of a simple kernel blur.
ssDD = ssD.repair(allD, 1) # Limit the difference to the max of what the denoising removed locally.
ssDD = ssDD.mt_lutxy(ssD, "x 128 - abs y 128 - abs < x y ?") # abs(diff) after limiting may not be bigger than before. abs(x - 128) < abs(y - 128) ? x : y
denoised = denoised.mt_adddiff(ssDD, U=2, V=2) # Apply the limited difference. (Sharpening is just inverse blurring.)