本文介绍了camera2的CameraPreview在某些设备上伸展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 camera2 api开发相机应用程式。我在此链接中使用项目:



请帮助我解决这个问题。

解决方案

某些相机不支持适合4:3视图的预览大小。您可以通过的大小来裁剪图片,或者如果您使用OpenGL,则使用具有纹理坐标的类似补偿。


I'm developing a camera app using camera2 api. I'm using project in this link:https://github.com/googlesamples/android-Camera2Basic

Here is my problem:

  1. If I set ratio as display ratio of screen, everything is fine.
  2. If I want a camera preview 4:3, I got problems on Samsung Note 4 (both back and front camera), on Nexus 6 (front camera). The camera preview stretches in horizontal. Here are images (left: what I expected, right: what I got).

Please help me to solve this problem.

解决方案

Some cameras don't support the preview sizes that fit your 4:3 view. You can crop the image by resizing the SurfaceView, or use similar compensation with texture coordinates if you use OpenGL.

这篇关于camera2的CameraPreview在某些设备上伸展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 04:55