Log in

View Full Version : Interesting use for mftoon, deen, and xsharpen


RadicalEd
10th January 2004, 10:49
I came across some 460x350 still images the other day that I was interested in converting to 1024x768 wallpaper. Naturally, any resizing algorithm alone failed miserably at this task, so I figured I would give sharpresize a try. It (mftoon, as well) choked with access violations or weird effects at that res, so I compromised with this:

avisource("hm.avi").duplicateframe(0).lanczosresize(848,645).crop(0,9,-0,-0).converttoyv12().mftoon().lanczosresize(1024*4,768*4).deen("a2d",7,20,20).xsharpen(255,255).lanczosresize(1024,768)


And, well.. you decide how it turned out.

1: Original (http://misatokatsuragi.home.comcast.net/HM/art01.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/01.jpg)
2: Original (http://misatokatsuragi.home.comcast.net/HM/art02.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/02.jpg)
3: Original (http://misatokatsuragi.home.comcast.net/HM/art03.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/03.jpg)
4: Original (http://misatokatsuragi.home.comcast.net/HM/art04.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/04.jpg)
5: Original (http://misatokatsuragi.home.comcast.net/HM/art05.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/05.jpg)
6: Original (http://misatokatsuragi.home.comcast.net/HM/art06.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/06.jpg)
7: Original (http://misatokatsuragi.home.comcast.net/HM/art07.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/07.jpg)
8: Original (http://misatokatsuragi.home.comcast.net/HM/art08.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/08.jpg)
9: Original (http://misatokatsuragi.home.comcast.net/HM/art09.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/09.jpg)
10: Original (http://misatokatsuragi.home.comcast.net/HM/art10.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/10.jpg)
11: Original (http://misatokatsuragi.home.comcast.net/HM/art11.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/11.jpg)
12: Original (http://misatokatsuragi.home.comcast.net/HM/art12.jpg), Wallpaper (http://misatokatsuragi.home.comcast.net/HM/12.jpg)

I also took the text out of the first one (http://misatokatsuragi.home.comcast.net/Wallpaper_HMq5.jpg). Too lazy to do it for the rest.

A bit obscure and OT, but useful and interesting nonetheless!
I'm going to have to try this out on images capped from DVD.

mf
10th January 2004, 13:20
Yeah. I've done this on images before too. Nice to know someone else also uses ssxsh-technology to its max! :)

Pen-Pen
10th January 2004, 15:11
nice work ! it really comes out really fine ! :)

PS : I love your sign, mf :p

mf
10th January 2004, 15:47
Originally posted by Pen-Pen
PS : I love your sign, mf :p
The worst part is that what NinjaMice says has a root of truth :D.

Soulhunter
10th January 2004, 21:54
Would be even better if there where some filter that does the same as Photoshops "anisotrop-corn/grain-effect" filter !!!

Don't know the right translation for this filter... :D :D :D

But using this in a super-sampled way, would give nice result for toon sources...

Is something like this floating around somewhere ???
Originally posted by Pen-Pen
PS : I love your sign, mf :p
Yeah, but where is your old avatar left ???

Because it was such a cute n' cool one... ;)

Bye

mf
10th January 2004, 22:41
Originally posted by Soulhunter
Yeah, but where is your old avatar left ???
Because it was such a cute n' cool one... ;)
Now it's oddball from Kelly's Heroes. He's about as crazy as me :D.

Soulhunter
10th January 2004, 23:50
But the price for your action figure (http://members.aol.com/kllysite/oddball.html) is a bit insolent... :D :D :D

Mine (http://www.zstore.com/Detail.bok?searchpath=d8c8e065fa01ecfcee9e&keyword=figure&keywordoption=AND&start=129&total=235&no=1286) is cheaper... :p

No, I just really like your old avatar !!! ;)

Bye

mf
11th January 2004, 00:07
Quality comes with a price :D.

Also, Kelly's Heroes is an old movie so action figures are pretty rare. Hence the price.

Soulhunter
11th January 2004, 00:27
Also, Kelly's Heroes is an old movie so action figures are pretty rare. Hence the price.
Hmm... Maybe I should cram out my old He-Man figures from the 80's... :D

So I could buy some more up-to-date toys, like a plasma-TV !!!

Ok, enough fun... Its going a bit off-topic !!!

So...

Does someone know if there is a Avisynth filter that does the same as the Photoshops filter I motioned ???

Bye

mf
11th January 2004, 12:57
Originally posted by Soulhunter
Does someone know if there is a Avisynth filter that does the same as the Photoshops filter I motioned ???
I don't use Photoshop so I wouldn't know.

Soulhunter
12th January 2004, 19:13
Originally posted by mf
I don't use Photoshop...
Not... ??? :scared: :eek: :confused:

Bye

Soulhunter
12th January 2004, 19:28
Between...

As you are some sort kind of SCRIPT MASTER, could you give me some advanced filter combinations (including parameters) to denoise standard PAL movies ???

I usually used TemporalSoften with low values, and the last time I played around with VagueDenoiser...

The results are good for encodes with lowered resolution, but still not perfect for higher resolution... :(

So Im looking for a nice combo-script, that does noise-smoothing (as deen) & noise easing (like TemporalSoften) !!!

Keep detail, but making uniform areas denoised & smooth...

Some advice, GRAND SCRIPT MASTER ???

Tia, Soulhunter

mf
12th January 2004, 19:56
Bending the truth (aka flattering :rolleyes:) won't help you if I don't want to help you, but that's not the case. Have you tried MipSmooth (you mentioned downsizing) ?

Soulhunter
13th January 2004, 19:39
Originally posted by mf
Have you tried MipSmooth (you mentioned downsizing) ?
Will try it... THX !!!

But downsizing... ???

I want to have better results after upsizing !!!

I meant, when I use TemporalSoften for a 16:9 DVD source before downsizing the result is nice...

TemporalSopften(???)
AnyResizer(704,384)

But when I upsize the pictures its only looking ok...

TemporalSopften(???)
AnyResizer(1024,576)

Idear was to upsize only the detail, but not the noise !!!

AnyResizer(1024*4,576*4)
xSharpen(???)
Some sort of noise easing
Some sort of noise-smoothing
AddGrain(???)
AnyResizer(1024,576)

Or does this idear suck to much ???

Bye

mf
13th January 2004, 21:23
Upsize only detail? That's possible. Make an edge mask out of an oversharpened version of the original, and invert it. Resize that to the target size with your fav resizer. Downsize your original and apply your smoother (VagueDenoiser, right?) on it, then upsize to target resolution. Finally upsize your original to the target size with your fav resizer, and then overlay your smoothed version over the resized original with your inverted edge mask.

Soulhunter
14th January 2004, 18:51
Originally posted by mf
Upsize only detail? That's possible. Make an edge mask out of an oversharpened version of the original, and invert it. Resize that to the target size with your fav resizer. Downsize your original and apply your smoother (VagueDenoiser, right?) on it, then upsize to target resolution. Finally upsize your original to the target size with your fav resizer, and then overlay your smoothed version over the resized original with your inverted edge mask.
Uhm... Yeah, thats why I called you GRAND SCRIPT MASTER !!!

Could you give me maybe a short sample script ???

Input=720x576 -> Output=1024x576

Would help much... :)

Bye

mf
14th January 2004, 21:28
Originally posted by Soulhunter
Uhm... Yeah, thats why I called you GRAND SCRIPT MASTER !!!

Could you give me maybe a short sample script ???

Input=720x576 -> Output=1024x576

Would help much... :)

Bye
Study my scripts and/or read MaskTools documentation (MaskTools.txt in the zipfile) :D. Then you'll be a "grand script master" too :).

Soulhunter
15th January 2004, 18:53
Originally posted by mf
Study my scripts and/or read MaskTools documentation (MaskTools.txt in the zipfile) :D.
Common, don't leave me alone with this quest GRAND SCRIPT MASTER !!!

Im not advanced enough to make it working myself... :(

So please, be pity one more time !!!
Originally posted by mf
Then you'll be a "grand script master" too :).
Don't wanna make you rivalry... :D :D :D

Not now... :p


Tia, Soulhunter

mf
15th January 2004, 19:15
Oversharpen: Unsharpmask(200, 0)
Build mask: EdgeMask(3, 255, 255, 255, "sobel", Y=3, U=3, V=3)
Invert mask: Invert()
Resize: LanczosResize(target, target)
Overlay: MaskedMerge(original, smoothed, invertedmask)

That's all you need to know to make the script yourself.

Soulhunter
15th January 2004, 19:37
Big thanks... :)

I will see what I can do with this info !!!

But this will probably need some time...

I post back next weekend...

Hope I get it work !!!

I don't wanna be a bad apprentice... !!!

Bye

Soulhunter
16th January 2004, 20:12
Originally posted by Soulhunter
I post back next weekend...
Or I do it right now... ;)

So, Ive already done "something"...


Original=mpeg2source("F:\DVD Backups\Test.d2v")BicubicResize(1024,576,0,0.5)
Smoothed=mpeg2source("F:\DVD Backups\Test.d2v").BicubicResize(1024,576,0,0.5).mipsmooth()
Invertedmask=mpeg2source("F:\DVD Backups\Test.d2v").Unsharpmask(200, 0).EdgeMask(3, 255, 255, 255, "sobel", Y=3, U=3, V=3).Invert().BicubicResize(1024,576,0,0.5)
MaskedMerge(original, smoothed, invertedmask)

Im not sure if this is what Ive estimate, but its something to start with !!!


Hmm... A good trainee should ask for more advice then !?!

Hope Im not bugging you to much with all this questions... :)

But all info I read up till now is only confusing me !!!

So, I think theres no other way than asking you again... ;)


Question 1. Is this what you meant with your example ???

Question 2a. Can I use this AVS to make a function out of it ???

Question 2a. How to do this ???

Question 3a. How to scale the masking threshold for the 3 masks ???

Question 3b. Is this possible as percentage or 0-255 scale ???

Question 4a. Can I also use more than one "smoothed" mask ???

Question 4b. Have I to use the other masks then also twice ???

Question 5a. Can I use other sharpening filters to make a edge mask ???

Question 5b. Or also more than one edge mask ???

Question 5c. Should I do this ???


One more question...

Something like this seems to work nice when I just wanna remove all the noise...


AnyResizer(1024,576)
mipsmooth(downsizer="bicubic",upsizer="bicubic", scalefactor=0.6, scenechange = 10.0, method = "strong")

But the boundary between the softened part of the picture and the not softened is still annoying... :(

So, is there a way to make some sort of interpolation of this two area's ???

Mean only interpolating the area between them (the boundary) here... ;)

Could I add somehow a simple blur to this area ???


Do you think its time to open a new thread for this stuff... ???


Tia, Soulhunter

mf
16th January 2004, 23:13
Originally posted by Soulhunter
Or I do it right now... ;)

So, Ive already done "something"...


Original=mpeg2source("F:\DVD Backups\Test.d2v")BicubicResize(1024,576,0,0.5)
Smoothed=mpeg2source("F:\DVD Backups\Test.d2v").BicubicResize(1024,576,0,0.5).mipsmooth()
Invertedmask=mpeg2source("F:\DVD Backups\Test.d2v").Unsharpmask(200, 0).EdgeMask(3, 255, 255, 255, "sobel", Y=3, U=3, V=3).Invert().BicubicResize(1024,576,0,0.5)
MaskedMerge(original, smoothed, invertedmask)

Im not sure if this is what Ive estimate, but its something to start with !!!You do realise you're doing the mpeg2source three times, slowing down your script?

Hmm... A good trainee should ask for more advice then !?!
Hope Im not bugging you to much with all this questions... :)
But all info I read up till now is only confusing me !!!
So, I think theres no other way than asking you again... ;)
Question 1. Is this what you meant with your example ???Almost, yeah :). See above.
Question 2a. Can I use this AVS to make a function out of it ???With a little adjustment, sure.
Question 2a. How to do this ???Read my scripts and you will be enlightened.Question 3a. How to scale the masking threshold for the 3 masks ???There is only one mask. There is a bottom clip, a top clip overlayed on it, and a mask. You can use Levels() to change strength etc. Note that mfToon has a lot of those.Question 3b. Is this possible as percentage or 0-255 scale ???Sure. Levels(0, 1.0, 255, 0, [strenght value from 0-255])Question 4a. Can I also use more than one "smoothed" mask ???"smoothed" isn't a mask.
Question 4b. Have I to use the other masks then also twice ???Ditto.
Question 5a. Can I use other sharpening filters to make a edge mask ???Unsharpmask is the strongest and most effective, but yes.Question 5b. Or also more than one edge mask ???Yep, you can multiply or average several masks into one, if you need to.Question 5c. Should I do this ???mfToon does it, but it's up to you to decide if you should too ;).One more question...
Something like this seems to work nice when I just wanna remove all the noise...

AnyResizer(1024,576)
mipsmooth(downsizer="bicubic",upsizer="bicubic", scalefactor=0.6, scenechange = 10.0, method = "strong")

But the boundary between the softened part of the picture and the not softened is still annoying... :(That's because MipSmooth uses thresholds, whereas we use soft masks. (See also HQDering thread and Manao's post and my reply to it)So, is there a way to make some sort of interpolation of this two area's ???Probably. But what we've made up here is already a kind of MipSmooth, just different (and slower :devil:).Mean only interpolating the area between them (the boundary) here... ;)
Could I add somehow a simple blur to this area ???It's certainly not as simple as that.
Do you think its time to open a new thread for this stuff... ???Not until you've got something that really works well :D.

Didée
17th January 2004, 14:27
Originally posted by Soulhunter
But the boundary between the softened part of the picture and the not softened is still annoying...
So, is there a way to make some sort of interpolation of this two area's ???
Mean only interpolating the area between them (the boundary) here...
That's a general problem of almost all smoothers/denoisers.

It's already ages since I proposed that this kind of filters should use *two* thresholds:
[proof] (http://forum.doom9.org/showthread.php?s=&goto&postid=208034#208034)

- threshold 1: apply full filter work up to this value
- threshold 2: "fade out" the filter's work from thresh-1 up to this value

The only filter that does something similar is VagueDenoiser with its "soft thresholding".

- Didée

mf
17th January 2004, 15:01
Originally posted by Didée
The only filter that does something similar is VagueDenoiser with its "soft thresholding".
*cough* mfRainbow
*cough* HQDering

Both use soft masks.

Didée
17th January 2004, 15:23
Yeah, of course. (And you will see some more stuff from me soon, too ;) )

But here, I assumed

dll filter != avs script

K ?

- Didée

mf
17th January 2004, 16:11
Originally posted by Didée
dll filter != avs script
K ?
I feel discriminated :(.


;)

Kurosu
17th January 2004, 17:05
Originally posted by Didée
That's a general problem of almost all smoothers/denoisers.
It's already ages since I proposed that this kind of filters should use *two* thresholds:
[proof] (http://forum.doom9.org/showthread.php?s=&goto&postid=208034#208034)
Dang! Prior art... Do you have any World or France patents, would you sue mf, Manao and/or I, or are we safe? :D
But I guess there are even older propositions of that kind, decades old :p

mf
17th January 2004, 20:40
Originally posted by Kurosu
Dang! Prior art... Do you have any World or France patents, would you sue mf, Manao and/or I, or are we safe? :D
But I guess there are even older propositions of that kind, decades old :p
Actually, before that, a certain vdub filter developer made "Smart Smoother HiQuality", which uses soft masks. Prior prior art :D.

Soulhunter
17th January 2004, 22:06
Originally posted by mf
Read my scripts and you will be enlightened.
I read them... !!!

But I don't feel much enlightened so far... :(

I will take a closer look into them this night !!!
Originally posted by mf
There is only one mask.
Ok, meant the layers here... ;)
Originally posted by mf
"smoothed" isn't a mask.
Its also a layer... Right !?! :D
Originally posted by mf
Not until you've got something that really works well :D.
Ok, Ive made two ugly "denoise" script so far...

Clip1 = mpeg2source("F:\Test.d2v").BicubicResize(1024,576,0,0.5).Temporalsoften(2,3,3,mode=2,scenechange=5)
Clip2 = Clip1.deen().UnsharpMask(50,0)
Clip3 = Clip1.MipSmooth(preset="movieHQ")
Clip4 = Clip1.VagueDenoiser(threshold=0.8,method=1,nsteps=6,chroma= true)
#
A = Layer(clip1.ConvertToYUY2(), clip2.ConvertToYUY2(),"fast")
B = Layer(clip1.ConvertToYUY2(), clip3.ConvertToYUY2(),"fast")
C = Layer(clip1.ConvertToYUY2(), clip4.ConvertToYUY2(),"fast")
#
D1 = Layer(A, B,"fast")
D2 = Layer(A, C,"fast")
D3 = Layer(B, C,"fast")
#
X1 = Layer(D1, D2,"fast")
X2 = Layer(D2, D3,"fast")
#
Z1 = Layer(X1, X2,"fast")
#
Layer(clip1.ConvertToYUY2(), Z1,"fast")

Note: I only used all this layers to make it slower... :D


Ok, here is a second one...

Clip1= mpeg2source("F:\Test.d2v").LanczosResize(1024,576)
Clip2= Clip1.deen()
Blend1= Layer(clip1.ConvertToYUY2(), clip2.ConvertToYUY2(), "fast").ConvertToYV12()
Original= Clip1
Smoothed= Blend1
Invertedmask= Clip1.Unfilter(50,50).Unsharpmask(150, 0).EdgeMask(3, 255, 255, 255, "sobel", Y=3, U=3, V=3).Invert()
MaskedMerge(original, smoothed, invertedmask)

But Im still not sure if they do what I want... :D

Suggestions someone... ???


Tia, Soulhunter

Dreassica
17th January 2004, 23:02
Originally posted by Soulhunter
I read them... !!!

But I don't feel much enlightened so far... :(

I will take a closer look into them this night !!!



look in the beginning of the mftoon avs, the "Function mftoon(..) part is a clue that might help u get "enlightened" ;)

Soulhunter
18th January 2004, 00:15
Originally posted by Dreassica
look in the beginning of the mftoon avs, the "Function mftoon(..) part is a clue that might help u get "enlightened" ;)
Ok, first thing I get when looking to all this parameters is a terrible headache... :p

But after some time I got the feeling to understand it a little bit... :rolleyes:

Or even less than this... !!!

I know, I have to start with something like this...

function SoHuDeNoise

Then I have to add all parameters behind it, I want have access to through the function !?!

When I want to modify the strength of "UnsharpMask" in this exsample...

Clip1 = mpeg2source("F:\Test.d2v")
Clip2 = Clip1.deen().UnsharpMask(50,0)
Layer(clip1.ConvertToYUY2(), clip2.ConvertToYUY2(),"fast")

What should I do then... Something like this... ???

function SoHuDeNoise(clip2, int "UnSharpMask")
UnSharp= UnsharpMask(Unsharp "params")


Would this work in the function then... :confused:

SoHuDeNoise(UnSharp=50,0)


I still don't feel really enlightened... :(

I just feel the headache growing more and more... !!!

Hmm, I hope its not a tumor or something like this... :scared:


Tia, Soulhunter

Soulhunter
18th January 2004, 19:24
Ok, this seems to give a good denoise effect...

Clip1= mpeg2source("F:\Test.d2v")
Clip2= Clip1.BicubicResize(1024,576,0,0.5).Convolution3d("moviehq").deen().Unfilter(50,50).AddGrain(2,0,0)
Layer(clip1.LanczosResize(1024,576).ConvertToYUY2(), clip2.ConvertToYUY2(), "fast")

Not too much, but also not too "less" noise !!!

But Ive only tested this with 2 small sample clips so far... ;)


Next step...

I have to put the "only resize detail" thing into it !!!

Maybe I could do it with the "UnsharpMask" EdgeMask, and maybe a "deen" mask too (like in UnSmooth) ???

Damn, another blend then... :p

And then adding mf's HQDeRing into it... :rolleyes:

Is this some sort of stealing ???

Hope not... :(

Question 1a. Where should I add this ???

Question 1b. How to add... Like this ???

Clip1= mpeg2source("F:\Test.d2v")
thinmask = clip1.msmooth()
enlargedmask = thinmask.blur(1,1).blur(1,1).blur(1,1).blur(1,1).binarize(upper = false, threshold = 1,y=3,u=1,v=1).blur(1,1).blur(1,1).blur(1,1)
filteredclip = clip1.deen()
MaskedMerge(Clip1, filteredclip, enlargedmask)

Question 2a. How bad are all this color conversations ???

Question 2b. Work-around... ???

Question 3a. Where can I find "simple 3d cleaner"... ???

Question 3b. Works it already with double thresholds... ???


Bye

Soulhunter
21st January 2004, 19:37
Hmm, Mug Funky did this (http://forum.doom9.org/showthread.php?s=&threadid=69263)... :D

THX n' Bye

scharfis_brain
21st January 2004, 23:59
Originally posted by Soulhunter
Ok, Ive made two ugly "denoise" script so far...

Clip1 = mpeg2source("F:\Test.d2v").BicubicResize(1024,576,0,0.5).Temporalsoften(2,3,3,mode=2,scenechange=5)
Clip2 = Clip1.deen().UnsharpMask(50,0)
Clip3 = Clip1.MipSmooth(preset="movieHQ")
Clip4 = Clip1.VagueDenoiser(threshold=0.8,method=1,nsteps=6,chroma= true)
#
A = Layer(clip1.ConvertToYUY2(), clip2.ConvertToYUY2(),"fast")
B = Layer(clip1.ConvertToYUY2(), clip3.ConvertToYUY2(),"fast")
C = Layer(clip1.ConvertToYUY2(), clip4.ConvertToYUY2(),"fast")
#
D1 = Layer(A, B,"fast")
D2 = Layer(A, C,"fast")
D3 = Layer(B, C,"fast")
#
X1 = Layer(D1, D2,"fast")
X2 = Layer(D2, D3,"fast")
#
Z1 = Layer(X1, X2,"fast")
#
Layer(clip1.ConvertToYUY2(), Z1,"fast")

Note: I only used all this layers to make it slower... :D


But Im still not sure if they do what I want... :D

Suggestions someone... ???

I've calculated those weights for the clips:

result= (8*clip1 + 3*clip2 + 2*clip3 + 2*clip4) / 15

I don't know whether this was your intention.

Mug Funky
22nd January 2004, 16:31
Originally posted by Soulhunter
Hmm, Mug Funky did this (http://forum.doom9.org/showthread.php?s=&threadid=69263)... :D

THX n' Bye


hehe. glad somebody got a look at it... i'm open to suggestions for defaults that work better, seeing as the values i came up with were for a grainy B&W movie (Dr. Strangelove... total classic). tried it on a homeshot DV movie and it came out gross :eek:. after tweekage it was nice though.

i'm wanting to find a substitutte for the "autogain" part, as i forgot that in dark scenes the grain is amplified HUGELY...

Soulhunter
22nd January 2004, 20:08
Originally posted by scharfis_brain
I've calculated those weights for the clips:

result= (8*clip1 + 3*clip2 + 2*clip3 + 2*clip4) / 15

I don't know whether this was your intention.
My idea was...

Blending two or more different smoothed versions together, should interpolate this damn boundary's !!!

But this works not that good, and its slow too... :(

PS: Read the Note, the long script was not meant that serious... ;)


@Mug Funky

Your script helped me to understand how to do such stuff myself... :D

For this you got the THX in my last post !!!


@mf

- What is it... :confused:

- A bird... ???

- A plande... ???

- No... :eek:

- Its mf's old avatar !!!

- He's back... :cool:

- The PPL applaud... :D :D :D


Bye

FredThompson
2nd November 2005, 10:40
The links for the source images are dead. Does anyone still have these?