Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th January 2012, 21:51   #41  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
It seems that i have a problem with color space conversion, regarding the LCE function. From YUY2 to RGB, this still creates an error "Assertion failed" in player2.

I installed the Huffyuv (without restart) but the inf file register it...
lisztfr9 is offline   Reply With Quote
Old 31st January 2012, 15:27   #42  |  Link
travolter
Registered User
 
Join Date: Apr 2009
Posts: 138
Quote:
Originally Posted by Didée View Post
Something to play with - the "nonlinear" sharpening from SeeSaw, just with a wide-range gaussian instead of a small-range kernel.

Code:
z   = 6    #  z = zero point
p   = 1.6  #  p = power
str = 1.0  #  str = strength
rad = 9.0  #  radius for "gauss"

o = last
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(p)+" / ^ "+string(z)+" * "+string(str)+" * x y - x y - abs 0.001 + / * +",U=2,V=2)

interleave(o,last)
wow Didée!! fantastic!!!!
I was playing with the script.. and it gives very nice results.

1) original

2) 0.5/1.0/0.2/120.0

3) 6.0/1.6/1.0/8.0



How could I clean these little color blocks/artifacts that appear in the walls of 3rd image?.
I always have the same problem when using contrastmask scripts in HD movies.
A solution is not abuse of the effect.. but I wonder If I can clean the source in certain way to avoid the atifacts
travolter is offline   Reply With Quote
Old 1st February 2012, 13:18   #43  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Seesaw

Hi Didée,

This is a lot to learn as a scripting language (also i can't find some good tutorial...).

I tried this :

function sharpen2(clip)

{
z = 6 # z = zero point
p = 1.6 # p = power
str = 1.0 # str = strength
rad = 9.0 # radius for "gauss"

o = last
g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(p)+" / ^ "+string(z)+" * "+string(str)+" * x y - x y - abs 0.001 + / * +",U=2,V=2)

interleave(o,last)
}


sharpen2()

========================


Error on width, - "invalid argument for function width", even if i add width = 5

Avisynth version = 2.58
therefor i choose an old version of mt_masktools2, because the last one needs 2.6

Thanks, L
lisztfr9 is offline   Reply With Quote
Old 1st February 2012, 13:24   #44  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
lost in code

Hi

Yes it looks fantastic, but could you help me to get it work ?

thanks so much, this is an amazing function !!

L
lisztfr9 is offline   Reply With Quote
Old 1st February 2012, 14:09   #45  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Didée's fragment is meant to be used in a context where 'last' is defined.
In your function, replace 'o=last' by 'o=clip', or add 'clip' on a line by itself just before that.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 1st February 2012, 14:30   #46  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
@ travolter

Well, it's tricky. The best way to "not overdo" the effect is .... to not overdo the effect.

It could help to use some "parallel-path denoising", see here. Though, it depends on the temporal characteristic of those unwanted spots. If they are fluctuating, good. If they are persistent/static, bad luck.

It would also help to use stronger low-damping (not parametrized, it's the "0.001 +" term in the lut that would need to be increased). However, while this will reduce emphasizing of unwanted spots, it necessarily will also reduce the emphasizing of spots where the effect is actually welcome. Old story: there is a small pixel variation. Is it noise? Is it detail? Simple algorithms can't tell -- it's just that: a small pixel variation.


@ lisztfr9

Code:
function NonlinUSM(clip o, float "z", float "pow", float "str", float "rad", float "ldmp")
{
z   = default(z,   6.0)  # zero point
pow = default(pow, 1.6)  # power
str = default(str, 1.0)  # strength
rad = default(rad, 9.0)  # radius for "gauss"
ldmp= default(ldmp, 0.001) # damping for verysmall differences

g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0)

mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(pow)+" / ^ "+string(z)+" * "+string(str)+
 \                        " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +",U=2,V=2)

#interleave(o,last) # just for visualisation, you don't want the function to do this

return(last)
}
Note that I renamed the function to "NonlinUSM" (for "non-linear Unsharp Masking"). The name in itself doesn't matter, you could as well name it MickeyMouse() or BlueElephant() if you wanted. But since the function "sharpen2" is already used in SeeSaw, it seems better to use any other name, in order to avoid possible conflicts.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 1st February 2012 at 15:44.
Didée is offline   Reply With Quote
Old 1st February 2012, 15:28   #47  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
NonlinUSM

I get this now :

http://cjoint.com/12fe/BBbpwQ9ZyDT.htm

there was a small error, by the way,

\ " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" / * x y - x y - abs 0.001 + / * +",U=2,V=2)

==============================

color-space YV12(), it seems to work

L
lisztfr9 is offline   Reply With Quote
Old 1st February 2012, 15:43   #48  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Oops, yes, there was a "+" missing. But your fix is also wrong.
Code:
My fault   " * x y - 2 ^ x y - 2 ^ "+string(ldmp)" + / * x y - x y - abs 0.001 + / * +"
                                                ^^

Your fault " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" / * x y - x y - abs 0.001 + / * +"
                                                  ^^ 

Correct    " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +"
                                                 ^^^^
Function in previous post has been corrected.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 1st February 2012, 19:47   #49  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
fine !

I have got it to work on the video i want to convert.

The colors seems more saturated, but in another way that would be provided by colormil (VD), more neutral, and better imho.

This is a Local contrast enhancement filter, witch is very often my preferred image processing method... it should be used with very large radius, like 50 :

http://gimpguru.org/tutorials/removinghaze/

"Set the Radius parameter to a largish, seemingly unreasonable value somewhere between 50 and 100."
lisztfr9 is offline   Reply With Quote
Old 1st February 2012, 22:28   #50  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
http://cjoint.com/12fe/BBbwsW6v5pi.htm

I would like to remove the dark lines around the white neckties in this movie. Any suggestion ?

I open the video in VD, then frameserve to avisynth, to finally convert in Winff.

So your function Didée does sharpening and Contrast enhancement. So i have this enabled along with cnr2(), and in VD i desinterlace, crop, and reduce a little the high levels... If you have any better idea ?

Sharpening with contrast mask will only underline the neckties and they are already so dam white. Previously i used internal sharpening from VD. Maybe the source is too bad.
lisztfr9 is offline   Reply With Quote
Old 2nd February 2012, 00:46   #51  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by lisztfr9 View Post
http://cjoint.com/12fe/BBbwsW6v5pi.htm

I would like to remove the dark lines around the white neckties in this movie. Any suggestion ?

Previously i used internal sharpening from VD
Don't sharpen so much, but you can try dehalo filters e.g. dehalo_alpha

http://avisynth.org/mediawiki/Extern...ters#Dehaloing
poisondeathray is offline   Reply With Quote
Old 2nd February 2012, 11:32   #52  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Quote:
Originally Posted by poisondeathray View Post
Don't sharpen so much, but you can try dehalo filters e.g. dehalo_alpha

http://avisynth.org/mediawiki/Extern...ters#Dehaloing
Hi,

I agree for reducing the sharpening very often... for example unsharp mask in VD, this creates a lot of artifacts along edges, so i go back to moderated sharpen (internal).

Here is the original :

http://cjoint.com/12fe/BBclwfwaQAR.htm

===============================

I'm trying Dehalo_alpha, it needs the expand function. It is part from mastools, but i have all of them...

Ok, i have them all. This begins to wear my cpu (E8400)

At a first glance it's very impressive ! It does something on that nasty artifact, - i would never thought it was possible to reduce them ! Thanks very much for your work guys, and support !

Last edited by lisztfr9; 2nd February 2012 at 11:48. Reason: first impression
lisztfr9 is offline   Reply With Quote
Old 17th February 2012, 11:46   #53  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
VirturaldubMod

Now using VirturaldubMod to be able to "play" with the scripts... to fine tune them.

Before i used VD with dmpgdec & Vfapi...

http://www.animemusicvideos.org/guid...ppvdubmod.html

http://docs.gimp.org/en/gimp-imaging...ng-photography

Equalize does a nice effect.

