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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 21st November 2009, 10:48   #1  |  Link
shoopdabloop
Registered User
 
Join Date: Mar 2009
Posts: 166
Create a block difference mask of two images?

I was wondering how one would go about looking at two frames/clips, dividing each into 8x8 (or 4x4) blocks, and comparing each block in one image to the corresponding block in the other and setting the value of the corresponding block in the mask clip to the SAD of the pixels.

So basically, seeing in which corresponding blocks two images match up the most.

Is this possible in MVTools?

Last edited by shoopdabloop; 21st November 2009 at 11:24.
shoopdabloop is offline   Reply With Quote
Old 21st November 2009, 21:06   #2  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,407
Very easy way to get the normalized SAD over 8x8 blocks:
Code:
mt_lutxy(clip1,clip2,"x y - abs").DCTFilterD(14)
Alas, the result may show up a small bug in DCTFilter that never was fixed. (Result should show only solid 8x8 blocks everywhere. But in fact, there are many blocks with a 'stripe' in the middle. The bug can be worked around by adding Pointresize(1/8 resolution).PointResize(1/1 resolution). )


(Ab)using MVTools is by all means possible, but rather slow.
Calculate vectors against same frame {interleave(clip1,clip1)}, re-calculate with MRecalculate on {interleave(clip1,clip2)}, get SAD mask via MMask(), then selecteven().
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 21st November 2009 at 21:10.
Didée is offline   Reply With Quote
Old 21st November 2009, 22:48   #3  |  Link
shoopdabloop
Registered User
 
Join Date: Mar 2009
Posts: 166
would this work also? or is BilinearResize not sampling all 8 pixels?

mt_lutxy(clip1,clip2,"x y - abs",chroma="process").bilinearresize(width/8,height/8).pointresize(width,height)

Last edited by shoopdabloop; 21st November 2009 at 22:53.
shoopdabloop is offline   Reply With Quote
Old 21st November 2009, 23:58   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,444
bilinearresize(width/8,height/8) will sample 16x16 pixels at a time.
You could use bilinearresize(width/4,height/4, 2.0. 2.0)[*], which will give you 8x8 blocks, but the sampling is such that you don't get a simple average, points nearest the centre of each block get more weight, varying linearly (maybe that's what you want, I don't know).

* followed by .pointresize(width/8,height/8).pointresize(width,height)

Last edited by Gavino; 22nd November 2009 at 00:16.
Gavino 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 18:16.


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