M-File Help: RegionFeature | View code for RegionFeature |
Region feature class
This class represents a region feature.
boundary | Return the boundary as a list |
box | Return the bounding box |
plot | Plot the centroid |
plot_boundary | Plot the boundary |
plot_box | Plot the bounding box |
plot_ellipse | Plot the equivalent ellipse |
display | Display value |
char | Convert value to string |
uc | centroid, horizontal coordinate |
vc | centroid, vertical coordinate |
p | centroid (uc, vc) |
umin | bounding box, minimum horizontal coordinate |
umax | bounding box, maximum horizontal coordinate |
vmin | bounding box, minimum vertical coordinate |
vmax | bounding box, maximum vertical coordinate |
area | the number of pixels |
class | the value of the pixels forming this region |
label | the label assigned to this region |
children | a list of indices of features that are children of this feature |
edgepoint | coordinate of a point on the perimeter |
edge | a list of edge points 2xN matrix |
perimeter | edge length (pixels) |
touch | true if region touches edge of the image |
a | major axis length of equivalent ellipse |
b | minor axis length of equivalent ellipse |
theta | angle of major ellipse axis to horizontal axis |
shape | aspect ratio b/a (always <= 1.0) |
circularity | 1 for a circle, less for other shapes |
moments | a structure containing moments of order 0 to 2 |
bbox | the bounding box, 2x2 matrix [umin umax; vmin vmax] |
Create a region feature object
R = RegionFeature() is a region feature object with null parameters.
Boundary in polar form
[d,th] = R.boundary() is a polar representation of the boundary with respect to the centroid. d(i) and th(i) are the distance to the boundary point and the angle respectively. These vectors have 400 elements irrespective of region size.
Return bounding box
b = R.box() is the bounding box in standard Toolbox form [xmin,xmax; ymin, ymax].
Convert to string
s = R.char() is a compact string representation of the region feature. If R is a vector then the string has multiple lines, one per element.
Display value
R.display() is a compact string representation of the region feature. If R is a vector then the elements are printed one per line.
Plot centroid
R.plot() overlay the centroid on current plot. It is indicated with overlaid o- and x-markers.
R.plot(ls) as above but the optional line style arguments ls are passed to plot.
If R is a vector then each element is plotted.
Plot boundary
R.plot_boundary() overlay perimeter points on current plot.
R.plot_boundary(ls) as above but the optional line style arguments ls are passed to plot.
Plot bounding box
R.plot_box() overlay the the bounding box of the region on current plot.
R.plot_box(ls) as above but the optional line style arguments ls are passed to plot.
If R is a vector then each element is plotted.
Plot equivalent ellipse
R.plot_ellipse() overlay the the equivalent ellipse of the region on current plot.
R.plot_ellipse(ls) as above but the optional line style arguments ls are passed to plot.
If R is a vector then each element is plotted.
© 1990-2012 Peter Corke.