Comments (6)
Hey!
Preview is a video-stream, so it uses the aspect ratio from videoResolution
/videoAspectRatio
in the Format.
You could prioritize video aspect ratio by moving it up, but then the photo still looks different.
I guess some photos just have a different aspect ratio for the photos stream or the video stream.
Does it look proper when you set both photoAspectRatio
and videoAspectRatio
to 4 / 3
? Remove the fps
from the filter as well, that may exclude some filters as it is spot 1 (highest priority)
from react-native-vision-camera.
I removed all filters, only put in a videoAspectRatio
and nothing changes, also tried combinations of just photoAspectRatio
and flipping their order.
It just feels like resizeMode='contain'
is hard coded (somewhere) to 4/3 ish.
I think after all this testing, im just going to use resizeMode='cover'
(or really just remove the prop as its the default), as that seems like what all example apps use and its fairly close.
TL;DR
After lots of testing i think best practices with v4 is use no resizeMode
(aka 'cover'), and ensure that the Preview's <View>
's aspect ratio is the same as your photo format.
And maybe recommend to delete this prop since it doesn't seem to do much with v4 just causes confusion? Or I'm still doing something wrong.
from react-native-vision-camera.
And maybe recommend to delete this prop since it doesn't seem to do much with v4 just causes confusion?
Not true. On iOS it works fine. Also it does change behaviour on Android. Why would I delete that prop?
from react-native-vision-camera.
Seems related to this issue: #2845
from react-native-vision-camera.
I am also facing this issue with iPad Pro 10.5 inch(17.4.1) in front camera, for back camera it is working fine and i also tested with android 12 (vivo s1 pro) it is working good.
const device = useCameraDevice(state.position);
const format = useCameraFormat(device, [
{photoAspectRatio: 4 / 3},
{videoAspectRatio: 4 / 3},
{
photoResolution: {
height: 520,
width: 390,
},
},
{
videoResolution: {
height: 520,
width: 390,
},
},
]);
const CaptureImage = async () => {
const photo = await cameraRef.current?.takePhoto();
console.log(photo);
setState(prev => ({
...prev,
url: photo?.path,
}));
};
return (
<View style={{flex: 1, backgroundColor: '#fff'}}>
<View style={{flex: 1}}>
<Camera
ref={cameraRef}
photo
isActive
format={format}
device={device}
style={{
// height: 520,
// width: 390,
aspectRatio: 3 / 4,
}}
/>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-evenly',
}}>
<Button title="Capture" color={'green'} onPress={CaptureImage} />
<Button
title="Switch"
color={'red'}
onPress={() => {
setState(prev => ({
...prev,
position: prev.position == 'front' ? 'back' : 'front',
}));
}}
/>
</View>
</View>
);
}
from react-native-vision-camera.
same issue, in cover mode, the preview size is slightly larger than the actual photo size. How to solve this problem?
from react-native-vision-camera.
Related Issues (20)
- 🐛 HOT 7
- 🐛 test HOT 4
- 💭 Test HOT 2
- 🐛 onStatusChanged override function missing for android versions before api 29 HOT 3
- 🐛 Hello, I have a question for you... we use your plugin, but we have a problem with the fact that the preview is smaller than the filmed or photographed area. how should we solve this? HOT 3
- 💭 Diffrent area - video/photo HOT 2
- 💭 How to get preview size (height and width) on resizeMode="contain" HOT 3
- 💭 Get "Missing purpose string" Apple violation when VCEnableLocation is false HOT 3
- 💭 onIitialized only work when the isActive once. HOT 2
- 🐛 onOutputOrientationChanged outputs wrong value on tablets HOT 7
- ✨ Hello author, can you add a cropping function after taking the photo? HOT 3
- 🐛 system/camera-is-restricted Camera functionality is not available because it has been restricted by the operating system, possibly due to a device policy. HOT 5
- 💭 Question: Implementing Virtual Background and AR Try-On Glasses with Frame Processing HOT 2
- 💭 CodeScanner does not recognize Data Matrix code on a black background HOT 2
- 🐛 photo.orientation is wrong when outputOrientation = preview on Android HOT 2
- 🐛 OutputOrientation: "Duplicate label in when" HOT 1
- 💭 Add filter to photo when photo is taken HOT 2
- 💭 Obtaining camera calibration data HOT 5
- 🐛 Crash in Android release build HOT 5
- 🐛 Failed to convert NativeBuffer to SkImage HOT 2
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 react-native-vision-camera.