Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挱 Android Camera view width/height and photo width/height not the same. #2875

Closed
4 tasks done
OlviXhaferaj opened this issue May 13, 2024 · 1 comment
Closed
4 tasks done
Labels
馃挱 question Further information is requested

Comments

@OlviXhaferaj
Copy link

OlviXhaferaj commented May 13, 2024

Question

So I take the photo with camera.current.takePhoto function. The problem that I am facing, in android specifically, is that when I take a photo, if the camera view is set to, lets say, 370 width 700 height, the width of the photo is bigger or smaller than the view of the camera. For example if I resized the photo, it would be 400 width 700 height or something like that (this are just numbers to demonstrate).

What I saw is that the photo width output is different if I play with the photoResolution. If i set it to max, the photo width is bigger than what the camera sees, while if I dont set the photoResolution, the camera defaults to the best next resolution i guess, and the width appears to be smaller than the width of the view of the camera.

I want to take a photo and the output of it should be equal to the view that is presented to the user, not bigger or smaller than what the user sees.

Reason why this is a problem for me is because I want to make some automatic croping. The photo width/height ratio should be the same as the width/height ratio of the camera view.

If someone has some answer, would be appreciated!

What I tried

What I tried to solve this is setting the resizeMode="contain", and tried to understand how setting the format would work and change things.

VisionCamera Version

3.9.2

Additional information

@OlviXhaferaj OlviXhaferaj added the 馃挱 question Further information is requested label May 13, 2024
@mrousavy
Copy link
Owner

This is not how cameras work. There are fixed formats for the Camera, and you need to find a format that most closely matches what you desire - then do some cropping afterwards to get exact permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃挱 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants