Add images together

I

iceman

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'
 
D

Diez B. Roggisch

iceman said:
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
 
I

iceman

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.
 
B

bearophileHUGS

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
 
B

Bruno Desthuilliers

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.
 
Z

zefciu

iceman said:
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
 
D

Dennis Lee Bieber

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
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top