[Image-SIG] Locate The Center of WhiteDot from a Image

Garrett Davis garrettdaviscpa at gmail.com
Sat Jan 8 00:41:26 CET 2011


  Narendra Sisodiya wrote:

 > Now, I want to locate the center of whitedot.
 > I want to get center based on density of whitepixel. basically 
center where white pixel density is very high.
 > Also, I am applying this algorithm on every frame taken from 
camera at 2fps. So I want a high speed algorithm.

I would recommend using the getbbox() method, as Christopher Barker 
has already pointed out, along with one of these two techniques:

a) shrinking the size of the image to, say, 16x16, so that the 
smaller 'noise' dots disappear or turn into small grey dots, and then 
apply, or re-apply, the 'point' method discussed in an earlier thread 
to erase them;

b) using a 'centroid' algorithm to determine a 'center of mass' which 
would not be affected much by small amounts of 'noise'.

Fred Lundh had kindly provided this list with such an algorithm, here:
http://mail.python.org/pipermail/image-sig/2008-August/005149.html

I use both methods in my application - detection of cars on a 
racetrack for timing and scoring purposes - with good results, and 
with no performance problems when processing larger images at 10 frames/second.

Garrett Davis




More information about the Image-SIG mailing list