Re: x y coordinates of image pixels for an image outline
- To: mathgroup at smc.vnet.net
- Subject: [mg118119] Re: x y coordinates of image pixels for an image outline
- From: Stefan <wutchamacallit27 at gmail.com>
- Date: Wed, 13 Apr 2011 05:52:56 -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, I came across a similar task not too long ago, where I wanted to compute a list of points in the complex plane which lie on the boundary of the Mandelbrot set. I did indeed use Binarize[] on an image I had rendered, and then proceeded by using MorphologicalPerimeter[], which is new and very useful and interesting. This takes the binarized image and returns a binary image with white pixels along the boundaries between components. You can then use Position[] to find the image's pixel coordinates of these points, and then transform them back to whatever actual scale/ orientation. Binarize[image] MorphologicalPerimeter[%] Position[ImageData[%],1] Map[yourCoordinateTransformation,%] Export["vertex_coordinates.whatever",%] -Stefan ps. the notebook where I worked out my solution is actually on my website, at this location (warning, lots of images on this page, the description and .nb is at the bottom): http://people.virginia.edu/~sws4e/MathArt/Julia.html