Comments (10)
I tried scanning through the codebase and there doesn't seem to be any resizing happening - was this just a feature of 2.x that is no longer carried over?
from react-native-vision-camera.
Would mind clarify what is actually happening (and what is wrong there)?
Is the photo rotated by 90 degrees or?
Are you sure you are selecting the right format
for your desired output, not just resizing the camera preview?
from react-native-vision-camera.
Hey-
- There's no log output here, which is exactly what I need for these kinds of issues. I don't know how else to explain it than to give Xcode/Android Studio run instructions.
- You didn't try in the example app.
Are you using useCameraFormat
? That's what selects a format for you.
from react-native-vision-camera.
@mrousavy: I added logs via editing, you may have been looking at the email. That said, I'm not quite sure it's the logs you want. You are right about the example app, I can give it a shot later today.
I also haven't tried useCameraFormat
yet, because I wasn't sure that was the problem.
If I had to re-describe the problem: I set up the camera with a 4:3 aspect ratio "preview", but when I take the photo, I get something as if the preview was my whole camera screen.
Here is what the preview looks like:
Here is what the photo ends up looking like:
You can see that in the preview, my webcam was not there, but the photo contains my webcam.
from react-native-vision-camera.
Those are not native logs - I need the native logs (from Xcode or Android Studio) - those will tell me what format actually gets selected.
But yes I can answer that question right away then;
I also haven't tried useCameraFormat yet, because I wasn't sure that was the problem.
If I had to re-describe the problem: I set up the camera with a 4:3 aspect ratio "preview", but when I take the photo, I get something as if the preview was my whole camera screen.
The preview view has nothing to do with the photo output - previously in V2 it might have had something to do with it, but now this is fully decoupled (preview can even be disabled with preview={false}
). So you want to use useCameraFormat(...)
to select a format that has the photo resolution you desire.
Maybe try something like:
const format = useCameraFormat(device, [
{ photoAspectRatio: 4 / 3 }, // or 3 / 4, can't remember which way, sorry
{ photoResolution: 'max' }
])
from react-native-vision-camera.
btw nice mic, is that the blue jeti? I have the same
from react-native-vision-camera.
Ah okay, in V2 the preview is exactly what you got when you took the photo, so those two being disconnected concepts is exactly the issue. I tried your tip with the photoAspectRatio
, and while it's pretty close, I seem to be getting extra content on all 4 sides (compared to the preview).
Any thoughts on how I'd go about ensuring that the bounds of the preview are exactly the same as the photo I take?
And yeah, that's a Blue Yeti. We had some in the office before the pandemic and I was able to take one home. I hate wearing headphones all day, and the mic does a surprising job of not picking up the speaker output to cancel out echo.
from react-native-vision-camera.
ensuring that the bounds of the preview are exactly the same as the photo I take?
Well yea, make sure your preview is exactly the same aspect ratio as one of the photo sizes.
The photoWidth
/photoHeight
(or photoSize
) values are fixed and given by the Camera hardware. It cannot be flexed/changed on the fly - so you always shoot in those specific formats. V2 wasn't exactly the same as the preview, it might've been a good coincidence that the aspect ratio exactly matched though.
But what you wanna do is figure out which format you want to use, then resize your preview accordingly. or just account for slight aspect ratio mismatches, which is what pretty much every camera app does.
from react-native-vision-camera.
I have a similar issue after upgrading to v4 from v3.
I have my format set to "photoHeight": 1512, "photoWidth": 2688,
making it 16:9.
I have a react native view set with its aspect ratio of 9 / 16 for the Preview.
But my preview (set with resizeMode='contain') has blackbars in v4, and when the photo is taken i see extra padding just like what @inssein is noticing.
(This on a pixel 6 pro, "react-native-vision-camera": "^4.0.3")
from react-native-vision-camera.
Preview uses a video stream. So video resolution is what counts.
from react-native-vision-camera.
Related Issues (20)
- 💭 Two separate frame processors at different target FPS HOT 7
- 🐛 [AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces'. HOT 2
- 🐛 APK Size increase After implementing react-native-vision-camera lib double the apk size HOT 5
- 💭 Why the Photo Result Does Not Come Out in the Specified Aspect Ratio HOT 1
- 🐛 `finally` on a `Promise` stops camera on Android HOT 3
- 🐛 [V4][Android] Release crash: maxImages (6) has already been acquired HOT 1
- 🔧 Not able to build expo dev client when using any of the given frame processing plugin for OCR HOT 2
- 🐛 [Android] isActive change doesn't happen fast enough causing device/camera-already-in-use error when switching to native camera app HOT 1
- 🔧 Execution failed for task ':react-native-vision-camera:compileReleaseKotlin'. HOT 3
- 🔧 This API is provided only for React Native frameworks and not intended for general users. This API can change between minor versions in alignment with React Native frameworks and won't be considered a breaking change. HOT 10
- 💭 Android: Frameprocessor HOT 7
- 💭 Focus not work HOT 1
- 🐛 Memory leak Android HOT 6
- 💭 [iOS] Did someone manage to get to reasonable FPS with ML Kit Pose Detection (native frame processor plugin)? HOT 2
- 💭 Lifecycle methods for native frame processors HOT 5
- 💭 How to access GPS location tags in photo metadata? HOT 4
- 🐛 takePhoto() function working very slowly on Android HOT 3
- 🔧 A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction HOT 12
- 💭 How does RNVC interact with OS camera settings? HOT 1
- 💭 Is there a migration guide from V3 to V4? 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.