How can I solve this centroid related problem ?
Mostra commenti meno recenti
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 Commenti
Rik
il 20 Apr 2019
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
il 20 Apr 2019
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
il 20 Apr 2019
Walter Roberson
il 20 Apr 2019
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
il 20 Apr 2019
Walter Roberson
il 20 Apr 2019
I forgot to subtract 1 after adding width or height
Zara Khan
il 20 Apr 2019
Walter Roberson
il 20 Apr 2019
I do not have access to graphics at the moment; I am answering all these questions by mental modeling.
Zara Khan
il 20 Apr 2019
Zara Khan
il 20 Apr 2019
Walter Roberson
il 20 Apr 2019
No.
Image Analyst
il 28 Apr 2019
Haven't we already covered this hand-splitting thing in some of your other 48 posts?
Zara Khan
il 28 Apr 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Image Transforms in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

