June 30th, 2005, 11:35 PM
getting regions out of a sparse matrix
I'm not sure if this is easy problem or not. But basically I have a collection of pixels that exist in clumps which are seperate from another. I would like to extract regions from this collection. And, for each region i would like to extract the contour pixels.
Has this kind of problem been solved? I get the faint idea that this is actually an NP complete AI problem, with K-means and stuff required.
I'm basically trying to write a simple magic wand tool in python. Any ideas?
I think numpy is what you are looking for.
This may be a little off topic but there is an Article on devshed that deals with recursion; of particular interest is the section on the flood-fill algorithm. Where This is used for filling I would imagine that selecting pixels in an image might work in the same way? Take a look anyway, you might find it interesting .
Wow i feel retarded. I've been programming off and on for several years and I came up with some ulgy non-recursive solution, when that one is so simple. thanks! Numpy looks cool as well but i'll get this implemented first and then swtich in numpy if needed.
Originally Posted by netytan