improve parsing 3
This commit is contained in:
@@ -22,16 +22,39 @@ class OcrElement {
|
||||
double get width => (right - left).abs();
|
||||
}
|
||||
|
||||
/// One ML Kit text line with its word-level elements.
|
||||
class OcrLine {
|
||||
const OcrLine({
|
||||
required this.text,
|
||||
required this.elements,
|
||||
required this.left,
|
||||
required this.top,
|
||||
required this.right,
|
||||
required this.bottom,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final List<OcrElement> elements;
|
||||
final double left;
|
||||
final double top;
|
||||
final double right;
|
||||
final double bottom;
|
||||
|
||||
double get centerY => (top + bottom) / 2;
|
||||
}
|
||||
|
||||
/// All positioned elements from one ML Kit recognition pass.
|
||||
class OcrDocument {
|
||||
const OcrDocument({
|
||||
required this.elements,
|
||||
required this.lines,
|
||||
required this.imageWidth,
|
||||
required this.imageHeight,
|
||||
required this.flattenedText,
|
||||
});
|
||||
|
||||
final List<OcrElement> elements;
|
||||
final List<OcrLine> lines;
|
||||
final double imageWidth;
|
||||
final double imageHeight;
|
||||
final String flattenedText;
|
||||
|
||||
Reference in New Issue
Block a user