react-native-vision-camera: 🐛 Android- frame processor alway return wrong width/height of frame
What were you trying to do?
i try to use frame to recognize face
Reproduceable Code
const frameProcessor = useFrameProcessor(frame => {
'worklet';
console.log('frame.width', frame.width);
console.log('frame.height', frame.height);
}, []);
What happened instead?
frame data alway wrong. camera’s orientation is portrait device’s orientation is portrait.
Relevant log output
LOG frame.width 1280
LOG frame.height 720
Device
pixel 3L. Android 12
VisionCamera Version
2.12.0
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this project’s Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 24 (9 by maintainers)
If we rotated the image on the Android side, the
frame.width
is still wrong on the JavaScript side. Maybe frame should have arotationDegrees
prop.matrix.setRotate((360- image.imageInfo.rotationDegrees).toFloat())
val rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix,true)
@bkidai could you share your code. i’m rotating the image by this function
@vanhungoz i rotate the image based on the
ImageProxy.imageInfo.rotationDegrees
natively in Android before using it