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. |
|
24th May 2010, 01:29 | #1 | Link |
Registered Amatuer
Join Date: Feb 2007
Posts: 20
|
Auto-alignment?
Is there a filter for avisynth that works similarly to the auto-alignment feature in Photoshop? I'd like to take 2 video transfers of the same movie, and have one aligned to be nearly identical to the corresponding frame of the other. My intended purpose for this is to copy the chroma from one version of a film to another. Here's an example -
VidSource1 - VidSource2 - Auto-aligned, merged-chroma, and luma adjustment - I've looked around and nothing's turned up. Is there anything like this yet for avisynth? Last edited by RidgeShark; 24th May 2010 at 01:33. |
24th May 2010, 03:53 | #3 | Link |
Registered Amatuer
Join Date: Feb 2007
Posts: 20
|
Well this was just a fun example. And as far as I know, the 80's colorization of King Kong will never come out on Blu-ray. I'd certainly buy it if it did though. I own two VHS copies and the UK DVD (itself a NTSC->PAL transfer from an old 80's video master) of the colorized version. The quality on those are nowhere near the recently restored black and white versions though, which is just a part of the fun of this little experiment.
A filter like this would be interesting because manually aligning two separate film transfers like these is nearly impossible. There's so many little differences from different telecine equipment that a manual alignment would have to be done by sequence and sometimes frame by frame, and would take ages to do. By automatically aligning the two sources, a great deal could be done with both the luma and chroma channels. Last edited by RidgeShark; 24th May 2010 at 04:06. |
24th May 2010, 06:30 | #7 | Link |
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
I've not actually tried it, but apparently you can use the (absolute) Difference blend mode in Overlay to 'manually' align images with identical visual content. When perfectly aligned, the content outline should turn black. I also included a Difference blend mode in the (YV12 based) Blend_MT function that I put together.
http://forum.doom9.org/showthread.ph...34#post1400434 Again, never tried it in this context. I dont know of an 'auto' equivalent.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 24th May 2010 at 06:33. |
24th May 2010, 13:33 | #8 | Link |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
Damn! I just wrote you a long detailed set of suggestions, and the damn forum engine swallowed it 'cos it decided I wasn't logged in anymore! (And just for once, I forgot to copy-paste it all into notepad before submitting it... )
If this post works OK, then I'll write it all out again. |
24th May 2010, 14:03 | #9 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
My FindFrame function from this thread, or something like it, might be useful.
After logging in, use the back button on your browser to get back to the text you had. |
24th May 2010, 14:14 | #10 | Link | |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
Quote:
That doesn't always work, and didn't this time (I just got a completely blank input field). No prob though, I think I actually did a better job of explaining things second time anyway. |
|
24th May 2010, 13:47 | #12 | Link |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
OK, that worked, let's try again.
Based on WorBry's suggestion, you *could* try using a chain of "?" and ":" (as a "virtual case statement") to compare the images in several different positions, and thus select the offset that works best. You can wrap that into a run-time function and evaluate it agains each frame (or pair of frames). Two problems with that: One is that the chain of comparisons will get very long and run very slowly; the other is that it won't take into account any geometry distortions within the frame. For that, you'd have to split the frame into blocks or regions (with some overlap), compare and adjust them separately, and then merge them back together. Luckily, there's a toolset that already does these kind of things. We can "misuse" MVtools2. - First, make the two versions identical in size, with approximately matched positions, and starting on the same frame. - Interleave the two streams, to create a clip with colour and monochrome pairs of frames. - Use MAnalyse (with chroma=false) to compare each frame with the one before. - Use Mcompensate or MFlow to shift blocks/pixels from the colour frames to exactly match the positions in the monochrome frames. - Use SelectEVen or SelectOdd to pull out just the shifted colour frames from the result. - Use MergeChroma to add the shifted chroma to the untouched monochrome source. Good luck! |
25th May 2010, 04:24 | #13 | Link |
Registered User
Join Date: May 2007
Posts: 220
|
Try this:
Code:
col = AVISource("C:\Documents and Settings\Justin (um3k)\My Documents\Downloads\experiment\SD.avi") bw = AVISource("C:\Documents and Settings\Justin (um3k)\My Documents\Downloads\experiment\HD.avi") colw = col.Width() colh = col.Height() bww = bw.Width() bwh = bw.Height() borw = (bww-colw)/2 borh = (bwh-colh)/2 col = col.Lanczos4Resize(1100, 756) col = col.AddBorders((1280-col.Width)/2, (960-col.Height)/2, (1280-col.Width)/2, (960-col.Height)/2, color=$000000) bwp = bw.AddBorders((1280-bw.Width)/2, (960-bw.Height)/2, (1280-bw.Width)/2, (960-bw.Height)/2, color=$000000) int = Interleave(bwp,col).ConvertToYV12() est = int.Greyscale().depanestimate(range=1,pixaspect=1.0,zoommax=1,improve=false,trust=0) dep = int.depaninterleave(est,pixaspect=1.0,prev=0,next=1,subpixel=2,mirror=0) acol = dep.SelectEvery(4, 1).Crop(144, 120, 992, 720) MergeChroma(bw, acol) EDIT: Of course, replace the clips with the full movie. Last edited by um3k; 25th May 2010 at 04:46. |
1st June 2010, 06:05 | #15 | Link |
Registered Amatuer
Join Date: Feb 2007
Posts: 20
|
I've tried it on a few small sections and it seems to work great. I haven't been able to do the whole film due to lack of time for all the necessary processing.
My copy of the colorized film is from a PAL DVD that was created from an improper NTSC->PAL conversion, so I used Srestore to create 23.976FPS progressive clips to do these tests. I need to apply it to the whole colourized version and then go through both the color and b&w copies and correct any points where they go out of sync. The restored b&w version has some shots that are longer in length by a few frames than the colorized version, which throws everything off. And being that I am not a very advanced avisynth user, could you possibly explain how your script works? I basically understand it, but not enough to modify it for other videos. Thank you so much for your help. Last edited by RidgeShark; 1st June 2010 at 06:09. |
1st June 2010, 07:48 | #16 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
judicious resizing, interleave(a,b) and mvtools will get you there.
i've done something similar with using mvtools to fix a very old (rank mkII maybe?) transfer that had inter-field wobbling such that the picture shook around unbearably. only gotcha is that you need to make sure both clips are frame-for-frame the same edit, or it'll go pear shaped.
__________________
sucking the life out of your videos since 2004 |
Tags |
auto alignment |
Thread Tools | Search this Thread |
Display Modes | |
|
|