Log in

View Full Version : Soft edges mask


anton_foy
20th March 2017, 21:02
Hello!
Ive been using this lately, to dehalo only bright areas and then add a Glow-filter but it shows hard edges around the areas where the glow mask is applied:

#####OLD SCRIPT#####
input=FFmpegSource2("B:\4k_tester\C0148.mp4")

#Dehalo-highlights
mp1 = yv12lutxy(last, last, "x 230 - 255 *", u=3, v=3) #229 - 255
mp2 = mp1.expand.expand.expand.expand.expand
mp3 = yv12lutxy(mp1, mp2, "y x -", u=3, v=3)
maskedmerge(last, dehalo_alpha(last, rx=1.5, ry=1.5), mp3) #(last, rx=5, ry=5)

#GLOW
converttorgb32()
RED=ShowRed(Pixel_Type="Y8").GlowRGB(min=240, max=255)
GRN=ShowGreen(Pixel_Type="Y8").GlowRGB(min=236, max=255)
BLU=ShowBlue(Pixel_Type="Y8").GlowRGB(min=236, max=255)
MergeRGB(RED,GRN,BLU,pixel_Type="rgb32")


EDIT UPDATE:

I replaced the previous with a mod of one of Dideé's old scripts, here is the new full script:

#####NEW SCRIPT#####

input=FFmpegSource2("B:\4k_tester\C0148.mp4")

#Dehalo-highlights-improved
LO = string( 255 )
HI = string( 220 )
darkmask = input.yv12lut("x "+HI+" > 255 x "+LO+" < 0 255 x "+HI+" - 255 "+LO+" "+HI+" - / * - ? ?")
darkmask = darkmask.expand.expand.expand.expand.expand.FitY2UV().fastgaussblur(20)
dark_filter = input.dehalo_alpha(rx=3, ry=3, darkstr=1.4, brightstr=0.0, lowsens=100, highsens=10, ss=0.8)
MaskedMerge(input, dark_filter, darkmask, U=3,V=3)

#GLOW
ConvertToRGB32()
RED=ShowRed(Pixel_Type="Y8").GlowRGB(min=240, max=255)
GRN=ShowGreen(Pixel_Type="Y8").GlowRGB(min=236, max=255)
BLU=ShowBlue(Pixel_Type="Y8").GlowRGB(min=236, max=255)
MergeRGB(RED,GRN,BLU,pixel_Type="rgb32")


They both work great each on their own BUT together they create hard edges like a mask (due to a luma shift between yv12/rgb?). Would it solve the problem to use
rgblut instead of yv12lut perhaps?
I still don't know how to correct this...any thoughts?

Thanks!


Image of the artifacts, zoomed in and cropped:
http://i63.tinypic.com/313he6q.jpg