ochornenko / Camera2GLPreview

Android camera preview application using Camera2 API and OpenGL ES/Vulkan
174 stars 53 forks source link

Why the image is a little bit expanded ? #7

Closed simonprovost closed 5 years ago

simonprovost commented 5 years ago

Hello,

I assume that is possible that's normal behavior for this project but I want to ask you.

I would to know if it's normal that the image which can we see in realtime is a little bit expanded, not the same as you can see with the camera app official or your eyes (I dont speak about the quality.)

If you have an idea to solved that ? or just an explanation ? Thank you a lot, and Best Regards?

ochornenko commented 5 years ago

In sample resolution is hard coded to 480x640 also In VideoRendererYUV420.cpp I call function: float scaleFactor = aspect_ratio_correction(false, m_backingWidth, m_backingHeight, m_width, m_height);

which corrects aspect ration depends on screen resolution, you can play with it. Aspect ratio of the screen and video frame can be different, so you need to adjust it to fullscreen or pillarbox or letterbox.

simonprovost commented 5 years ago

I've seen this answer in another issue but after change the m_backingheigh or other variable, it scale but the image can be view is always a little bit expanded with respect to real object.