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 |
|
|
#1 | Link |
|
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. |
|
|
|
|
|
#2 | Link |
|
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) (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. |
|
|
|
|
|
#3 | Link |
|
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. |
|
|
|
|
|
#4 | Link |
|
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. |
|
|
|
![]() |
|
|