08.03.2024, 15:04
Did a few tests, can't beat the cv2 version in speed.
AdaptiveMerge3 can be speed up a bit by using something like
Side note: AdaptiveMerge4 uses different values.
it uses:
hsv[:,:, 2] = value of 'V from HSV' = max(R, G, B)
vs.
PlaneStats(yuv, plane=0) = luma value Y from YUV = 0.299R + 0.587G + 0.114B.
Both are describes as brightness, but represent different things.
Cu Selur
AdaptiveMerge3 can be speed up a bit by using something like
def AdaptiveMerge3(clipa: vs.VideoNode = None, clipb: vs.VideoNode = None, clipb_weight: float = 0.0, luma="limited") -> vs.VideoNode:
yuv = clipb.resize.Bicubic(format=vs.YUV444PS, matrix_s="709", range_s=luma)
yuv = core.std.PlaneStats(yuv, plane=0)
clipb = core.std.CopyFrameProps(clipb, yuv)
#Vapoursynth version
def merge_frame(n, f):
clip1 = clipa[n]
clip2 = clipb[n]
luma = clip2.get_frame(0).props['PlaneStatsAverage']
#vs.core.log_message(2, "Luma(" + str(n) + ") = " + str(luma))
brightness = min(1.5 * luma, 1)
w = max(clipb_weight * brightness, 0.15)
clip3 = vs.core.std.Merge(clip1, clip2, weight=w)
f_out = f.copy()
f_out = clip3.get_frame(0)
return f_out
clipm = clipa.std.ModifyFrame(clips=clipa, selector=merge_frame)
return clipm
clip = AdaptiveMerge3(clip, org, 0.5)
Side note: AdaptiveMerge4 uses different values.
it uses:
hsv[:,:, 2] = value of 'V from HSV' = max(R, G, B)
vs.
PlaneStats(yuv, plane=0) = luma value Y from YUV = 0.299R + 0.587G + 0.114B.
Both are describes as brightness, but represent different things.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.