oevislib_net  0.14.3.0
Loading...
Searching...
No Matches

Compact representation of a monochromatic image. More...

Inheritance diagram for oevislib_net.Region:

Public Member Functions

 Region ()
 Creates a new empty Region.
 Region (int inWidth, int inHeight)
 Creates a new Region given frame dimensions.
 Region (Size inFrame)
 Creates a new Region given a frame.
 Region (Size inFrame, Array< PointsSequence > inPointsSequences)
 Creates a new Region using a frame and a set of points.
ByteBuffer Serialize ()
 Serializes the object.
Size GetFrame ()
 Returns the region frame.
int GetSize ()
 Returns the number of points sequence in the region.
PointsSequence[] GetData ()
 Returns the raw data pointer to the PointsSequence array.
void Reserve (int inNewCapacity)
 Reserves (but not allocates) space for the Region data.
void SetFrame (Size inFrame)
 Sets a new frame for the region.
void Swap (Region inRegion)
 Exchange the content of two regions.
void Add (PointsSequence inPointsSequence)
 Adds a new PointsSequence to the region.
void Add (Point2Di inOffset, int inLength)
 Adds a new PointsSequence to the region, given the starting point and its length.
Array< Point2DiGetPoints ()
 Returns all the points contained in the region.
bool IsOnFrame ()
 Checks if the region is adjacent to its frame.
bool IsEmpty ()
 Checks if the region contains any point.
void Verify ()
 Checks if the region is valid.
Region Copy ()
Point2D GetAnchoredPoint (Anchor2D inPointAnchor)
 Returns the point of the region described by the provided anchor.
float GetMoment (RegionMoment inMomentType, bool inCentral=false)
 Computes the requested region moment.
float GetNormMoment (RegionMoment inMomentType, bool inCentral=false)
 Computes the requested region moment, normalized to the region area.
float GetOrientation (AngleRange inAngleRange=AngleRange._0_360)
 Computes the region orientation.
Array< Point2DiGetOuterBoundary (RegionOuterBoundary inRegionOuterBoundary=RegionOuterBoundary.Top)
 Computes one of the region boundaries.
void GetOuterBoundaries (Array< Point2Di > outTopBoundary, Array< Point2Di > outRightBoundary, Array< Point2Di > outBottomBoundary, Array< Point2Di > outLeftBoundary)
 Computes boundaries of the region, divided by top, bottom, left and right points.
float GetElongation ()
 Computes the region elongation.
Segment2D GetMajorEllipticAxis ()
 Computes the major elliptical axis of the region.
Segment2D GetMinorEllipticAxis ()
 Computes the minor elliptical axis of the region.
Point2D GetMassCenter ()
 Computes the center of mass of all the points of the region.
int GetArea ()
 Computes the region's area, i.e.
Region GetBoundaries (RegionConnectivity inConnectivity)
 Returns a new region without the interior points.
Segment2D GetDiameter ()
 Computes the longest segment connecting two points of the region.
void GetCaliperDiameters (Optional< Segment2D > outMinDiameter, Optional< Segment2D > outMaxDiameter)
 Uses the caliper diameter algorithm to compute the longest and the shortest segments connecting two points of the region.
float GetCircularity (CircularityMeasure inCircularityMeasure, Optional< Circle2D > outCircle)
 Computes the region circularity.
Region GetConvexHull ()
 Computes the region's convex hull as a Region object.
float GetConvexity ()
 Computes the region convexity, defined as its area divided by the area of its convex hull.
float GetPerimeter ()
 Returns the Region Perimeter.
float GetRectangularity ()
 Computes the region rectangularity, defined as its area divided by the area of it bounding rectangle.
Box GetBoundingBox ()
 Computes the box with minimum area the contains the entire region.
Array< RegionGetHoles (RegionConnectivity inConnectivity=RegionConnectivity.EightDirections, int inMinHoleArea=1, Optional< int > inMaxHoleArea=null)
 Convert holes of the region into region themselves.
Region GetInteriors (RegionConnectivity inConnectivity=RegionConnectivity.EightDirections)
 Returns a new region without the border point.
Circle2D GetBoundingCircle ()
 Computes the circle with the smallest area that contains the entire region.
Rectangle2D GetBoundingRect ()
 Returns the rectangle with minimal area that contains the entire region.
Profile GetProjection (ProjectionDirection inProjectionDirection=ProjectionDirection.Horizontal)
 Computes the number of points either in each row or column of the region.
Path GetPathConvexHull ()
 Computes the region's convex hull as a Path object.
