Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

Add images together


Hi,

I am trying to add together a number of images:

im = image1 + image2 + ...

How can i do this? I have tried to add two image instances
together but i get the following error:
TypeError: unsupported operand type(s)  for +: 'instance' and
'instance'

iceman schrieb:

> Hi,

> I am trying to add together a number of images:

> im = image1 + image2 + ...

> How can i do this? I have tried to add two image instances
> together but i get the following error:
> TypeError: unsupported operand type(s)  for +: 'instance' and
> 'instance'

Create a new image of double size, and blit the images to the correct
destination.

Diez

What i am trying to do is to separate the foreground object
from the background.All my images contain a foreground object
(i don't have a reference image). What i am trying to do
is to calculate a color-over-time-function for each pixel.
iceman a crit :

> Hi,

> I am trying to add together a number of images:

> im = image1 + image2 + ...

> How can i do this?

> I have tried to add two image instances
> together but i get the following error:
> TypeError: unsupported operand type(s)  for +: 'instance' and
> 'instance'

1/ Python has no builtin "image" type.

2/ I don't know any unambiguous mathematical definition of "image addition"

3/ Whatever "image" object you are using, it comes from a package.
Please read the package documentation.

iceman:

> What i am trying to do
> is to calculate a color-over-time-function for each pixel.

Are you using PIL?
What does it means color-over-time-function?

Bye,
bearophile

a)Yes, I am using PIL.
b)The color of each pixel over a sequence of frames

iceman wrote:
> a)Yes, I am using PIL.
> b)The color of each pixel over a sequence of frames

If you want to add numerical values of each pixel's colour then itereate
through the pixels using nested for loops.  But I (and I thing the rest
of people here) can't be sure, what in fact you are trying to do.
Please provide us with further info - what are you working at?

zefciu

On Feb 26, 10:16 pm, "iceman" <savva@gmail.com> wrote:

> a)Yes, I am using PIL.
> b)The color of each pixel over a sequence of frames

I think PIL has it for 2 images, you may have to build a binary tree
of merged images:
http://www.pythonware.com/library/pil/handbook/image.htm#blend

Bye,
bearophile

On 26 Feb 2007 12:30:36 -0800, "iceman" <savva@gmail.com> declaimed
the following in comp.lang.python:

> What i am trying to do is to separate the foreground object
> from the background.All my images contain a foreground object
> (i don't have a reference image). What i am trying to do
> is to calculate a color-over-time-function for each pixel.

        I presume said foreground object is the same in all images, no
motion, etc.

        Sounds more like a task suited to edge detection and masking. In any
case, you will probably have to code a loop over the (x, y) pixel range,
and perform the operations on the associated pixels from each image...
Or convert the pixel data to a numpy array -- there may be some
array-wide math operations...
--
        Wulfraed        Dennis Lee Bieber               KD6MOG
        wlfr@ix.netcom.com              wulfr@bestiaria.com
                HTTP://wlfraed.home.netcom.com/
        (Bestiaria Support Staff:               web-a@bestiaria.com)
                HTTP://www.bestiaria.com/

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc