How can I solve this centroid related problem ?
이전 댓글 표시
I have a binary image. I want to consider the upper portion of the centroid only. Then for a particular length I want to consider two square from both sides of centroid . I have attached two pictures to give an idea.
댓글 수: 14
Rik
2019년 4월 20일
A centroid is a point, so it doesn't really make sense to talk about a portion of a centroid. If you are talking about the region around the centroid it seems you could just calculate the other relevant coordinates.
Walter Roberson
2019년 4월 20일
Take max of distance between centroid x and bounding box x left, bounding box x right and centroid x, bounding box top and centroid y. That gives your distance. Take left that much from centroid x to up that much from centroid y, similar to right side.
Zara Khan
2019년 4월 20일
Walter Roberson
2019년 4월 20일
regionprops to extract centroid and bounding box. BB is in the form left x then bottom y then width then height. Centroid is x then y.
C(1)-bb(1), bb(1)+bb(3)-C(1), bb(2)+bb(4)-C(2)
max of those.
Warning: you can end up going outside the image with your scheme.
++
++
+++C++++++
++
++
Centroid location is approximate.
Left distance us 3, right is 6, up is 2, you define your box as square and reaching the edges at least so your square has to be 6 so that you reach the right side. But 6 up or 6 left is outside the image.
Zara Khan
2019년 4월 20일
Walter Roberson
2019년 4월 20일
I forgot to subtract 1 after adding width or height
Zara Khan
2019년 4월 20일
Walter Roberson
2019년 4월 20일
I do not have access to graphics at the moment; I am answering all these questions by mental modeling.
Zara Khan
2019년 4월 20일
Zara Khan
2019년 4월 20일
Walter Roberson
2019년 4월 20일
No.
Image Analyst
2019년 4월 28일
Haven't we already covered this hand-splitting thing in some of your other 48 posts?
Zara Khan
2019년 4월 28일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Transforms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

