-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
🐛 Android- frame processor alway return wrong width/height of frame #746
Comments
it failed on both front and back camera. |
Okay, maybe this commit broke something: 48da181 |
@mrousavy thank you for your quick response. i have checked |
i checked release history, orientation is added from version 2.11.2 |
I mean technically it would be correct. The width is always the physical sensor width. But I agree that we can use the logical term width and height instead, just like on iOS |
I just wonder where it goes wrong, here we set the target rotation: react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt Lines 396 to 397 in 28fc6a6
Could you maybe check here what react-native-vision-camera/android/src/main/java/com/mrousavy/camera/CameraView.kt Lines 477 to 493 in 28fc6a6
|
ok, thank you, i'll check it and tell you |
@mrousavy it alway log |
@vanhungoz @mrousavy isn't the wrong Btw, i have the same output when i use |
@bkidai have you tested with older version. Which version could we use to check frame processor with correct frame? |
@bkidai have you found any workaround? |
@vanhungoz i rotate the image based on the |
@mrousavy do you have any suggest to find out this bug? |
@bkidai could you share your code. |
@vanhungoz here's my code
|
thank you, the same as me |
If we rotated the image on the Android side, the |
In order to show barcode overlays, I rotated the image on the Android side using the yuv2bitmap converting code from here: https://blog.minhazav.dev/how-to-convert-yuv-420-sp-android.media.Image-to-Bitmap-or-jpeg/#pure-java-approach I then use Dimensions to infer whether I should switch frame width and frame height: if (frameWidth>frameHeight && Dimensions.get('window').width>Dimensions.get('window').height){
viewBox = "0 0 "+frameWidth+" "+frameHeight;
}else {
console.log("Has rotation");
viewBox = "0 0 "+frameHeight+" "+frameWidth;
} Full example: https://github.com/xulihang/vision-camera-dynamsoft-barcode-reader/tree/main/example |
Maybe this fixes the problem: #816 |
The new setOutputImageRotationEnabled API used in the pr seems the correct way. |
I had the same issue // If frame is inverted
// This happens on Pixel 2, width and height are inverted
if (screenWidth < screenHeight && frameWidth > frameHeight
|| ( screenWidth > screenHeight && frameWidth < frameHeight)) {
const tmp = frameWidth;
frameWidth = frameHeight;
frameHeight = tmp;
} |
Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3. I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here? Here's an instruction on how you can test that: #1674 (comment) If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Thank you! |
Hey - I'm tracking Orientation in this feature request/issue now: #1891 ✨ Make sure to upvote or sponsor to support this feature, and leave a comment if you have any additional thoughts/ideas. |
What were you trying to do?
i try to use frame to recognize face
Reproduceable Code
What happened instead?
frame data alway wrong.
camera's orientation is portrait
device's orientation is portrait.
Relevant log output
Device
pixel 3L. Android 12
VisionCamera Version
2.12.0
Additional information
The text was updated successfully, but these errors were encountered: