[英]How to solve different Preview/Picture sizes returned by android.hardware.camera?
So I've been playing with the android camera library and using it in a surfaceview. 因此,我一直在使用android相机库并在Surfaceview中使用它。 I have found that there's no way to capture pictures that match preview. 我发现无法捕获与预览匹配的图片。 In fact, one has to always check the preview and picture sizes and set the camera parameters to get the best match possible. 实际上,必须始终检查预览和图片大小,并设置相机参数以获得最佳匹配。 Also, you can't just set the camera to have the same sizes for both since the app will crash if the camera doesn't support them. 另外,您不能仅将相机的尺寸设置为相同,因为如果相机不支持相机,应用程序将崩溃。
How can this be? 怎么会这样? Is there really no other solution? 真的没有其他解决方案吗? I mean Instagram seems to use it (it doesn't launch the phone's camera app) and there always seems to be a perfect match. 我的意思是,Instagram似乎正在使用它(它不会启动手机的相机应用程序),而且似乎总是很合适。
Any ideas? 有任何想法吗? Thanks! 谢谢!
Simplest, and largely practical, approach is treat the preview as a mere feedback mechanism and to concentrate the program logic on getting the best - and desired - quality of image capture. 最简单且广泛实用的方法是将预览视为一种单纯的反馈机制,并将程序逻辑集中在获得最佳(和期望的)图像捕获质量上。
There is little novelty in mixing the two together. 将两者混合在一起几乎没有什么新奇之处。
Also, the desired image capture quality may depend on different factors/options. 同样,所需的图像捕获质量可能取决于不同的因素/选项。 Based on post capture processing times, storage constraints, upload constraints, and more; 基于后期捕获处理时间,存储限制,上传限制等; the best quality image may not be the always desired one. 最佳质量的图像可能不是始终想要的。
Implementation wise, the camera apps follow some common practices as below: 在实施方面,相机应用程序遵循以下一些常见做法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.