ContourDetector class

Contour detection and polygon simplification engine implemented in pure Dart.

Inspired by OpenCV's findContours() + approxPolyDP() and Scanbot SDK's document quad detection pipeline:

  1. Connected component labeling (Union-Find)
  2. Contour boundary tracing (Moore-Neighbor / Suzuki-Abe inspired)
  3. Douglas-Peucker polygon simplification
  4. Convex hull computation (Graham scan)
  5. Best quadrilateral selection

Constructors

ContourDetector()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

convexHull(List<Offset> points) List<Offset>
Computes the convex hull of a set of points using the Graham scan algorithm.
detectDocumentQuad(Uint8List gray, int width, int height, {int candidateCount = 5, double minAreaRatio = 0.15}) DocumentCorners
Detects the best document quadrilateral from a grayscale image.
findBestQuadrilateral(List<Offset> contour, int imageWidth, int imageHeight, {double minAreaRatio = 0.1, double maxAreaRatio = 0.95}) DocumentCorners?
Finds the best quadrilateral approximation from a contour.
findContours(Uint8List edgeMap, int width, int height, {int minContourLength = 20}) List<List<Offset>>
Detects all contours in a binary edge map.
simplifyPolygon(List<Offset> contour, double epsilon) List<Offset>
Simplifies a contour using the Douglas-Peucker algorithm.