Array< int > GetPointsSequenceLengths ()
 Computes the lengths of all the region's point sequences.
Region FillHoles (int inMinHoleArea=1, Optional< int > inMaxHoleArea=null, RegionConnectivity inConnectivity=RegionConnectivity.EightDirections)
 Computes a new region, starting from the original and filling the holes with area in the requested range.
Region RemoveBorders (int inMarginX=0, int inMarginY=0)
 Computes a new region starting from the calling object and removing the requested margin from the outer borders.
Region RemoveBlobs (RegionFeature inFeature=RegionFeature.Area, float inMinimum=1.0f, Optional< float > inMaximum=null, RegionConnectivity inConnectivity=RegionConnectivity.EightDirections, bool inRemoveBoundaryBlobs=false)
 Computes a new region starting from the calling object and removing the blobs with the requested features.
Region RemoveBlobsOnRegionFrame (Region inBorderRegion, RegionConnectivity inConnectivity)
 Removes the blobs of the calling object that are touching the frame of the provided region.
Array< RegionSplitIntoBlobs (int inMinBlobArea=1, Optional< int > inMaxBlobArea=null, RegionConnectivity inConnectivity=RegionConnectivity.EightDirections, bool inRemoveBoundaryBlobs=false)
 Returns all the blobs that match the input parameters.
Array< RegionSplitIntoClusters (int inClusters, int inMaxIterations=100, int inAttempts=1, KMeansInitialization inClustersInitialization=KMeansInitialization.KMeansPP, int inMinBlobArea=1, Optional< int > inMaxBlobArea=null, bool inRemoveBoundaryBlobs=false)
 Splits the region into clusters.
Array< RegionSplitIntoClusters (int inMinPoints, float inEpsilon, bool inIgnoreOutliers=true, int inMinBlobArea=1, Optional< int > inMaxBlobArea=null, bool inRemoveBoundaryBlobs=false)
 Splits the region into clusters.
Region Dilate (Region inKernel, Optional< Point2Di > inKernelAnchor=null)
 Computes the morphological dilation on the calling region, using the provided kernel.
