Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraMlVision + aspectRatio #93

Open
eliaweiss opened this issue Jan 11, 2020 · 0 comments
Open

CameraMlVision + aspectRatio #93

eliaweiss opened this issue Jan 11, 2020 · 0 comments

Comments

@eliaweiss
Copy link

I have the following code:

                  CustomPaint(
                      foregroundPainter: new DetectedTextBoxPainter(_ValueNotifier),//new TestPainter(_ValueNotifier),
                      child: new AspectRatio(
                        aspectRatio: _controller.value.aspectRatio,
                        //child: CameraPreview(_controller)
                          child: CameraMlVision<VisionText>(
                            resolution: ResolutionPreset.max,
                            detector:
                            FirebaseVision.instance.textRecognizer().processImage,
                            onResult: (VisionText vt) {
                              if (!mounted  ) {
                                return;
                              }
                              if (vt.text.length == 0) return;

                              _ValueNotifier.value = new Tuple2(vt, _controller.value.aspectRatio);
                            },
                          )
                    )
                  ),

The controller, which is usually passed to CameraPreview, is used to calculate screen position using aspectRatio, but CameraMlVision doesn't accept a controller.

How can I get the aspectRatio in onResult?

What I tried:

  1. if I multiply the aspectRatio by 0.88 it solves the problem, but it will probably not work on other devices.

  2. I tries to copy the implementation of CameraMlVision and expose the controller, but the aspectRatio is still off

  3. I tried to use the CameraImage width and height, but it returns the same value, ie. aspectRatio = height/width

  4. I tried to disable Scaffold, because I thought maybe the AppBar is responsible for the 12% error - it didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant