On Sat, Jan 8, 2011 at 1:44 AM, Christopher Barker <chris.bar...@noaa.gov>wrote:
> 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. > > Thanks, I tried getbbox on wrong image. Now I am using getbbox and I am getting proper result that too very fast. > 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()) > I am unable to get what that code means ? May you explain how I can use above code with getbbox ? Or the above code using NumPy is alternate of getbbox method ? IF yes, then which will be the faster ? PS: I have looked at centroid algorithm, It is again going at pixel level and that will be slow. My application will become better with faster centroid algorithm. Also I have another question ! I am grabbing image from camera using opencv-python. How we can compare python PIL with OpenCV ? My guess that PIL will is faster then opencv library ?
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig