[Image-SIG] Locate The Center of WhiteDot from a Image
Christopher Barker
Chris.Barker at noaa.gov
Fri Jan 7 21:14:17 CET 2011
On 1/7/11 10:14 AM, Narendra Sisodiya wrote:
> This Code Look for bounding box which I am calculating by scanning each
> row and column one by one. If I am finding any white pixel, I am
> including it into my bounding box.
> 1) there may a change that 2 or more WhiteDOT may present. One is Big
> whiedot and other are very smaller whitedot(just 2-3 pixel) near to this
> Big whitedot.
Not sure about this one off the top of myhead, but I"d suspect some
smoothing may take care of it.
> I am applying this
> algorithm on every frame taken from camera at 2fps. So I want a high
> speed algorithm. PIL must be having some function or trick to do it.
The Image..getbbox() method should do it.
If you need more math, numpy can help. Somethign like:
a = np.asarray(PIL_image)
background_color = 0
rows, cols = np.where(a <> background_color) # background color a uint32
BB = (rows.min(), rows.max(), cols.min(), cols.max())
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Image-SIG
mailing list