Last edited by lisztfr9; 17th February 2012 at 11:47. Reason: wrong url
lisztfr9 is offline   Reply With Quote
Old 24th February 2012, 10:13   #54  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
Hi lisztfr9!
Quote:
Originally Posted by lisztfr9 View Post
I have got it to work on the video i want to convert.

The colors seems more saturated, but in another way that would be provided by colormil (VD), more neutral, and better imho.

This is a Local contrast enhancement filter, witch is very often my preferred image processing method... it should be used with very large radius, like 50 :

http://gimpguru.org/tutorials/removinghaze/

"Set the Radius parameter to a largish, seemingly unreasonable value somewhere between 50 and 100."
It is can implement with Avisynth

Code:
ColorYUV(autogain=true, autowhite=true)
unsharp(varY=15,varC=15,strength=1.0)# tritical variableblur revision
I try with my VHS capture source and see improvements.
yup.
yup is offline   Reply With Quote
Old 29th February 2012, 06:32   #55  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
Hi all!
I suggest variance value relative low for this purpose.
I try find relation between radius for Gaussian blur and variance, i find two approaches:
from Gimp
sigma=(radius+1)/sqrt(2*log10(255))
variance=sigma^2=(radius+1)^2/(2*log10(255))
from common knowledge about normal distribution
3*sigma=radius
variance=radius^2/9
Both give higher value variance for local contrast enhancement from 250 to 2000 and for this value I see increase contrast even at strength 0.4.
Please confirm my calculations.
yup.
yup is offline   Reply With Quote
Old 16th April 2012, 09:57   #56  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
(OT)

Hi guys,

I have a video with so many problems (VHS record) :

1) The video jerks vertically. It's unstable vertically
2) There is a echo artifact, in form of a white strip (could be blend out with some alpha blending).
3) There is also some flickering, sometimes : the luminescence quickly changes...

not mention awful chroma noise, etc.

Could the flickering be stabilized with some conditional scripting based on luma ?

Anyway this is OT, i will open new thread for healing this video.
lisztfr9 is offline   Reply With Quote
Old 16th April 2012, 13:19   #57  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Quote:
Originally Posted by lisztfr9 View Post
(OT)

Hi guys,

I have a video with so many problems (VHS record) :

1) The video jerks vertically. It's unstable vertically
2) There is a echo artifact, in form of a white strip (could be blend out with some alpha blending).
3) There is also some flickering, sometimes : the luminescence quickly changes...

not mention awful chroma noise, etc.

Could the flickering be stabilized with some conditional scripting based on luma ?

Anyway this is OT, i will open new thread for healing this video.

Hi all,

I already found some virtualdub filters for healing the flickering and the image shaking, Defliker and deshaker, but remains one nasty artifact, like here :

http://cjoint.com/12av/BDqolUo6ves.htm

How would you handle this ? subtracting a mask from the image, - but any advice would be thankfully taken. Also a good tutorial explaining avisynth scripting...

Maybe building on-the-fly the mask from the black strip donwside...

Thanks, L

Last edited by lisztfr9; 16th April 2012 at 13:19. Reason: spelling error
lisztfr9 is offline   Reply With Quote
Old 20th April 2012, 04:00   #58  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
in the HighlightLimiter script in post #28, smode was deleted from the newer version of SmoothLevels
lansing is offline   Reply With Quote
Old 14th May 2012, 16:08   #59  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
So the current latest version of HighlightLimiter is the one on post 28 and the latest version of ContrastMask is on the OP, right? Also, is ContrastMask supposed to be obsolete with the latest HighlightLimiter?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Old 16th May 2012, 12:13   #60  |  Link
javlak
Registered User
 
Join Date: Mar 2011
Posts: 48
Hi everyone,

Unfortunately my time is extremely limited so I don't have too much time to work on these scripts. Please feel free to adjust/develop/change them to fit your needs.

To answer your question Chainmax, ContrastMask has different functionality in the sense that it is purely a contrast mask, while the Highlight/HighlightLimiter functions do things a bit differently. You can see the differences in the posts made by travolter. I guess what I'm trying to say is that if you are looking for a contrast mask to see how it affects your picture, then ContrastMask is what you're looking for. Otherwise you can call it obsolete. These are the versions I have on my PC (and indeed they were written for SmoothLevels 1.x, the smode bit should be removed for SmoothLevels 2.x, but I think the end result might vary a bit so it might need some tweaking in that respect):

