How to get the coordinates of the center of gravity of various triangles and rectangles on the image?

5 views (last 30 days)
I would like to get the center of gravity of various (size / gradient) triangles and rectangles drawn on one image. Is there any useful toolbox or functions to get it in MATLAB? In some triangles are partially out of image, only one or two angles are drawn on the image. I'd installed MATLAB last month and am a beginner, so if possible, could you please let me which toolbox/function I should use, with a sample code?
  3 Comments
Image Analyst
Image Analyst on 11 Aug 2015
You forgot to attach the image. I don't know what to change without it. Perhaps change the threshold or the direction of the < or > symbol. Or perhaps you should get rid of the size filtering. I don't really know what you want to find in the image because you didn't post it and didn't explain what "recognize" means. Do you simply want a count? Are there circles and triangles and you want to segment out only the triangles and not the circles? I have no idea.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 9 Aug 2015
See my Image Segmentation Tutorial in my File Exchange. It does exactly that.
  4 Comments
phi
phi on 15 Aug 2015
Thank you for your comments. And sorry for my poor explanations. The left side image is "correct result" (that means, it is same as I expected), the problem is right side one. I'm not sure why this code does not recognize all triangles of right side image, even the both figure sizes of left and right, is almost same. I would like to know, which line's variable number I should change, to detect all triangle's center of gravity. Please see attached tif files, I hope it's to be some helps.

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!