File Exchange

2D Line Curvature and Normals

version 1.3.0.0 (8.97 KB) by Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

Accurate Curvature and Normals of a line/contour consisting of 2D points

Updated 17 Oct 2011

Editor's Note: This file was selected as MATLAB Central Pick of the Week

LineCurvature2D, This function calculates the curvature of a 2D line. It first fits polygons to the points. Then calculates the analytical curvature from the polygons.

K = LineCurvature2D(Vertices,Lines)

inputs,
Vertices : A M x 2 list of line points.
(optional)
Lines : A N x 2 list of line pieces, by indices of the vertices
(if not set assume Lines=[1 2; 3 4 ; ... ; M-1 M])

outputs,
K : M x 1 Curvature values

.
.
LineNormals2D, This function calculates the normals, of the line. Using the neighbouring points of each line/contour point, and forward an backward differences on the end points

N=LineNormals2D(V,L)

inputs,
V : List of points/vertices 2 x M
(optional)
Lines : A N x 2 list of line pieces, by indices of the vertices
(if not set assume Lines=[1 2; 3 4 ; ... ; M-1 M])

outputs,
N : The normals of the Vertices 2 x M

Pavel Kolesnichenko

Luxiao Cui

Bruno

Bruno (view profile)

Dear all, the curvature is calculated simply by the formula in the following link, which is a result of planar differential geometry. https://math.stackexchange.com/questions/1250554/curvature-of-plane-parametric-curves

Bruno

Bruno (view profile)

Dear Dirk,
Could you refer as to the math behind the last step of the calculation?Is there any literature? That is, how you get the curvature from the fitted polynomial?
bnscocozza@gmail.com

jian fu

jian fu (view profile)

Dear Dirk-Jan Kroon,
thanks for this great function! Is there any chance for me to get the related papers explaining this method?
Thanks a lot!
1197349243@qq.com

Aurea94

Aitor Arana

Liliana Valencia

Liliana Valencia (view profile)

It's a very nice code but I would like to know the mathematical foundation. Does anybody know it??

Mandeep Dhanda

ZQ W

Felix Oberle

Yaoshen Yuan

Arash Shahirpour

linfeng yang

Ilya Belevich

you23cef

Anwer khan

Ben King

Ben King (view profile)

Sleh Eddine Brika

Bojan

Bojan (view profile)

Hi . Can this code be used to break the curved line into small line segments of appropriate size with their ends overlapped to some small extent and then take hough transform?

GOPEE Ajit Kumar

GOPEE Ajit Kumar (view profile)

can the code be used to find singular points in fingerprint? if yes how plz? thx. Ajit

Benjamin Miller

Robbin van Hoek

Robbin van Hoek (view profile)

From what i understand the algorithm only uses the direct neighbors of the point to be evaluated correct? is it possible to include multiple nearby points to get a more accurate result?

Khalid Ali

Khalid Ali (view profile)

What is meant by lines?

rabeeah

rabeeah (view profile)

very useful code. i would also like to know the mathematical model used. does it use the freeman chain code Dirk?

Michael

Michael (view profile)

Thank you, good code to find in my case finger tips on a hand scan

Yunfeng

Simon

Simon (view profile)

Is there any literature to back this up??
Also, the grammar in the comments needs serious work....

Willy

Willy (view profile)

Thank you! Very usefull code! I would like to understand the maths behind the code better. Is this code based on some literature?

Ravikiran Janardhana

Ravikiran Janardhana (view profile)

I would like to point out a small typo:-
*****(correct)****
if(nargin<2)
L=[(1:(size(V,1)-1))' (2:size(V,1))'];
end
*****
In the code I saw,the above was :-
*****(typo)*****
Lines=[(1:(size(Vertices,1)-1))' (2:size(Vertices,1))'];
*****