Region Dilate (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological dilation on the calling region, using the selected default kernel.
Region Erode (Region inKernel, Optional< Point2Di > inKernelAnchor=null)
 Computes the morphological erosion on the calling region, using the provided kernel.
Region Erode (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological erosion on the calling region, using the selected default kernel.
Region Open (Region inKernel)
 Computes the morphological opening on the calling region, using the provided kernel.
Region Open (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological opening on the calling region, using the selected default kernel.
Region Close (Region inKernel)
 Computes the morphological closing on the calling region, using the provided kernel.
Region Close (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological closing on the calling region, using the selected default kernel.
Region HitAndMiss (Region inHitKernel, Region inMissKernel, Optional< Point2Di > inHitKernelAnchor, Optional< Point2Di > inMissKernelAnchor)
 Computes the morphological hit-and-miss operation using the provided kernels.
Region Thin ()
 Computes the morphological thinning on the calling region.
Region Thicken ()
 Computes the morphological thickening on the calling region.
Region TopHat (Region inKernel)
 Computes the morphological top hat operation on the calling region, using the provided kernel.
Region TopHat (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological top hat operation on the calling region, using the selected default kernel.
Region BottomHat (Region inKernel)
 Computes the morphological bottom hat operation on the calling region, using the provided kernel.
Region BottomHat (KernelShape inKernel=KernelShape.Box, int inRadiusX=1, Optional< int > inRadiusY=null)
 Computes the morphological bottom hat operation on the calling region, using the selected default kernel.
Region Skeletonize ()
 Computes the region's morphological skeleton.
Region Prune (int inMaxLength)
 Computes the morphological pruning operation.
Region Inverse ()
 Returns the complementary region.
bool Intersects (Region inReferenceRegion)
 Checks if the object intersects with the provided Region.
bool Contains (Region inSubRegion)
 Checks if the object contains the provided SubRegion.
bool Contains (Point2D inPoint)
 Checks if the region contains a point.
bool Contains (Array< Point2D > inPoints, Optional< Array< bool > > outIsContainedArray, Optional< Array< Point2D > > outPoints)
 Checks if the region contains an array of points.
Region Mirror (MirrorDirection inMirrorDirection=MirrorDirection.Horizontal)
 Mirrors the region along the provided direction.
Region Translate (int inDeltaX, int inDeltaY, Optional< Size > inFrame=null, bool inInverse=false)
 Translates the object.
Region EnlargeNTimes (int inN)
 Increase the region by a given number of times.
Region Transpose ()
 Returns the transposed region.
Region Reflect (Point2Di inReflectionCenter)
 Rotates the region by 180 degrees using the provided rotation center.
Region Rotate (Point2D inCenter, float inAngle, Optional< Size > inFrame=null, bool inInverse=false)
 Performs a clockwise rotation of the region by a given angle using the provided rotation center.
Region Crop (Box inSelection)
 Crops the region to the provided box.
Region Uncrop (Box inSelection, Size inUncroppedFrame)
 Translates a cropped region in the original coordinates.
Region Crop (Rectangle2D inRectangle, Optional< UCS2D > inRectangleAlignment=null, Optional< Rectangle2D > outAlignedRectangle=null, Optional< UCS2D > outOutputAlignment=null)
 Crops the region to the provided rectangle.
Region Trim (Rectangle2D inRectangle, Optional< UCS2D > inRectangleAlignment=null, Optional< Rectangle2D > outAlignedRectangle=null)
 Trim the region points to the provided rectangle.
Region ResizeFrame (Size inNewFrame)
 Resizes the region using the provided frame.
Region ResizeFrame (float inScaleX, float inScaleY)
 Resizes the region using a scale factor.
Region Align (UCS2D inAlignment, Optional< Size > inFrame=null, bool inInverse=false)
 Aligns the region using the provided coordinate system.
Region Downsample (DownsampleRegionMode inDownsampleRegionMode=DownsampleRegionMode.Any, int inScaleStep=1)
 Downsamples the region using the provided downsample mode.
Region Shear (Axis inAxis, float inShear, float inCenter, ShearSize inShearSize=ShearSize.Preserve)
 Shear the region along the given axis.
Region ShrinkNTimes (int inNX=2, Optional< int > inNY=null, float inThreshold=0.5f)
 Shrinks the region by a given number of times.
Image Smooth (int inRadiusX=1, Optional< int > inRadiusY=null)
 Smooths the region by averaging the points inside the specified kernel.
bool Equals (Region other)
override bool Equals (object obj)
override int GetHashCode ()
override object Clone ()
override void Dispose ()

Static Public Member Functions

static bool operator== (Region inRegion1, Region inRegion2)
static bool operator!= (Region inRegion1, Region inRegion2)
static Region operator& (Region inRegion1, Region inRegion2)
 Bitwise AND operator.
static Region operator| (Region inRegion1, Region inRegion2)
 Bitwise OR operator.
static Region operator- (Region inRegion1, Region inRegion2)
 Difference operator.
static Region operator^ (Region inRegion1, Region inRegion2)
 Bitwise XOR operator.
static Region operator~ (Region inRegion)
static Region Deserialize (ByteBuffer inBuffer)
 De-serialize a Region buffer.
static Region FromPoints (Array< Point2Di > inPositions, Size inFrame)
 Creates a new region compressing the provided points into sequences.
static Region FromBox (Box inBox, Size inFrame)
 Creates a new region from a box.
static Region FromBoxBorders (Box inBox, Size inFrame, int inBorderWidth=1, BorderPosition inBorderPosition=BorderPosition.Centered)
 Creates a new region starting from the borders of a box.
static Region FromEllipse (Ellipse2D inEllipse, Size inFrame, Optional< UCS2D > inEllipseAlignment=null, Optional< Ellipse2D > outAlignedEllipse=null)
 Creates a new region from an ellipse object.
static Region FromRing (Ring2D inRing, Size inFrame, Optional< UCS2D > inRingAlignment=null, Optional< Ring2D > outAlignedRing=null)
 Creates a new region from a ring.
static Region FromCross (Box inCrossBoundingBox, Size inFrame)
 Creates a new region from a cross shape.
static Region FromGrid (Box inGridBoundingBox, Size inFrame, int inHorizontalStep=1, int inVerticalStep=1)
 Creates a new region with a grid shape.
static Region FromCircle (Circle2D inCircle, Size inFrame, Optional< UCS2D > inCircleAlignment=null, Optional< Circle2D > outAlignedCircle=null)
 Creates a new region given a circle.
static Region FromPolygon (Path inPolygon, Size inFrame, Optional< UCS2D > inPolygonAlignment=null, Optional< Path > outAlignedPolygon=null)
 Creates a new region given a polygon.
static Region FromPath (Path inPath, Size inFrame, float inWidth=1.0f, Optional< UCS2D > inPathAlignment=null, Optional< Path > outAlignedPath=null)
 Creates a new region given a path and a width.
static Region FromRectangle (Rectangle2D inRectangle, Size inFrame, Optional< UCS2D > inRectangleAlignment=null, Optional< Rectangle2D > outAlignedRectangle=null)
 Creates a new region given a rectangle.
static Region FromSegment (Segment2D inSegment, Size inFrame, float inWidth=1.0f, Optional< UCS2D > inSegmentAlignment=null, Optional< Segment2D > outAlignedSegment=null)
 Creates a new region from a segment.
static Region FromLine (Line2D inLine, Size inFrame, float inWidth=1, Optional< UCS2D > inLineAlignment=null, Optional< Line2D > outAlignedLine=null)
 Creates a new region from a line.
static Array< Array< int > > GroupPointsByRegions (Array< Point2D > inPoints, Array< Region > inRegions, Optional< Array< Array< Point2D > > > outGroupedPoints)
 Splits all the points in different groups, based on the region in which they are contained.
static Array< Array< int > > GroupPathsByRegions (Array< Path > inPaths, Array< Region > inRegions, MatchingCriterion inMatchingCriterion, Optional< Array< Array< Path > > > outGroupedPaths)
 Splits all the paths in different groups, based on the region in which they are contained.
static Array< Array< int > > GroupRegionsByRegions (Array< Region > inRegions, Array< Region > inGroupRegions, MatchingCriterion inMatchingCriterion, Optional< Array< Array< Region > > > outGroupedRegions)
 Splits all the regions in different groups, based on the region in which they are contained.
static Array< RegionExtractRegions (Array< Region > inRegions, RegionFeature inFeature, Optional< float > inMinimum, Optional< float > inMaximum, Optional< Array< Region > > outRejected, Optional< Array< Region > > outBelow, Optional< Array< Region > > outAbove, Optional< Array< float > > outValues)
 Extracts regions whose feature value is in the provided range.
static Array< RegionFilterRegions (Array< Region > inRegions, Region inReferenceRegion, RegionFeature inFeature, float inPercentageAbove, Optional< float > inPercentageBelow, Optional< Array< Region > > outRejected, Optional< Array< float > > outValues)
 Extracts regions whose feature value differs less than a percentage from the reference one.
static Array< RegionSortRegions (Array< Region > inRegions, RegionFeature inFeature, SortingOrder inSortingOrder, Optional< Array< float > > outSortedValues)
 Sorts the input regions based on the provided feature values.
static Region FindMinRegion (Array< Region > inRegions, RegionFeature inFeature, Optional< int > outIndex, Optional< float > outValue)
 Selects the region with the lowest value of the provided feature.
static int MinimumRegionIndex (Array< Region > inRegions, RegionFeature inFeature, Optional< Region > outRegion, Optional< float > outValue)
 Returns the index of the region with the lowest value of the selected feature.
static Region FindMaxRegion (Array< Region > inRegions, RegionFeature inFeature, Optional< int > outIndex, Optional< float > outValue)
 Selects the region with the highest value of the provided feature.
static int MaximumRegionIndex (Array< Region > inRegions, RegionFeature inFeature, Optional< Region > outRegion, Optional< float > outValue)
 Returns the index of the region with the highest value of the selected feature.
static Region Intersect (Region inRegion1, Region inRegion2)
 Computes the intersection between two regions.
static Region Intersect (Array< Region > inRegions)
 Computes the intersection between multiple regions.
static Region Combine (Region inRegion1, Region inRegion2)
 Computes the union between two regions.
static Region Combine (Array< Region > inRegions)
 Computes the union between multiple regions.
static Region Subtract (Region inRegion1, Region inRegion2)
 Computes the difference between the provided regions.
static Region Subtract (Array< Region > inRegions)
 Computes the subtraction between multiple regions.
static Region AbsDifference (Region inRegion1, Region inRegion2)
 Computes the exclusive disjunction between two regions.
static Region AbsDifference (Array< Region > inRegions)
 Computes the absolute difference between multiple regions.
static float Distance (Region inRegion1, Region inRegion2, float inResolution, Optional< Segment2D > outConnectingSegment)
 Computes the shortest distance between two regions.

Properties

PointsSequence this[int i] [get, set]

Detailed Description

Compact representation of a monochromatic image.

It is described by two elements: A frame, defined by a Size, which delimits the maximum dimension of the Region An array of PointsSequences, which describes the points contained in the Region.

A Region is considered valid only if the array has the following characteristics: Its points sequences are ordered with increasing y coordinate. Its points sequences are ordered with increasing x coordinate. Its points sequences have positive length. Its points sequences do not overlap and are not contiguous. It does not contain points outside its frame.