I am trying to extract features for a leaf recognition application in MATLAB. I need to get elongation value which is described as the following:
Compute the maximum escape distance dmax = maxX ∈ I d(X,∂I). Elongation is obtained as 1 - 2dmax / D(I) and ranges from 0 to 1. The minimum is achieved for a circular region. Note that the ratio 2dmax/D(I) is the quotient between the diameter of the largest inscribed circle and the diameter of the smallest circumscribed circle.
D(I) is the diameter of the image I. ∂I is border of I.
Pretend a circular shaped image. The furthest point to the border of this shape is the center. This is called as maximum escape distance.
Elongation = 1 - (interior ellipse radius/surrounding ellipse raidus)
regionprops result for the image is below:
Area: 352085
Centroid: [311.2075 492.9844]
BoundingBox: [2.5000 2.5000 586 1139]
SubarrayIdx: {1x2 cell}
MajorAxisLength: 869.2058
MinorAxisLength: 535.2340
Eccentricity: 0.7879
Orientation: -85.2073
ConvexHull: [99x2 double]
ConvexImage: [1139x586 logical]
ConvexArea: 403293
Image: [1139x586 logical]
FilledImage: [1139x586 logical]
FilledArea: 352085
EulerNumber: 1
Extrema: [8x2 double]
EquivDiameter: 669.5435
Solidity: 0.8730
Extent: 0.5275
PixelIdxList: [352085x1 double]
PixelList: [352085x2 double]
Perimeter: 3.2466e+03