Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Commit

Permalink
work in progress...
Browse files Browse the repository at this point in the history
  • Loading branch information
lewix committed Jan 10, 2019
1 parent bdec81d commit 96a749c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
36 changes: 17 additions & 19 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,29 @@ class _CameraAppState extends State<CameraPage> {

print("scanning!...");

final FirebaseVisionImageMetadata metadata =
FirebaseVisionImageMetadata(
rawFormat: 35,
size: const Size(1.0, 1.0),
planeData: <FirebaseVisionImagePlaneMetadata>[
FirebaseVisionImagePlaneMetadata(
bytesPerRow: 1000,
height: 480,
width: 480,
),
],
);

// final FirebaseVisionImageMetadata metadata = FirebaseVisionImageMetadata(
// rawFormat: availableImage.format.raw,
// size: Size(1.0, 1.0),
// final FirebaseVisionImageMetadata metadata =
// FirebaseVisionImageMetadata(
// rawFormat: 35,
// size: const Size(1.0, 1.0),
// planeData: <FirebaseVisionImagePlaneMetadata>[
// FirebaseVisionImagePlaneMetadata(
// bytesPerRow: availableImage.planes[0].bytesPerRow,
// height: availableImage.planes[0].height,
// width: availableImage.planes[0].width,
// bytesPerRow: 1000,
// height: 480,
// width: 480,
// ),
// ],
// );

final FirebaseVisionImageMetadata metadata = FirebaseVisionImageMetadata(
rawFormat: availableImage.format.raw,
size: Size(1.0, 1.0),
planeData: availableImage.planes.map((currentPlane) => FirebaseVisionImagePlaneMetadata(
bytesPerRow: currentPlane.bytesPerRow,
height: currentPlane.height,
width: currentPlane.width
)).toList()
);

final FirebaseVisionImage visionImage = FirebaseVisionImage.fromBytes(availableImage.planes[0].bytes, metadata);
final TextRecognizer textRecognizer = FirebaseVision.instance.textRecognizer();
final VisionText visionText = await textRecognizer.processImage(visionImage);
Expand Down
2 changes: 1 addition & 1 deletion test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:mlkit_ocr_realtime/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(CameraApp());
await tester.pumpWidget(OcrApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
Expand Down

0 comments on commit 96a749c

Please sign in to comment.