Created
July 4, 2012 00:16
-
-
Save SAPikachu/3044311 to your computer and use it in GitHub Desktop.
Scenecut glitch detect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raw = last | |
RemoveGrain(mode=19) | |
denoised = last | |
super = MSuper() | |
vectors = MAnalyse(super, isb=false, delta=1, search=5, chroma=false) | |
mask = MMask(vectors,thscd1=100).Grayscale() | |
raw | |
global diff_to_next = denoised.Crop(0, 16, 0, -16).YDifferenceToNext | |
global diff_to_next_top = raw.Crop(0, 0, 0, 8).YDifferenceToNext | |
global prev_diff_from_prev = denoised.DuplicateFrame(0).Crop(0, 16, 0, -16).YDifferenceFromPrevious | |
global prev_diff_from_prev_bottom = raw.DuplicateFrame(0).Crop(0, height-8, 0, 0).YDifferenceFromPrevious | |
global motion_score = mask.AverageLuma | |
Subtitle("Frame: " + string(current_frame)) | |
Subtitle("DifferenceToNext (Main): " + string(diff_to_next), y=20) | |
Subtitle("DifferenceToNext (Top): " + string(diff_to_next_top), y=40) | |
Subtitle("(Prev Frame) DifferenceFromPrevious (Main): " + string(prev_diff_from_prev), y=100) | |
Subtitle("(Prev Frame) DifferenceFromPrevious (Bottom): " + string(prev_diff_from_prev_bottom), y=120) | |
Subtitle("Motion score: " + string(motion_score), y=140) | |
function is_bad_frame(float "opt_out_thresh", float "opt_in_thresh") { | |
opt_out_thresh = Default(opt_out_thresh, 35.0) | |
opt_in_thresh = Default(opt_in_thresh, 1.0) | |
opt_out = motion_score > 50 | |
opt_in = (prev_diff_from_prev_bottom > 5 && prev_diff_from_prev_bottom > prev_diff_from_prev * opt_in_thresh) | |
return opt_in && !opt_out | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment