[PD] pix_dump and average?

Tina Shah surreal8 at hotmail.com
Mon Apr 10 21:35:47 CEST 2006


hi, i guess this is a newbie question.  i want to use frank's list-accum 
abstraction.  i just downloaded the list_accum.pd and the help.pd but it's 
not working.  i'm getting these errors:

tried C:\\Program Files\\pd\\my_projects\\list-drip.dll and failed
tried C:\\Program Files\\pd\\extra\\list-drip.dll and failed
tried C:\\Program Files\\pd\\my_projects\\list-drip\\list-drip.dll and 
failed
tried C:\\Program Files\\pd\\extra\\list-drip\\list-drip.dll and failed
tried C:\\Program Files\\pd\\my_projects\\list-drip.pd and failed
tried C:\\Program Files\\pd\\extra\\list-drip.pd and failed
tried C:\\Program Files\\pd\\my_projects\\list-drip.pat and failed
tried C:\\Program Files\\pd\\extra\\list-drip.pat and failed
list-drip
... couldn't create
tried C:\\Program Files\\pd\\my_projects\\list-accum.dll and failed
tried C:\\Program Files\\pd\\extra\\list-accum.dll and failed
tried C:\\Program Files\\pd\\my_projects\\list-accum\\list-accum.dll and 
failed
tried C:\\Program Files\\pd\\extra\\list-accum\\list-accum.dll and failed
tried C:\\Program Files\\pd\\my_projects\\list-accum.pd and failed
tried C:\\Program Files\\pd\\extra\\list-accum.pd and failed
tried C:\\Program Files\\pd\\my_projects\\list-accum.pat and failed
tried C:\\Program Files\\pd\\extra\\list-accum.pat and failed
list-accum
... couldn't create
error: inlet: expected '' but got 'list'

i didn't see any other files to download like .dll...
i'm using pd .39-2 and gem .90...

thanks,
tina

----Original Message Follows----
From: IOhannes m zmoelnig <zmoelnig at iem.at>
To: Tina Shah <surreal8 at hotmail.com>
CC: pd-list at iem.at
Subject: Re: [PD] pix_dump and average?
Date: Mon, 10 Apr 2006 11:50:08 +0200
MIME-Version: 1.0
Received: from bay0-mc1-f18.bay0.hotmail.com ([65.54.244.26]) by 
bay0-imc3-s32.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 
10 Apr 2006 02:48:06 -0700
Received: from mail.iem.at ([193.170.191.180]) by 
bay0-mc1-f18.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 
Apr 2006 02:48:04 -0700
Received: from router.iemnet ([192.168.7.1] helo=[192.168.7.141])by 
mail.iem.at with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32)(Exim 
4.60)(envelope-from <zmoelnig at iem.at>)id 1FSt04-0007AX-MW; Mon, 10 Apr 2006 
11:48:04 +0200
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Organization: Institute of Electronic Music and Acoustics, Graz
User-Agent: Debian Thunderbird 1.0.7 (X11/20051017)
X-Accept-Language: en-us, en
References: <BAY102-F200AF4B078982F318A009899CC0 at phx.gbl>
X-Enigmail-Version: 0.93.0.0
X-Spam-Score: -5.9
X-Spam-Level: -----
X-Spam-Tests: ALL_TRUSTED,BAYES_00
Return-Path: zmoelnig at iem.at
X-OriginalArrivalTime: 10 Apr 2006 09:48:05.0294 (UTC) 
FILETIME=[DD7B14E0:01C65C83]

hi

Tina Shah wrote:
 > Hi List, I'm trying to get the average color data from an image.  I'm
 > using pix_dump and then trying to use 'average' to get the average of
 > the dump, but the numbers are not matching.  i tested just a 1 pixel
 > image, got 4 values - 0.341176 0.360784 0.345098 1 - but the average is
 > wrong - average: 0.35098.

hmm: what exactly is wrong? is "0.35098" the output of the [average]
object? or is it what you expect (because you know the image)?

i cannot reproduce the former: on my machine, [average 4] outputs
0.511765 when i send it [0.341176, 0.360784, 0.345098, 1(
i cannot reproduce the latter (since i don't have the image)

 > anybody know what i'm doing wrong or know of

well:
[pix_dump] outputs a list(!) of values (r,g,b,a,r,g,b,a,...) AND
you cannot send a list to [average], it needs single numbers. so you
need to convert the list into a stream of numbers.
using a numberbox ([ \) does NOT convert a list into a stream of
numbers, it will just take the first number of that list and pass it on [1].

[average] is a moving average filter, and while you can use it to
calculate the total average of a list (with some tricks!), i would not
naturally use it.

the output of [pix_dump] also holds the alpha-value (the "1"), which you
most likely will not want to include in your averaging.

 > an easier way?  I'm on windows (pd .39-2) and just using gem...  BTW,

what is "just using gem"? version?
in gem-0.91 (still not released) there is [pix_mean_color] which
calculates the average color of an image. (separate values for r, g, b
and a)

i don't know exactly what you want to get: separate values for r,g,b,a
or 1 "grey" value?
in the former case you will have to sort the output of [pix_dump] to
give you separate lists (or streams of floats) for the 4 channels.
since 0.39, you can do that with native pd objects (see frank's
list-abstractions, which most likely also has a [list-average] which
will output the total average of a list)

 > does pix_resize work?

i thought so.
however, in older versions of gem you could not set the dimensions: it
would just resize the image to the next power-of-2 size. (see the
help-patch of the object whether in your version it is already able to
resize to an arbitrary size).
of course, if [pix_resize] does work for you, you could just use it to
resize the image to 1x1 and then do a dump.

 > thanks!

i hope i gave you some clues....

mfg.asdr.
IOhannes


[1]: hey! you have discovered a bug!! sending a list of floats to a
numberbox will output 2 values (the 2nd and the 1st)!!! this should be
fixed in 0.40






More information about the Pd-list mailing list