Code:
function HighlightLimiter(clip v, float "gblur", bool "gradient", int "threshold", bool "twopass", int "amount", bool "softlimit", int "method")
{
gradient = default (gradient,true) #True uses the gaussian blur to such an extent so as to create an effect similar to a gradient mask being applied to every area that exceeds our threshold.
gblur = (gradient==true) ? default (gblur,100) : default (gblur,5.0) #The strength of the gaussian blur to apply. 
threshold = default (threshold,150) #The lower the value, the more sensitive the filter will be.
twopass = default (twopass,false) #Two passes means the area in question gets darkened twice. 
amount = default (amount,10) #The amount of brightness to be reduced, only applied to method=2
softlimit = default (softlimit,false) #If softlimit is true, then the values around the edges where the pixel value differences occur, will be averaged.
method = default (method, 1) #Method 1 is multiply, the classic HDR-way. Any other method set triggers a brightness/gamma approach.

amount = (amount>0) ? -amount : amount

darken=v.Tweak(sat=0).mt_lut("x "+string(threshold)+" < 0 x ?")
blurred= (gradient==true) ? darken.gaussianblur(gblur).gaussianblur(gblur+100).gaussianblur(gblur+200) : darken.gaussianblur(gblur)
fuzziness_mask=blurred.mt_edge(mode="prewitt", Y=3, U=2, V=2).mt_expand(mode="both", Y=3, U=2, V=2)
multiply = (method==1) ? mt_lut(v,"x x * 255 /") : v.Tweak(bright=amount)
multiply = (method==1) ? eval("""
(twopass==true) ? mt_lutxy(multiply,v,"x y * 255 /") : multiply""") : eval("""
(twopass==true) ? multiply.SmoothLevels(gamma=0.9,smode=2) : multiply""")

merged=mt_merge(v,multiply,blurred)
fuzzy= (softlimit==true) ? mt_merge(merged,mt_lutxy(v,merged,"x y + 2 /"),fuzziness_mask) : merged
return fuzzy
}
Code:
function Highlighter(clip v, float "gblur", bool "gradient", int "threshold", bool "twopass", int "amount", bool "softlimit", int "method")
{
gradient = default (gradient,true)
gblur = (gradient==true) ? default (gblur,100) : default (gblur,5.0) 
threshold = default (threshold,100) #The lower the value, the more sensitive the filter will be.
twopass = default (twopass,false)
amount = default (amount,10)
softlimit = default (softlimit,false)
method = default (method, 1)

amount = (amount<0) ? abs(amount) : amount

lighten=v.Tweak(sat=0).mt_lut("x "+string(threshold)+" > 0 x ?")
blurred= (gradient==true) ? lighten.gaussianblur(gblur).gaussianblur(gblur+100).gaussianblur(gblur+200) : lighten.gaussianblur(gblur)
fuzziness_mask=blurred.mt_edge(mode="prewitt", Y=3, U=2, V=2).mt_expand(mode="both", Y=3, U=2, V=2)
photoshop_overlay = (method==1) ? mt_lutxy(v,blurred.invert(),"x 127.5 > y 255 x - 127.5 / * x 255 x - - + y x 127.5 / * ? ") : \
                    (method==2) ? mt_lutxy(v,blurred.invert(),"255 255 x - 255 y - * 255 / -") : v.Tweak(bright=amount)
photoshop_overlay = (twopass==true) ? photoshop_overlay.SmoothLevels(gamma=2.0,smode=2) : photoshop_overlay
merged=mt_merge(v,photoshop_overlay,blurred)
fuzzy= (softlimit==true) ? mt_merge(merged,mt_lutxy(v,merged,"x y + 2 /"),fuzziness_mask) : merged
return fuzzy
}

Last edited by javlak; 16th May 2012 at 13:35. Reason: PEBCAK
javlak is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.