Hi all,
I have an attached image, and I aim to automatically select all (or most of them) the white small shapes/polygons from the image.
Currently, I select those shapes by hand one by one using "imdistline" tool which is tedious (The output is in the 2nd attached image below. One can see the selected shapes below).
My aim is first to select those small polygons automatically (not selecting by hand at each time) and then getting and saving their coordinates.
I believe that, this is shouldn't be that easy since there are some noise in the image and not all the shapes are perfectly closed.
My question is, if such thing is doable via Matlab?
Thank you
Regards

 Accepted Answer

Image Analyst
Image Analyst on 19 Jul 2020
You probably made a mistake by doing an edge detection. A given shape has hundreds of pixels in it. How do you want the coordinates? A list of all row,column locations for everything in the shape? Why? What are you going to do with that.
For what it's worth, see my attached demo.

6 Comments

Hi,
Thank you for your reply.
The image I have from the literature is in the attached and named as "inst". This is a flame front and due to the experimental set-up it is in 2-D.
I aimed to get 3D of this image. Therefore, I got the cartesian coordinates of the small polygons from the "edges" image and converted them to spherical coordinates. The result of the 3D transformation of some polygons is in the attached as well and named as "3D-surfaces".
Until now, in order to develop the 3D transformation approach, I selected the polygons by myself one-by-one and got the coordinates and then transformed them. The image showing the selected polygons is in the attached namely "selected polygons".
Currently, I am able of getting the result that I planned from the 3D transformation. And as a next step, I am thinking if there is a posible way of identification of those polygons automatically (not by hand). Because, I will analyse lots of images via this approach, and choosing the polygons by hand all the time will be a pain.
I use the tool of "imdistline" to select the polygons, I was thinking to write a script which will choose those polygons/shapes as I did using imdistline. So it will show the selected polygons after running the script (as in the selected polygon.png).
I am desperate about such an approach, nevertheless, wanted to get an advice from you guys.
Thank you for your time and advice.
P.S. Currently, I use Matlab version 2017a. I assume your demo doesn't work with this version, does it?
Try the demo. I don't recall what version it was developed in, and don't know when the various functions it may call were first introduced.
I think you're better off starting with the original. Try thresholding. If you can't get a good global threshold then try adapthisteq() to flatten the image, then threshold. Then see Steve's blog about how to split apart blobs using watershed: http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-from-tech-support/
Hi,
I understand, thank you.
I will try those approaches.
Regards
Did they work? If so, please "Accept this answer". If not, let's see your image and code.
No, but we'd be interested in knowing what method you used. Usually I hear that the method of looking at distances from centroids to perimeter and finding peaks in that signal to find vertices is a pretty reliable method, and I gave a demo for that. So what algorithm did you end up using instead?
It was the watershed method, and I have just seen and recalled that it was your suggestion. Since it was a while, I thought I have accepted answer, and I really did. Thank you for reminding me, and I am re-accepting it now.
P.S. I've removed my recent comment as well.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!