Add images together

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iceman

    #1

    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'

  • Diez B. Roggisch

    #2
    Re: Add images together

    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

    Comment

    • iceman

      #3
      Re: Add images together

      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.


      Comment

      • Bruno Desthuilliers

        #4
        Re: Add images together

        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.

        Comment

        • bearophileHUGS@lycos.com

          #5
          Re: Add images together

          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

          Comment

          • iceman

            #6
            Re: Add images together

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

            Comment

            • zefciu

              #7
              Re: Add images together

              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

              Comment

              • bearophileHUGS@lycos.com

                #8
                Re: Add images together

                On Feb 26, 10:16 pm, "iceman" <savva...@gmail .comwrote:
                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:
                Comprehensive architectural reference guide for the PIL Image Module. Learn factory primitives, pixel matrix transformation methods, lazy evaluation loading routines, and channel array configurations.


                Bye,
                bearophile

                Comment

                Working...