detectDocumentEdges static method

DocumentCorners detectDocumentEdges(
  1. Size imageSize
)

Detects document rectangular corners in image frame dimensions.

Implementation

static DocumentCorners detectDocumentEdges(Size imageSize) {
  final w = imageSize.width;
  final h = imageSize.height;
  final marginW = w * 0.08;
  final marginH = h * 0.08;

  return DocumentCorners(
    topLeft: Offset(marginW, marginH),
    topRight: Offset(w - marginW, marginH),
    bottomRight: Offset(w - marginW, h - marginH),
    bottomLeft: Offset(marginW, h - marginH),
  );
}