You are here

Light and shadow centroids

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
Centroids_capture.png469.15 KB
centroid3.zip11.67 KB

This Python plug-in helps in the comparison of the left part of an image to the right part (equilibrium or not). It can be applied to any type of image and computes the centroid of the gray image pixels. The centroid is similar to the centre of mass concept, where mass is replace by another quantity; here it is the lightness and the greyness of the pixel.

A tool I wanted for some time, hope it will help you too...
Being the first version it's not very robust but should be usable on image greater than 200x200 PX or less than 2000x2000 PX if time is important.
After placing the file in '~/.gimp-2.x/plug-ins', the menu should appear in GIMP at '<Image>/Extensions/Plugins-Python/Composition/Centroids'. This is my place in the menu but probably should not be your's if your main plug-in language is not Python. If you don't know how to change it: consult "http://registry.gimp.org/node/27031#comment-15104".

The included image below (capture in a GIMP screen) is what it gives on a photo after a run.

The shadow balance strip is given mostly to judge visually the shadow disequilibrium present.

EDIT-1: Oct. 5 2012;
Corrected a bug: variable 'stripe' was not defined when the shadow centroid was near the vertical center guide or on it. The edited file is 'centroid1.zip'.
EDIT-2: Oct. 12 2012;
Made it more robust (more checking). The edited file is 'centroid2.zip'.
EDIT-3: Dec. 11 2012;
Computes centroids for a non-uniform alpha channel if both are there, also corrected some typos and give a start at language translation.
The edited file is 'centroid3.zip'.

Code License: 
GIMP Version: 
Scripting Engine: 
Subscribe to Comments for "Light and shadow centroids"