How to calculate the curvature of a boundaries in binary images?
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Meshooo
le 26 Nov 2014
Commenté : Image Analyst
le 10 Déc 2022
Dear all,
I have a binary image that contains one shape as I show below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146222/image.png)
I want to represent the curvature using color coding of the boundariessimilar to image I got from the video in this link http://en.wikipedia.org/wiki/Curvature
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146223/image.png)
Does anyone knows how to do that?
Any help or suggestion will be appreciated.
Meshoo
0 commentaires
Réponse acceptée
Image Analyst
le 27 Nov 2014
Use bwboundaries to get a list of the (x,y) boundary coordinates. Run around that border taking a section of the curve, say 9 elements, and fit a polynomial to it. Knowing the derivative of the curve model you used, and the coefficients polyfit() gave you, you can get the curvature at each point. Then run around the list of (x,y) edge coordinates using a marker color that corresponds to the curvature. Try to program that up. If you can't do it all , then post what you have and I'll try to help with the rest.
19 commentaires
Francesco Pignatelli
le 9 Déc 2022
@Image Analyst I have followed this post and I saw your comments and you mentioned that "Knowing the derivative of the curve model you used, and the coefficients polyfit() gave you, you can get the curvature at each point.". My question is, how is it possible to get the derivatives?
At the current stage, I am at:
boundaries = bwboundaries(binaryImage);
x = boundaries{1}(:, 2);
y = boundaries{1}(:, 1);
So I have x and y now.
Image Analyst
le 10 Déc 2022
@Francesco Pignatelli see attached demo that does what I said. Adapt as needed. If you need more help, start your own discussion thread and attach your (x,y) data.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1226527/image.png)
Plus de réponses (3)
Preetham Manjunatha
le 2 Août 2021
Modifié(e) : Preetham Manjunatha
le 4 Août 2021
Here this function measures the curvature and other shape properties. In addition, it displays the curvature.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/703222/image.png)
Here is the T-section with sharp corners:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/703227/image.png)
0 commentaires
linda cummings cummingslinda14@gmail.com
le 9 Sep 2016
Very nice. Have you worked in gray image the this code ? Have you tried?
Linda Cummings
cummingslinda14 at gmail.com
0 commentaires
sana3 sal
le 18 Juin 2018
Hello Mr @Image Analyst, I am wondering how to read the curvature? or how to analyse it?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189314/image.jpeg)
3 commentaires
Image Analyst
le 9 Avr 2020
cyril grandjean
le 10 Avr 2020
Hello I read the code well but I was not sure that I understood correctly. So the coefficient provided in this code corresponds to the overall curvature of my form or a trend is that right?
thank you in advance
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!