필터 지우기
필터 지우기

detect shape in image

조회 수: 1 (최근 30일)
Abdul
Abdul 2012년 4월 1일
how i can use code regionprops to detect square,circle and other shapes using only one command?

채택된 답변

Image Analyst
Image Analyst 2012년 4월 1일
You can't do it in one command. The best you can do is a few commands, depending on what you mean by "detect." Basically you have to measure a bunch of things and figure out which of those, in which ranges, uniquely identifies each type of shape you want to "detect." A good starting place is to computer the "circularity" which is:
allAreas = [measurements.Area];
allPerimeters = [measurements.Perimeter];
circularities = allPerimeters.^2 ./ (4*pi*allAreas);
A perfect circle is 1 and other shapes will lie in certain ranges above 1. There may be overlap of the ranges for shapes that are indeterminate, such as a triangle with bulging sides (almost rounded).
  댓글 수: 2
Abdul
Abdul 2012년 4월 1일
thanks, how about square equation?
Image Analyst
Image Analyst 2012년 4월 1일
What is the "square equation" and how would it apply here? Do you mean the value of the circularity for squares? I don't know off the top of my head what they are for squares, triangles, etc. You'll just have to try it and see what range they fall in to. It may be that squares have circularity in the range 5-10, and triangles are in the range 8-15, but I don't know - you'll just have to try it and find out.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by