On Thu, Sep 17, 2009 at 10:14 AM, Gökhan Sever <gokhanse...@gmail.com>wrote:
> > I use PIL to read my png file (after cropped the initial image to the > column of my interest) Like: > > from PIL import Image > myim = Image('seccol.png) > imdata = np.array(myim.getdata()) > > From this on, I am not sure what to provide to the structure parameter > > label(input, structure=None, output=None) > > I am correct on PIL usage or just a simple binary ready work, too? > > Confirming myself :) This is the right approach to take. However this is only the beginning. > > >> Once you've run label() you can use scipy.ndimage.find_objects() to >> get slices into the entire column that contain the contiguous region. >> >> If you want to try and count individual rectangles that may overlap, >> there are likely dynamic programming algorithms that can find the >> biggest rectangles. The truth is you can probably even do something >> pretty naive and then compile it with Cython and it'll go blazing fast. >> > I used find_object() correctly as well. Again, this query turns to not so simple object counting :) Because I should be able identify complex objects in that labeled array (ie. whether a single shadow or a part of compound object; look up, down, right, left neighbourhoods of each object to see it is by itself or not). And after such identification, I should get the maximum height and widths of each object. This is somewhat easier but the identification seems like a bit challenging for me. (many loops and some intelligent logic needs to applied). I am aware this is a very good algorithm design exercise, however I would be happy to hear if any similar work has been done before, since this is just the tip of my lab report. Thanks again. -- Gökhan
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion