Log in

View Full Version : How do I draw vertical and horizontal line across the frame?


lansing
12th December 2017, 10:21
I'm trying to sync 2 videos with different display ratio (16:9 and 4:3) in my editing and I'm having trouble finding the sync point on all vertical and horizontal panning shots. I need guide lines to indicate the center point of the frame, so I need draw a horizontal and vertical line across the middle of the frame to find that point. Right now I'm physically measuring my monitor with a ruler to do this.

Are_
12th December 2017, 13:10
Not the prettiest in the world but in most cases, it should work.


def draw_guide(clip):
h_line = []
h_white = core.std.BlankClip(width=clip.width, height=clip.height/2-1, format=vs.GRAY8, color=255)
h_line.append(h_white)
h_line.append(core.std.BlankClip(width=clip.width, height=2, format=vs.GRAY8, color=0))
h_line.append(h_white)

v_line = []
v_white = core.std.BlankClip(width=clip.width/2-1, height=clip.height, format=vs.GRAY8, color=255)
v_line.append(v_white)
v_line.append(core.std.BlankClip(width=2, height=clip.height, format=vs.GRAY8, color=0))
v_line.append(v_white)

guide = core.std.Expr([core.std.StackVertical(h_line), core.std.StackHorizontal(v_line)], 'x y min')

result = core.std.MaskedMerge(clip, core.resize.Bicubic(guide, format=clip.format), core.std.Invert(guide))

return result

TheFluff
12th December 2017, 14:11
You can also use the vector drawing stuff in the ASS subtitle format for things like these if you want, that's probably easier to deal with. Probably not faster though, but you never know.

lansing
12th December 2017, 16:05
Not the prettiest in the world but in most cases, it should work.


Thanks, it works, that's good enough for me.

StainlessS
12th December 2017, 18:22
A bit OT but related.
In Avisynth, vcMohan has a Grid() function (draws graticule on frame), is quite handy in some circumstances.
I assume that same exists in his VS plugs.

EDIT: Example image here:- https://forum.doom9.org/showpost.php?p=1625126&postcount=90

EDIT: I guess that it could be persuaded to do close to that required in this thread.