필터 지우기
필터 지우기

detect closed shapes formed by several arrays of points

조회 수: 9 (최근 30일)
Ilya
Ilya 2014년 1월 26일
편집: Ilya 2014년 2월 23일
I plot several arrays containing xy-coordinates of points (using plot(x,y)) and obtain a plot with some curves. The curves form some very distinctive closed shapes (that is, the points describing the curves lie close to each other).
It's needed to "recognize" the closed shapes and to fill them. The coordinates of points forming the shapes and their order are given.
Is it possible without shape recognition tools of the Image Processing Toolbox? If not, then how it can be possibly done with the Image Processing Toolbox?
Any suggestions are welcome!
P.S.: A possible example with 3 closed shapes to detect is given below. The points' coordinates are too lengthy to publish.
  댓글 수: 2
Image Analyst
Image Analyst 2014년 1월 26일
Probably. Here's a suggestion. Attach screenshots or images so we can visualize what you're talking about.
Ilya
Ilya 2014년 1월 27일
Yes, that's a valuable comment, thanks!

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

채택된 답변

Image Analyst
Image Analyst 2014년 1월 27일
You can do this with the Image Processing Toolbox. There is a function called poly2mask that will give you a binary image that you can then pass in to regionprops to get the centroid.
binaryImage = poly2mask(xVertices, yVertices, rows, columns);
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Centroid');
allCentroids = [measurements.Centroid];
xCentroids = allCentroids(:,1);
yCentroids = allCentroids(:,2);
But I think poly2mask may combine the 3 regions into one. You'd have to try. You can attach your data via a script or .mat file if you want.
  댓글 수: 1
Ilya
Ilya 2014년 1월 28일
Still it is more desirable to work with numerical coordinates (due to precision and speed considerations). Additional toolboxes are also undesirable, since I don't use the Image Processing Toolbox somewhere else in my project.
However, very much thanks for the suggestion. May be I'll use it in the end.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by