Re: x y coordinates of image pixels for an image outline
- To: mathgroup at smc.vnet.net
- Subject: [mg118171] Re: x y coordinates of image pixels for an image outline
- From: Stefan <wutchamacallit27 at gmail.com>
- Date: Fri, 15 Apr 2011 03:56:21 -0400 (EDT)
- References: <io17cv$i44$1@smc.vnet.net>
On Apr 12, 5:52 am, william parr <willpower... at hotmail.com> wrote: > Dear Mathgroup, > > I think this problem is fairly straight forward, but I'm struggling with it! > > essentially, I want to; > 1) determine/assign x y coordinate values to the black pixels in a binarised image. > 2) select the outline black pixels (and get their x y coordinates) on each line of the image. > > This falls within a larger project of wanting to recover the outside outline (ie surface outline with x y coordinates) of a bone from a CT slice image. I would then probably aim to create a 3D point cloud for the external bone surface by assigning each slice a z coordinate value. However, unless anyone has a very clever (ie not processor intensive) way of of creating a polygon mesh from the 3D point cloud, I will probably export the point cloud for surface meshing in another program. > > thanks in advance, > > Will Will, Not too long ago I was trying to do the same thing with an image, though for a different purpose. What I did was use MorphologicalComponents[] on the binarized image, which returns another image with white pixels on the boundary of the object in the image. I then used Position[ImageData[%],1] to find the pixel coordinates of all the white pixels in that image. Then a simple coordinate transformation can be applied to this list to arrive at the correct points in x-y. Then like you said, I'm sure you could add a z coordinate based on the order of the images. Binarize[pic]; MorphologicalComponents[%]; Position[ImageData[%],1]; points = Map[myCoordinateTransform,%]; -Stefan