grain2d.fitEllipse edit page

fit ellipses to grains using the method described in Mulchrone& Choudhury,2004 (https://doi.org/10.1016/S0191-8141(03)00093-2)

Syntax

[c,a,b] = fitEllipse(grains);
plotEllipse(c,a,b,'lineColor','r')

Input

grains grain2d

Output

c centroid
a long axis
b short axis

Options

boundary scale to fit boundary length

Example

mtexdata csl
grains = calcGrains(ebsd('indexed'))
grains = smooth(grains,10)
plot(ebsd('indexed'),ebsd('indexed').orientations,'micronbar','off')
hold on
plot(grains.boundary,'lineWidth',2)
[c,a,b] = fitEllipse(grains(grains.numPixel>20));
plotEllipse(c,a,b,'lineColor','w','lineWidth',2)
hold off
ebsd = EBSD (y↑→x)
 
 Phase   Orientations     Mineral         Color  Symmetry  Crystal reference frame
     0    5 (0.0032%)  notIndexed                                                 
    -1  154107 (100%)        iron  LightSkyBlue      m-3m                         
 
 Properties: ci, error, iq
 Scan unit : um
 X x Y x Z : [0, 511] x [0, 300] x [0, 0]
 Normal vector: (0,0,1)
 
 
grains = grain2d (y↑→x)
 
 Phase  Grains  Pixels  Mineral  Symmetry  Crystal reference frame
    -1     885  154107     iron      m-3m                         
 
 boundary segments: 23579 (22018 µm)
 inner boundary segments: 93 (93 µm)
 triple points: 1451
 
 Properties: meanRotation, GOS
 
 
grains = grain2d (y↑→x)
 
 Phase  Grains  Pixels  Mineral  Symmetry  Crystal reference frame
    -1     885  154107     iron      m-3m                         
 
 boundary segments: 23579 (17770 µm)
 inner boundary segments: 93 (67 µm)
 triple points: 1451
 
 Properties: meanRotation, GOS