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: Ability to scan both normal codes and inverted codes #1215

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

RafaRuiz
Copy link

Started on #1214 to improve #1071 but with a few enhancements:

  • No usage of OpenCV for Android, MLKit would do the inversion.
  • Set intervalInvertImage instead of choosing whether to invert the image constantly or not. This way we can read both types, for example:
Both types of codes (example)

image

  • Kept to latest version 6.0.1 instead from the first one which was taken from 5.0.1

@RafaRuiz RafaRuiz changed the title feature: Ability to scan both normal codes and inverted codes feat: Ability to scan both normal codes and inverted codes Oct 12, 2024
Copy link
Collaborator

@navaronbracke navaronbracke left a comment

Choose a reason for hiding this comment

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

Overall, this looks okay, but I have feedback for the implementation.

Will you be looking into color inversion for the Vision API (for MacOS) as well?

lib/src/objects/start_options.dart Outdated Show resolved Hide resolved
lib/src/mobile_scanner_platform_interface.dart Outdated Show resolved Hide resolved
lib/src/mobile_scanner_controller.dart Outdated Show resolved Hide resolved
lib/src/mobile_scanner_controller.dart Outdated Show resolved Hide resolved
ios/Classes/MobileScanner.swift Outdated Show resolved Hide resolved
ios/Classes/MobileScanner.swift Outdated Show resolved Hide resolved
ios/Classes/MobileScanner.swift Outdated Show resolved Hide resolved
ios/Classes/MobileScanner.swift Outdated Show resolved Hide resolved

func invertImage(image: UIImage) -> UIImage {
let ciImage = CIImage(image: image)
let filter = CIFilter(name: "CIColorInvert")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would not use a magic string here, you should be using https://developer.apple.com/documentation/coreimage/cifilter/3228292-colorinvert

Copy link
Author

Choose a reason for hiding this comment

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

@navaronbracke can you give me a hand here?

I'm trying to make it API available, as I've seen there are a few statements for iOS 13 somewhere in the project, but despite setting my project deployment target to 15, I keep seeing this:

image

I've done just a little Swift in my life, it's been more Android

@RafaRuiz RafaRuiz marked this pull request as draft October 18, 2024 09:40
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.

2 participants