Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd July 2022, 15:18   #1  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
CropRel as lines ? How to draw a line?

Hi,
I'd like to have a small function wrapper for CropRel, with a 'show'-parameter which would simply show the lines of a rectangle instead of actually cropping,....
Code:
function ShowWrapCropRel(cllip: vs.VideoNode, left: int=0, top: int=0, right: int=0, bottom: int=0, show: bool:False) -> vs.VideoNode:
  if show:
    return core.std.CropRel(clip=clip, left=2, right=2, top=2, bottom=2) 
  else:
   # no 'good' idea, how to do it #
Only think that pops to mind would be to create a line horizontal (bright green) Blankclip and another verical (bright green) Blankclip and then use havsfunc.Overlay to overlay the lines on the frame.
-> There must be an easier way to do this right?

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 3rd July 2022, 15:46   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Your idea sounds easy enough...
Alternative, but very similar to your approach https://forum.doom9.org/showthread.php?t=175105
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 3rd July 2022, 16:13   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Okay, thought there ought to be something easier / more straight forward.
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 3rd July 2022, 16:25   #4  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
https://github.com/kewenyu/VapourSynth-Draw that might work, if I can figure out an expression for this,...
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 3rd July 2022, 17:12   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Okay, my idea with the BlankClip runs into a few hurdles.
can't make a YUV420 BlankClip with width or height = 1
and
Code:
left = 0
top = 0
right = 0
bottom = 0
clipHline = core.std.BlankClip(clip=clip, width=2)
clipVline = core.std.BlankClip(clip=clip, height=2)
clip = havsfunc.Overlay(base=clip, overlay=clipHline, x=left)
clip = havsfunc.Overlay(base=clip, overlay=clipHline, x=clip.width-right)
clip = havsfunc.Overlay(base=clip, overlay=clipVline, y=top)
clip = havsfunc.Overlay(base=clip, overlay=clipVline, y=clip.height-bottom)
also fails with:
Code:
vapoursynth.Error: Crop: negative/zero cropping dimensions not allowed
since Overlay also uses Crop 'overlay = overlay.std.Crop(left=cl, right=cr, top=ct, bottom=cb)'
-> not as easy as expected, so if anyone has a working idea please let me know.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 3rd July 2022, 18:02   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I dont speak VS, nor Parsel Tongue,
but you are aware that YUV420 has chroma of 2x2,
You might be able to use instead YV24,and overlay that [just my 2 pence worth].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 3rd July 2022, 18:45   #7  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 87
We can do something like this with Expr: https://slow.pics/c/LqCioXbX

Code: https://gist.github.com/dnjulek/6990...6b411b9e778d9d
__________________
CPU: AMD 3700X | GPU: RTX 3070Ti | RAM: 32GB 3200MHz
GitHub

Last edited by Julek; 3rd July 2022 at 18:47.
Julek is offline   Reply With Quote
Old 4th July 2022, 04:52   #8  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Nice! Thanks a lot!
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 4th July 2022, 15:28   #9  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,554
If speed isn't a big issue I'd do it with ModifyFrame and modify the pixels with python directly.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.