[IMAGE-SIG] Spatial histograms

Fredrik Lundh Fredrik Lundh" <fredrik_lundh@ivab.se
Mon, 14 Jul 1997 20:57:51 +0200

>There don't seem to be functions to compute spatial histograms of
>images.  For example, an X histogram is the same width as the image,
>and each element is the sum of all the colour values in the
>corresponding column; a Y histogram is all the values in each row
>added up.  I can't think of an efficient way to do this using PIL's
>existing primitives, so Frederik--would you have any objection to
>adding a function to do this if I implemented it? 

Would only take a few minutes to implement this based on the
(not yet documented) getprojection method. So I guess coming
up with an interface is the real problem... Let me get back to you
on this one...

>Another thing: I haven't written my image segmentation code
>yet, but suspect it'll wind up having to be written in C for speed.

And on this one... I have a fast and efficient crack coder up and
running, developed for PythonWare. It would probably be possible
to stuff a somewhat stripped-down version of this into the next
PIL release.

>Here's a proposal to simplify customizing PIL: Image objects have a
>__setattr__ method such that, when you access im.foo, PIL tries to
>import a module named imageop_foo (or something like that), and if it
>succeeds, returns imageop_foo.F .  Otherwise, AttributeError is raised
>as usual.  This way, you would just write a module containing a single
>function F, which did whatever analysis you desired, and could just do
>im.foo() to access it.  Thoughts?

Not sure what to think about this. I would prefer to use a separate
segmentation object (similar to ImageDraw).

Cheers /F

IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org