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. |
|
|
Thread Tools | Search this Thread | Display Modes |
14th January 2019, 20:39 | #1 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
warp - geometry correction with control points (also includes new version of quad)
warp v0.1 <- click here, it's a link! warp is a geometry correction filter which uses control points and a thin plate spline (as used in morphing) to correct or distort a video's geometry. I have no idea if anyone is going to find this useful. Documentation (such as it is), examples, and source are included. The same DLL also provides a new version of quad which supports more colour spaces (all the "classic" ones, plus 8-bit planar RGB). x86 and x64 DLLs, both static and dynamically linked, are provided. SSE2 is definitely required, possibly SSE3. Sorry, luddites! It's so fancy it even has its own demo/tutorial video: https://www.youtube.com/watch?v=SG1eex7HmLM Recommended companion software: Hugin Code:
warp (v0.1) =========== A collection of geometry correction filters using control points, specified either as a list of numbers, a string, or with a Hugin project file (see http://hugin.sourceforge.net/) (c) David Horman, 2019 Description =========== warp takes a list of control points - pairs of image coordinates - and warps the input video using a thin plate spline (as used in morphing) such that the coordinates of the first point in a pair are moved to the position of the second point in the pair, with the rest of the image distorted as smoothly as possible. Control points are specified either directly as filter parameters, or as a whitespace- and/or comma-separated string, or by passing the filename of a Hugin project file (.pto). A separate guide to creating a warp-compatible Hugin project is included. quad is a reimplentation of my old quad filter. It remaps an image based on one or two specified quadrilaterals. warp_series takes map frames generated by warp and uses them as animation keyframes, blending them to provide smooth transitions between warps. warp_grid is a helper filter which draws a grid on a video clip. Please refer to the individual documentation files for usage and parameters. Last edited by wonkey_monkey; 14th January 2019 at 23:35. |
14th January 2019, 21:10 | #2 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Nice, thanks! I will test drive it
I was just going to ask about alignment options in avisynth; something similar to hugin or photoshop autoalign with perspective and warping corrections instead of just global frame translation/rotations |
14th January 2019, 22:40 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Lovely WonkyWilly,
Maybe point out availability [EDIT: Where to get the plug] via your sig (took me bout 40 -> 60 seconds to figure it out).
__________________
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 ??? Last edited by StainlessS; 14th January 2019 at 23:10. |
14th January 2019, 23:10 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Aha, the link is the enourmous warp v0.1 below the top image, me is a dick
__________________
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 ??? Last edited by StainlessS; 14th January 2019 at 23:14. |
15th January 2019, 17:45 | #6 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Works great. Nice video tutorial
When combined with gmic clut method , it's a power color matching technique . The benefit is you can use the BD chroma (or other src image) resolution . It's a bit colourlike on steroids. Results are better than some commercial color matching plugins and workflows. The negatives are the workflow is a bit clunky and requires per scene matching https://forum.doom9.org/showthread.p...94#post1862294 The haldclut => cube conversion can be done with python script instead of the one suggested in that thread. It's faster/easier , batchable and the crc check is the same. LUT-Convert-master https://github.com/mikeboers/LUT-Convert Since it's python based, it makes me wonder if it could be made adaptable to vapoursynth Perhaps out of the scope of this plugin discussion - While manual control point is great for accuracy and fine tuning - I'd like to see some way of auto matching possibilities - are you aware of any ? The hugin bundled ones aren't that great . eg. Are there any FOSS engines that hugin can use externally ? Even if it's a rough control point auto layout matching generation, it would reduce the amount of manual fine tweaking later I'm wondering if this can somehow be used/incorporated into the autooverlay plugin . It "feels" like a powerful pairing in the making https://forum.doom9.org/showthread.php?t=175247 |
15th January 2019, 20:12 | #7 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Yeah, I was disappointed with Hugin's automatic control point thing as well. Firstly, it works better if the videos are the same resolution - and it's probably not a terrible idea to NNEDI the DVD footage first, before trying to match it to Bluray footage. Secondly, I think all such control point finders (Autopano is another) are optimised for matching photos from the same set, rather than different quality/colour footage like this. And thirdly, I expect it's ultimately an intractable problem anyway, in that you can never guarantee you won't get bad control points.
Hugin also has a fine tune for control points, but I also had problems with that (I mention it at the same start of the video, but in the end I didn't bother expanding on it). Maybe something can be done with mvtools, using large block sizes and filtering for good/consistent vectors. Last edited by wonkey_monkey; 15th January 2019 at 20:15. |
17th January 2019, 21:13 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Welcome to the forum Wonkey, I'm sure that you will find it a non stressful place where you can expend lots of decades.
EDIT: You got Wonkey Monkey . com, be quick else you got squatters to eradicate. [hitmen are expensive, or so I've been told]
__________________
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 ??? Last edited by StainlessS; 17th January 2019 at 21:34. |
20th January 2019, 15:00 | #9 | Link |
Registered User
Join Date: Apr 2010
Posts: 9
|
Thank you. This is great.
The biggest problem I have at the moment, is that it sometimes fails silently. i.e. Nothing happens, there's no error message, and debug=WARP_DEBUG_ISOMAP returns a completely black image This happens when the pto-file doesn't exist, but also when the file actually exists. I'm not sure if warp for some reason is unable to open the file, or if there's something in the file that causes warp() to croak. If I copy the points from the file manually, warp() works as expected. |
25th January 2020, 14:20 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Wonkey,
A few probs in docs for warp and quad. from quad,.txt Code:
warp( (clip) (floats) (optional) (string) string (optional) (bool) swap = false (bool) relative = false (bool) pto_resize = true (int) resample = WARP_BICUBIC = 2 (int) quality = 6 (float) scale = 1 (float) scalex = 1 (float) scaley = 1 (float) scale1 = 1 (float) scalex1 = 1 (float) scaley1 = 1 (float) scale2 = 1 (float) scalex2 = 1 (float) scaley2 = 1 (clip) overlay = NULL (int) overlay_threshold = 0 (int) threads = 0 (automatic) (bool) interleaved = false (int) debug = 0 (int) map = [undefined] ) Code:
quad( # Wrong name, was warp (clip) (floats) (optional) (string) string (optional) (float) strength = 1.0 # Missing from description (also no documentation) (bool) swap = false (bool) normal = true # Missing from description (also no documentation) (bool) relative = false (bool) pto_resize = true (int) resample = WARP_BICUBIC = 2 # EDIT: Maybe should be QUAD_BICUBIC (int) quality = 6 (float) scale = 1 (float) scalex = 1 (float) scaley = 1 (float) scale1 = 1 (float) scalex1 = 1 (float) scaley1 = 1 (float) scale2 = 1 (float) scalex2 = 1 (float) scaley2 = 1 (clip) overlay = NULL (int) overlay_threshold = 0 (int) threads = 0 (automatic) (int) map = [undefined] # Wrong order (bool) interleaved = false # Wrong order (int) debug = 0 # Wrong order ) Extracted prototypes Code:
warp_ORDERED_Function_List There follows a list of all function names together with CPP style argument specifiers that inform Avisynth the argument types and optional names. Optional arguments have square brackets surrounding their name as in [name] and are followed by a type specifier character that gives the type. Unnamed arguments are not optional. eg "cc[arg1]b[arg2]i" would be two compulsory unnamed clip args, followed by optional 'arg1' of type bool and optional 'arg2' of type int. # Argument type specifier strings. c - Video Clip i - Integer number f - Float number s - String b - boolean . - Any type (dot) # Array Specifiers i* - Integer Array, zero or more i+ - Integer Array, one or more .* - Any type Array, zero or more .+ - Any type Array, one or more # Etc ################################### BICUBIC "" BILINEAR "" DEBUG_GRID "" DEBUG_ISOMAP "" DEBUG_MARKERS "" DEBUG_OVERLAY "" DRAFT "" grid "c[size]i[darken]f[colour]i" LINEAR "" quad "cf*[string]s[strength]f[swap]b[normal]b[relative]b[pto_resize]b[resample]i[quality]i[scale]f[scalex]f[scaley]f" "[scale1]f[scalex1]f[scaley1]f[scale2]f[scalex2]f[scaley2]f [overlay]c[overlay_threshold]i[threads]i[map]i[interleaved]b[debug]i" QUAD_BICUBIC "" QUAD_BILINEAR "" QUAD_DEBUG_GRID "" QUAD_DEBUG_ISOMAP "" QUAD_DEBUG_MARKERS "" QUAD_DEBUG_OVERLAY "" QUAD_DRAFT "" rekey "ci" series "cc+i*[resample]i[quality]i[transition]i[overlay]c[overlay_threshold]i[threads]i[debug]i" SINE "" warp "cf*[string]s[strength]f[swap]b[normal]b[relative]b[pto_resize]b[resample]i[quality]i[scale]f[scalex]f[scaley]f" "[scale1]f[scalex1]f[scaley1]f[scale2]f[scalex2]f[scaley2]f[overlay]c[overlay_threshold]i[threads]i[map]i[interleaved]b[debug]i" WARP_BICUBIC "" WARP_BILINEAR "" WARP_DEBUG_GRID "" WARP_DEBUG_ISOMAP "" WARP_DEBUG_MARKERS "" WARP_DEBUG_OVERLAY "" WARP_DRAFT "" warp_grid "c[size]i[darken]f[colour]i" WARP_LINEAR "" warp_rekey "ci" warp_series "cc+i*[resample]i[quality]i[transition]i[overlay]c[overlay_threshold]i[threads]i[debug]i" WARP_SINE "" Code:
warp( (clip) (clips) (floats) (optional) # Is Int (providing floats would produce error) (string) string (optional) # Dont exist (int) resample = WARP_BICUBIC = 2 (int) quality = 6 (int) transition = WARP_LINEAR = 0 (clip) overlay = NULL (int) overlay_threshold = 0 (int) threads = 0 (automatic) (int) debug = 0 ) warp_series "cc+i*[resample]i[quality]i[transition]i[overlay]c[overlay_threshold]i[threads]i[debug]i" Code:
warp( (clip), (int) ) warp_rekey "ci" EDIT: Might want to note possible conflict with V.C Mohan Grid() plugin.
__________________
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 ??? Last edited by StainlessS; 25th January 2020 at 16:13. |
25th January 2020, 19:34 | #14 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
I beg to differ, see the prototypes extracted from the dll. (2 posts previous) Edit: doin' the docs is the best part of coding.
__________________
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 ??? Last edited by StainlessS; 25th January 2020 at 19:58. |
|
25th January 2020, 21:03 | #16 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
This is a very interesting method of color matching (more like chroma swapping) that relies solely on the quality of the warping. In perfect warped results, this method can achieved 100% accuracy of color mapping. However, the amount of work is way too much right now. Do you have ideas how to turn this thing into a gui?
|
26th January 2020, 00:16 | #17 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Ideas yes, plans no. Hugin gets you about 90% of the way there already, although it's rather awkward having to save and load pairs of frames. Copy/paste into Hugin would make it a lot easier, but I doubt it's something they'd implement. I was going to incorporate a control point GUI in something else I'm working on (which may or may not ever see the light of day), but I ended up steering from a two-pane GUI and it's a bit complicated to reimplement now.
StainlessS - I think it was him, he's usually the one with the crazy ideas - has previously posted scripts for using AutoHotKey to record clicks on a VirtualDub window, I believe. That could work with a stackhorizontal clip of the two videos, although I have no idea how you'd extract which frame you're on, nor would it give any visual feedback like Hugin does. |
26th January 2020, 13:15 | #18 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
It, (the prototype extractor) is probably getting a bit confused as dll is warp.dll and filters pre-pended with "warp_". The Prototype extractor usually tries to avoid outputting the dll prepended name[it obviously is failing to do that here, and drops the 'warp' bit]. The crazy idea in question is SawBones, using AutoIt (AutoHotKey was once AutoIt, and broke away due to developer differences, and since has diverged quite a bit). The AutoIt source is supplied in SawBones/FrameSurgeon zip. [AutoIt, not that much different to Basic. Has a massive library of apps and source, initially developed to perform system admin tasks. Compiled to self contained native executable, no dll's required]. EDIT: Yep, below fails [there is no function named 'Grid']. Code:
Colorbars Grid()
__________________
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 ??? Last edited by StainlessS; 26th January 2020 at 13:49. |
|
2nd February 2020, 14:40 | #19 | Link |
Registered User
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
|
Here I almost finished my script for camera rotation. I have question about quad:
Normally, in real life, when I rotate camera 180 degrees, there should be nothing. Using quad, there is again the same picture. See... Code:
ColorBars().Trim(0,1000).Killaudio() AddBorders(400,400,400,400) quad( 720,520,720,1478, 1040,520,1549,1478, 1040,400,1144,1066, 720,400,720,1066, \ interleaved=true, relative=false, debug=4) |
2nd February 2020, 15:12 | #20 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Quad is a 2D filter, and only knows where you've placed the corners in 2D space. You'll need to add an extra check to see if the corners are in the same order (clockwise or anti-clockwise) as before they were transformed - if not, move all the points to one side before calling Quad so you get a black video.
http://mathworld.wolfram.com/PolygonArea.html |
Thread Tools | Search this Thread |
Display Modes | |
|
|