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

feat: Add bitmap to input image for text recognition #752

Conversation

feinstein
Copy link
Contributor

@feinstein feinstein commented Mar 13, 2025

Closes #753.

In this PR I am adding the capability to extract text from a bitmap. This was mentioned in the Android ML Kit docs, but not in the iOS ones.

I have tested this in both Android and iOS and supplied an example case too.

This is important to me because I am using the camera package, but I am manipulating the image and I want to recognise text in only a portion of the image, so in order to make this I am capturing the bitmap image from the widget and cropping it, before sending it to the text recogniser.

This simplifies also how we deal with images from the camera, as there are compatibility issues with the camera image formats for Android and iOS, with many open issues, so this can be used as a workaround.

@feinstein feinstein changed the title Add bitmap to input image for text recognition feat: Add bitmap to input image for text recognition Mar 13, 2025
@feinstein
Copy link
Contributor Author

feinstein commented Mar 13, 2025

@fbernaly I need the commons package to be updated as well, this is causing a failed check. How can I get this working?

@fbernaly
Copy link
Collaborator

@feinstein: this is a lot of work! Thanks for the contribution. I will take a look.

@fbernaly fbernaly changed the base branch from develop to test March 13, 2025 16:33
@fbernaly fbernaly merged commit a241191 into flutter-ml:test Mar 13, 2025
3 of 5 checks passed
@@ -122,7 +122,29 @@ dependencies {
Create an instance of `InputImage` as explained [here](https://github.com/flutter-ml/google_ml_kit_flutter/blob/master/packages/google_mlkit_commons#creating-an-inputimage).

```dart
final InputImage inputImage;
// From a file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,3 +1,8 @@
## 0.15.0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discard this change

@@ -1,6 +1,6 @@
name: google_mlkit_text_recognition
description: A Flutter plugin to use Google's ML Kit Text Recognition to recognize text in any Chinese, Devanagari, Japanese, Korean and Latin character set.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discard changes to this file

@fbernaly
Copy link
Collaborator

@feinstein : I merged your code to a test branch before merging it to develop because I want to play with it before merging it to develop. The analyzer is failing because first we need to push version 0.10.0 of google_mlkit_commons, and then update the other plugins, you need need at least 2 PRs for this. Submit a new one with the changes I mentioned in this one and make sure you do not change nothing in the other plugins, only google_mlkit_commons, then after reviewing it I will publish that one and after that you will create the 2nd PR that takes the new dependency.
Also, in order for the second PR to be accepted you need to update all of the plugins that have google_mlkit_commons as dependency.
Thanks for the 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

Successfully merging this pull request may close these issues.

Add bitmap support for the InputImage used by text recogniser
2 participants