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 16th March 2005, 19:34   #1  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Averaging pixels (by downsizing image?) - solved

*********************EDIT:
If you happen to need average pixel like this, look directly at posts
17th March 2005 00:29
27th March 2005 21:47
There is also a function ShrinkBy2 in SSETools plugin which "sounds" like it could work, but I didn't check and AFAIK no docs are available.
**********************
Hi,
I want to make average of each block of 4x4 pixels (in YV12) on mod4 sized clip. I thought a way is via downsizing. More exactly, when I have block like this (numbers are colors)
0011
0011
4433
4433
I want to get
2222
2222
2222
2222 etc.

Via downsizing it would be
22
22
and then PointResize back to original size.

But I never achieved it. I tried different resizers.. these aliasing or sharpening or whatever effects cause sometimes result like this:
0000
0000
0000
0000
into
11
11
when there was some value in nearby block. Similar for 8x8.

Thanx
R.

Last edited by redfordxx; 1st April 2005 at 13:58.
redfordxx is offline   Reply With Quote
Old 16th March 2005, 20:27   #2  |  Link
E-Male
mad computer-scientist
 
Join Date: Mar 2002
Posts: 1,375
maybe none of the avbisynth resizers is blockbased

a blockbased downsizer or averager shouldn't be hard if you give some more details on what you want
E-Male is offline   Reply With Quote
Old 16th March 2005, 22:01   #3  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally posted by E-Male
...on what you want
When I have frame of a clip and I downsize it by two, I would like to have in each pixel of the downsized clip
average of colors of the four relevant pixels of original clip, which were merged by downsizing.
redfordxx is offline   Reply With Quote
Old 16th March 2005, 22:56   #4  |  Link
E-Male
mad computer-scientist
 
Join Date: Mar 2002
Posts: 1,375
what does "relevant" mean for you?
what colorspace?
"by 2" means halfing width AND hight each?
E-Male is offline   Reply With Quote
Old 16th March 2005, 23:12   #5  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally posted by E-Male
what does "relevant" mean for you?
what colorspace?
"by 2" means halfing width AND hight each?
When downsizing by 2 both width AND height, for each pixel in the new smaller picture, there were exactly four pixels (2x2) in the original. These pixels I meant are relevant to the new one. Bad expression.

YV12
The same priciple as for Y sould work for U,V --- only doublesized
redfordxx is offline   Reply With Quote
Old 16th March 2005, 23:25   #6  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Just do :

bilinearresize(half_width, half_height).bilinearresize(quarter_width, quarter_height).pointresize(width, height)

It'll work
Manao is offline   Reply With Quote
Old 16th March 2005, 23:58   #7  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally posted by Manao
Just do :

bilinearresize(half_width, half_height).bilinearresize(quarter_width, quarter_height).pointresize(width, height)
It'll work
No it doesnot.

Look (I'm testing it only in one channel, so don't be scared by the color)


the second one is with higher contrast, to see the difference.
Just try swithing the images fast. You will easily find blocks on the second pic, where the same block on first image is 100% clear. E.g. top left one and the one below...
redfordxx is offline   Reply With Quote
Old 17th March 2005, 00:52   #8  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
reduceby2()
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 17th March 2005, 01:05   #9  |  Link
Si
Simply me
 
Si's Avatar
 
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
Just to fully clarify - do you want this

A B W X
C D Y Z
J K P Q
L M R S

made into

E E V V
E E V V
I I N N
I I N N

Where E is Average(A,B,C,D), V= Average(W,X,Y,Z) etc

or something else

regards
Simon
Si is offline   Reply With Quote
Old 17th March 2005, 01:16   #10  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally posted by Mug Funky
reduceby2()
Again, No, also already tried.
redfordxx 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 03:59.


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