This script is intended for a series of photographs with (on each photgraph different) unwanted objects on it, e.g. a large place with moving people.
V1.1 works with rectangular selections!
The plugin creates a new layer or a new image consisting of the arithmetical, geometrical or harmonic mean of every pixel, thereby creating a 'ghost effect' of the moving objects.
If rather you want to remove objects, choose the 'cutoff' function, which removes outlier pixels after sorting the RGB values. This is also known as winsorizing. Also median and mode remove outliers, but less efficiently.
For best results, try to cutoff only on dark, bright or on both sides.
Working on selections only greatly improves speed. Just make a rectangular selection in your image and then call the "Average Layer" script.
This was inspired by reports of a friend of mine on a Photoshop plugin, which also removes unwanted objects from a series of photographs. I haven't seen it myself nor do I know the algorithm behind it. If someone knows better algorithms than winsorizing means, tips are welcome!
You need Scipy, a scientific computing package for python. Get it at the Scipy homepage.
Before:
After arithmetical mean with 67% cutoff (dark outlier pixels):

Some shades are still left, one might correct this quite easily with other tools.
| Attachment | Size |
|---|---|
| Iron_Teddy_1.jpg | 5.14 KB |
| Iron_Teddy_Arithmetical_Mean_Cutoff_dark.jpg | 1.69 KB |
| average_layer.py | 8.7 KB |
Comments
error in median filter?
File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins\average_layer.py", line 205, in do_the_work working_class.export() File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins\average_layer.py", line 183, in export self.write_out(meanlayer, self.meanarray) File "C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins\average_layer.py", line 95, in write_out assert(byte_image.size == self.selection_width * self.selection_height * self.bpp) AssertionError-> heeelp... Edit: it seems that this line returns an empty array:self.meanarray=median(self.sarray)Image size?
installation
Installation
:-(
Installation
installation
Installation prerequisites
You need the scipy package installed!
Download at: www.scipy.org
Its perfect, thank you.
success with scipy