We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › calculate "brightest area" in a set of pixels
Page Index Toggle Pages: 1
calculate "brightest area" in a set of pixels (Read 678 times)
calculate "brightest area" in a set of pixels
Feb 17th, 2010, 5:39am
 
hello  Smiley

i'd like to be able to calculate the 'mean brightest point' in a line of pixels. It's for a primitive 3D scanner.


right now i'm using a pretty basic algorithm. for each horizontal line of pixels in an image, i simply step through the pixels and if the current pixel is brighter than the one before, the brightest point of that line will be set to the current pixel. This of course gives very jittery results throughout the image(s).

i'd like to get kind of the 'average center of the brightness' instead, if that makes sense.

...

only i don't know where to start with the math…
has to be a common thing, i'm simply lacking the right words for a google search  Cheesy
Re: calculate "brightest area" in a set of pixels
Reply #1 - Feb 17th, 2010, 9:18am
 
what you want to do is looking for blobs: looking in the computer vision section of the libraries page you'll find a couple solutions that will fit your needs.

a blob is normally an irregular area in an image whose pixels have something in common, ie a similar brightness.
Re: calculate "brightest area" in a set of pixels
Reply #2 - Feb 17th, 2010, 9:46am
 
yes, basically the center of a blob is what i needed, though i thought it'd be overkill to use something like openCV for this, i only had to do one-dimensional lines. Found a simple and sufficient solution using intensity-weighted average:

Code:
0  0  0  0  1  3  2  3  1  0  0  0  0  0
1  2  3  4  5  6  7  8  9 10 11 12 13 14

(1*5+3*6+2*7+3*8+1*9)/(1+3+2+3+1) = 7



Page Index Toggle Pages: 1