Comments (3)
Similar issue. In my case, I managed to make boundingBox in portrait orientation. But when I rotate the phone to landscape the data is screwed.
Noted that I locked device orientation with expo-orientation
Ref
// check android barcode bounds
} else if (barcode.boundingBox !== undefined) {
barcodeBounds = {
height: barcode.boundingBox.size.width,
width: barcode.boundingBox.size.height,
left:
width - barcode.boundingBox.origin.y - barcode.boundingBox.size.width,
top: barcode.boundingBox.origin.x,
}
}
from expo.
Same problem here.
It's because currently screen orientation has nothing to do with how the barcode is scanned and how the corner points are processed. The orientation is taken from rotationDegrees which are also used for creating EXIF data when taking pictures.
Maybe I'm wrong but IMO the only real use case for corner points and bounding box is to show that to the user as an overlay. And for that we need it tied to the screen orientation and not physical orientation. Or at the very least we need to somehow get that info to javascript so we can process it ourselves.
from expo.
Update: Since my app is always portrait anyway I decided to hardcode the angle for now.
Here's my patch:
diff --git a/android/src/main/java/expo/modules/camera/analyzers/BarcodeAnalyzer.kt b/android/src/main/java/expo/modules/camera/analyzers/BarcodeAnalyzer.kt
index 8d3f8796363d4a42b440add55b2506cb0d4d556c..1328f41ac3668d41c2c5ded3e3542080ff1db5b7 100644
--- a/android/src/main/java/expo/modules/camera/analyzers/BarcodeAnalyzer.kt
+++ b/android/src/main/java/expo/modules/camera/analyzers/BarcodeAnalyzer.kt
@@ -33,7 +33,8 @@ class BarcodeAnalyzer(private val lensFacing: CameraType, formats: List<BarcodeT
val mediaImage = imageProxy.image
if (mediaImage != null) {
- val rotation = CameraViewHelper.getCorrectCameraRotation(imageProxy.imageInfo.rotationDegrees, lensFacing)
+ val rotation = CameraViewHelper.getCorrectCameraRotation(90, lensFacing)
val image = InputImage.fromMediaImage(mediaImage, rotation)
barcodeScanner.process(image)
It was created using bun patch but you probably can patch that using other tools. Idk if custom patches work in EAS. I build apks on my own infra (docker image + some scripts) and patches are applied automatically with every bun install
.
from expo.
Related Issues (20)
- App Crash on Production for android 9 and android 11 when i upload it on Google Play HOT 1
- Drawer Peeks Out From Behind Modal When Right Positioned
- Error: Could not parse JSON returned from "npm pack expo-template-blank@latest --dry-run". HOT 1
- Node-forge GPL license HOT 1
- expo-camera react native 0.75.2 android build error HOT 1
- Android crash on real device HOT 7
- `expo-symbols` package does not contain SymbolView.web in npm HOT 1
- [expo-image] NoSuchMethodException setLayoutDirectionOverride HOT 11
- How do you take a photo with expo-camera? HOT 1
- Expo camera takes long time to read PDF417 HOT 1
- [expo-location] Androdi crash when requesting location update
- [expo-camera] Preview is shortening when taking photo (Android only) HOT 4
- expo 51 expo-constants installationId HOT 1
- No field mDefaultJSExceptionHandler in class Lcom/facebook/react/devsupport/u HOT 5
- Expo with Try Vital SDK HOT 1
- Error loading font - TypeError: Cannot read property 'uri' of null
- NoSuchMethodException: com.facebook.react.views.view.g.setLayoutDirectionOverride HOT 5
- [docs] Broken LiveStore link in Local-first documentation
- [expo-av] Recorder is not prepared when switching from audio playing to recording
- Stuck on Node Modules' files do not exist (have tried to remove and re-do npm install to see if would fix) but gone in circles.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expo.