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 > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th March 2019, 18:10   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
test similarity somehow, in spite of different levelling
Immune-ish to differing levels (EDIT: At least rough alignment, better results)
Code:
RT_LumaCorrelation(clip c,clip c2,int "n"=current_frame,int "delta"=0,int "x"=0,int "y"=0,int "w"=0,int "h"=0,int "n2"=current_frame,
    int "delta2"=0,int "x2"=x,int "y2"=y,bool "interlaced"=false,int "Matrix"=(Width>1100||Height>600||clip2.Width>1100||clip2.Height>600?3:2))
  Returns FLOAT value luma correlation (-1.0 -> 1.0) between clip c frame (n+delta) area x,y,w,h, and clip c2 frame (n2+delta2) area x2,y2,w,h.
  Note, 'x2' and 'y2' default to 'x' and 'y' respectively.
    v2.0, c and c2 need not be same dimensions but BEWARE, x2 and y2 default to x and y also w and h default to 0
      which is converted to c.width-x and c.height-y, may be best to provide x2, y2, w and h where c2 not same dimensions as c.
  
  Pearson's Sample Correlation Coefficient.
  http://en.wikipedia.org/wiki/Correlation_and_dependence
  http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient
  Uses equivalent routine to the JMac698's JCorr plugin here:
  http://forum.doom9.org/showthread.php?t=165386
  and here:
  http://forum.doom9.org/showthread.php?p=1495098#post1495098
__________________
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; 30th March 2019 at 18:12.
StainlessS is offline   Reply With Quote
Old 30th March 2019, 18:42   #22  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Wow! This looks interesting!
Frank62 is offline   Reply With Quote
Old 30th March 2019, 21:23   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
By the way, SirPlant() uses RT_LumaCorrelation() a lot (but not exclusively).
Has to find an initial frame via RT_FrameDifference (luma + optional weighted chroma difference),
from initial matched frame, scans both forwards and backwards using Luma Correlation to establish extent of matching range.
During forwards/backwards scan, (when STRICT=False) allows for single missing or extra frame so long as then next along
frame matches ok.
__________________
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; 30th March 2019 at 21:36.
StainlessS is offline   Reply With Quote
Old 30th March 2019, 22:49   #24  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
After re-thinking I found that it will be a bit more difficult: The alignment (up, left, width, height) of two very different clips often changes every few scenes. This ruins my 3-points-approach (in spe).
-I would align automatically - ok.
-The new "FindCuts" then could find the first gap - ok, but maybe not - maybe it would find only a new wrong alignment.

So I would have to nest alignment and matching. I fear I can not do this in avisynth, will see if it's possible to log somehow and write something outside - and that maybe also can export some script format that can be used in Premiere (or Vegas?).
But this correlation-thing is an important step on the way, could work!
Frank62 is offline   Reply With Quote
Old 30th March 2019, 23:47   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
The alignment (up, left, width, height) of two very different clips often changes every few scenes.
I'm real glad I dont got that there clip.
__________________
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 31st March 2019, 12:07   #26  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234

This is quite common...
Frank62 is offline   Reply With Quote
Old 31st March 2019, 14:42   #27  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Quote:
Originally Posted by StainlessS View Post
I'm real glad I dont got that there clip.
I ran into this with a very similar project where we wanted to add hard-coded English subtitles from a very poor VHS version of a film to a high-quality DVD version in the original French language. Each transfer was scanned with something that didn't go to the edges of the film, and the portions of the film that were missed was different for each scan. As a result, I couldn't line them up perfectly, and the alignment changed from scene to scene. Also, there were one or two short scenes missing from one print.

I did what I described earlier, and once I had them aligned, used a mask to allow the subtitles from the lousy print to burn into the good print. The subtitles were yellow so I was able to construct a mask that only transferred the pixels in that color and brightness range, and didn't transfer much else. This wasn't perfect, so I used a "garbage mask" to block out everything outside the lower third area where the subtitles normally appear. I briefly tried to OCR them to make real DVD subtitles, but the tools I found online didn't work well enough for that. The bad VHS print also was very dark, and the colors were different from the good DVD print, so I had to do color and gamma correction before I merged in the subtitles.

It worked, and I ended up with a usable film, but I am not tempted to do it again. It was just too much tedious, repetitive work.

So, you may not be able to automate this much more than what you are doing, and what has been described.

Last edited by johnmeyer; 31st March 2019 at 18:54. Reason: typo
johnmeyer is offline   Reply With Quote
Old 31st March 2019, 17:23   #28  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Yes, I fear so, too - I tried to automate this for several years with no success. But hope dies last.

By the way: I remember something similar to your subtitle replacement. I had a new HD-scan and an old but not-too-bad SD scan. The problem was that the blue layer of the HD scan had been destroyed - looked like clouds sometimes with, sometimes without blue. No way to repair, tried everything. So finally I decided to align both clips exactly and use the color of the SD clip. Of course, every few scenes x-y-alignment changed.
In the end I did this primarily by interleaving the two (time-aligned) clips, then used Deshaker. Was not too bad in the end. Maybe this trick also can help someone somewhen.
Frank62 is offline   Reply With Quote
Old 31st March 2019, 17:37   #29  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
There's also a https://github.com/introspected/AutoOverlay plugin for avisynth.

p.s. click on the "> Portrait image + landscape image -> script output" text
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 31st March 2019 at 17:39.
ChaosKing is offline   Reply With Quote
Old 31st March 2019, 19:12   #30  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
Yes, as I said: I tested this, but in the context it is useless. You have to align 95% before, otherwise it fails. And the sources have to be very similar. Then it seems to do a very nice job, but only then.
Frank62 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 08:25.


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