krieger2005
12th May 2004, 19:02
Hi,
i'm on scripting a function for removing Compression-Artifacts and Noise. I found, as i think, a good variant to do that and want to ask you for your deliverance and proposal.
Here the idea:
1. Creating a blured Movie of the Noise Movie (A movie, where the noise is away but the image is too blured)
2. creating a Mask of areas, where noise is (or Artifacts)
3. Merge the blured Movie into the original-Movie
Script updated: 13.05.2004, 00:26, GMT +1:00
Here my script as long
Function rem(clip c1, clip c2, int b1, int b2, bool debugB, int d1, int d2, bool debugD){
c1
green=ConvertToRGB32.RGBAdjust(0.5,1,0.5,0).ConvertToYV12
white=BlankClip(length=framecount, width=width, height=height,
\ pixel_type="YV12",fps=25,color=$FFFFFF)
diff=YV12Subtract(last,Unfilter(110,110))
maskB=diff.Levels(b1,1,b2,255,235,false).YV12LUT(Yexpr="x 236 < 0 x ?")
bright= debugB == true ? green.MaskedMerge(white,maskB) :
\MaskedMerge(c2, maskB)
bright
green=ConvertToRGB32.RGBAdjust(0.5,1,0.5,0).ConvertToYV12
maskD=diff.Levels(d1,1,d2,75,155,false).YV12LUT(Yexpr="x 76 < 0 x ?")
dark= debugD == true ? green.MaskedMerge(white,maskD) :
\ MaskedMerge(c2, maskD)
return dark
}
Here another version:
function rem(clip c1, clip c2, int b1, int b2, bool debugB, int d1, int d2, bool debugD){
c1
c1Invert=c1.ConvertToRGB32.invert.ConvertToYV12
diff=Subtract(Unfilter(110,110))
maskB=diff.YV12LUT(Yexpr="x "+String(b1)+" < x "+String(b2)+" > | 0 255 ?")
bright="overlay(c2,mask=maskB)"
maskD=diff.YV12LUT(Yexpr="x "+String(d1)+" < x "+String(d2)+" > | 0 255 ?")
dark="overlay(c2,mask=maskD)"
debug = debugB == true ? "maskB" : debugD == true ? "maskD" : ""
out = debug != "" ? "Stackvertical("+bright+"."+dark+", MaskedMerge(c1Invert, "+debug+"))" :
\ bright+"."+dark
return eval(out)
}
I try you to explain:
1.
The First step is to generate a movie, which has no artifacts:
For Exaple:
sauber=ConvertToRGB32._2DClean(0,18,2,2).ConvertToYV12.UnDot.Blur(1).Unfilter(40,40)
2.
In the second step i try to create a mask, where i have highlighted the Artifacts and Noise. To do that i subtract the original-movie from a Oversharped Movie. I get colors which are mostly about 127 (127 means the Colorvalue in Grey). This are the areas, which are alike in the original and the oversharped movie. All areas with different color that 127 (plus/minus X) are Artifacts or Noise (so my theory).
In my Function i make a mask for bright-Noise and one for dark noise. d1,d2 is the Dark Noise (which must be from 127-255), and b1,b2 are Boundaries for Bright Noise (which must be between 0-127).
I build in debugviews for showing bright-noise and dark-noise (debugB and debugD). For my testmovie i use this paramteres:
rem(last,sauber,100,110,false,140,145,false)
Here is the Bright-Noise between 100 and 110 and Dark-Noise is between 140 and 145.
3.
... MaskedMerge
So, what you think about?
Try it!!
Here a sample-capture:
above: After Filter-usage
below: original
http://freehost11.websamba.com/krieger2005/sample.jpg
i'm on scripting a function for removing Compression-Artifacts and Noise. I found, as i think, a good variant to do that and want to ask you for your deliverance and proposal.
Here the idea:
1. Creating a blured Movie of the Noise Movie (A movie, where the noise is away but the image is too blured)
2. creating a Mask of areas, where noise is (or Artifacts)
3. Merge the blured Movie into the original-Movie
Script updated: 13.05.2004, 00:26, GMT +1:00
Here my script as long
Function rem(clip c1, clip c2, int b1, int b2, bool debugB, int d1, int d2, bool debugD){
c1
green=ConvertToRGB32.RGBAdjust(0.5,1,0.5,0).ConvertToYV12
white=BlankClip(length=framecount, width=width, height=height,
\ pixel_type="YV12",fps=25,color=$FFFFFF)
diff=YV12Subtract(last,Unfilter(110,110))
maskB=diff.Levels(b1,1,b2,255,235,false).YV12LUT(Yexpr="x 236 < 0 x ?")
bright= debugB == true ? green.MaskedMerge(white,maskB) :
\MaskedMerge(c2, maskB)
bright
green=ConvertToRGB32.RGBAdjust(0.5,1,0.5,0).ConvertToYV12
maskD=diff.Levels(d1,1,d2,75,155,false).YV12LUT(Yexpr="x 76 < 0 x ?")
dark= debugD == true ? green.MaskedMerge(white,maskD) :
\ MaskedMerge(c2, maskD)
return dark
}
Here another version:
function rem(clip c1, clip c2, int b1, int b2, bool debugB, int d1, int d2, bool debugD){
c1
c1Invert=c1.ConvertToRGB32.invert.ConvertToYV12
diff=Subtract(Unfilter(110,110))
maskB=diff.YV12LUT(Yexpr="x "+String(b1)+" < x "+String(b2)+" > | 0 255 ?")
bright="overlay(c2,mask=maskB)"
maskD=diff.YV12LUT(Yexpr="x "+String(d1)+" < x "+String(d2)+" > | 0 255 ?")
dark="overlay(c2,mask=maskD)"
debug = debugB == true ? "maskB" : debugD == true ? "maskD" : ""
out = debug != "" ? "Stackvertical("+bright+"."+dark+", MaskedMerge(c1Invert, "+debug+"))" :
\ bright+"."+dark
return eval(out)
}
I try you to explain:
1.
The First step is to generate a movie, which has no artifacts:
For Exaple:
sauber=ConvertToRGB32._2DClean(0,18,2,2).ConvertToYV12.UnDot.Blur(1).Unfilter(40,40)
2.
In the second step i try to create a mask, where i have highlighted the Artifacts and Noise. To do that i subtract the original-movie from a Oversharped Movie. I get colors which are mostly about 127 (127 means the Colorvalue in Grey). This are the areas, which are alike in the original and the oversharped movie. All areas with different color that 127 (plus/minus X) are Artifacts or Noise (so my theory).
In my Function i make a mask for bright-Noise and one for dark noise. d1,d2 is the Dark Noise (which must be from 127-255), and b1,b2 are Boundaries for Bright Noise (which must be between 0-127).
I build in debugviews for showing bright-noise and dark-noise (debugB and debugD). For my testmovie i use this paramteres:
rem(last,sauber,100,110,false,140,145,false)
Here is the Bright-Noise between 100 and 110 and Dark-Noise is between 140 and 145.
3.
... MaskedMerge
So, what you think about?
Try it!!
Here a sample-capture:
above: After Filter-usage
below: original
http://freehost11.websamba.com/krieger2005/sample.jpg