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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd May 2007, 11:58   #1  |  Link
nonoitall
I'm a newb, NOT a noob
 
Join Date: Mar 2007
Location: Next door
Posts: 86
Creating a mask from the differences between two clips

Topic says it all. I've Googled and searched for hours in vain. Maybe I'm just not using the right terminology, but how can I create a mask based on the absolute differences between two clips?
nonoitall is offline   Reply With Quote
Old 22nd May 2007, 23:37   #2  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
Code:
c1 = #insert first clip here
c2 = #insert second clip here

yv12lutxy(c1, c2, "x y - abs 255 *", u=3, v=3)
that creates a hard thresholded mask, where the differences between the two clips are white, and everything else is black. You can get different mask characteristics by changing the equation used by yv12lutxy, which is part of the masktools 1 plugin.
*.mp4 guy is offline   Reply With Quote
Old 23rd May 2007, 02:41   #3  |  Link
nonoitall
I'm a newb, NOT a noob
 
Join Date: Mar 2007
Location: Next door
Posts: 86
I don't know; I think I'm a little lost, as this is my first time using masks. Here's the function I'm trying to write. (It's meant to look for differences between an original clip and a filtered one, apply a threshold to them to binarize them and then expand the different areas.

Code:
function DifferentAreas(clip original, clip filtered) {
  
  #Get the differences between the clips
  difference = yv12lutxy(original, filtered, "x y - abs", u=3, v=3)
  
  #Apply a threshold - pixels with a Y value under 40 will be black;
  #pixels with a Y value of 40 or higher will be white
  difference = difference.YV12LUT("x 40 < 0 255 ?", u=-128, v=-128)
  
  #Expand the differences - this is where the problem starts
  difference = difference.Expand()
  
  return difference
  
}
All goes well until I try to use the Expand function on my binarized mask. Some frames of the difference clip turn green and then back to black. Is this supposed to happen with masks?
nonoitall is offline   Reply With Quote
Old 23rd May 2007, 03:16   #4  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
change expand() to expand(u=3, v=3) that should fix the problem.
*.mp4 guy is offline   Reply With Quote
Old 23rd May 2007, 07:06   #5  |  Link
nonoitall
I'm a newb, NOT a noob
 
Join Date: Mar 2007
Location: Next door
Posts: 86
That did the trick! Thanks very much!
nonoitall is offline   Reply With Quote
Reply


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 20:35.


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