简体   繁体   English

Android - 扭曲的相机预览

[英]Android - Distorted Camera Preview

I am currently writing an android app which runs displays a circle drawable on the preview frame, runs edge detection and then takes a photo once the user lines up a coin perfectly in the circle. 我目前正在编写一个Android应用程序,它运行时在预览框架上显示一个圆形绘图,运行边缘检测,然后一旦用户在圆圈中完美地排列硬币就拍照。

For some reason (despite being fullscreen with no title etc.), I am started to realize the camera preview is every so slightly distorted. 由于某种原因(尽管全屏没有标题等),我开始意识到相机预览是每一个稍微扭曲。 I have tried setting the previewsize to 480x640 while also setting the surfaceholder size to 480x640, however if I save the preview to bitmap and also take a photo, you can notice the distortion. 我已经尝试将预览大小设置为480x640,同时还将曲面大小设置为480x640,但是如果我将预览保存到位图并拍摄照片,您可以注意到失真。

Has anybody else had this kind of problem / or have any ideas as to a solution? 有没有其他人有这样的问题/或者对解决方案有任何想法?

I have encountered the same issue. 我遇到了同样的问题。 Hopefully I found that ApiDemos includes a working example with Camera. 希望我发现ApiDemos包含一个与Camera相关的工作示例。
You can find it here: com.example.android.apis.graphics.CameraPreview. 你可以在这里找到它: com.example.android.apis.graphics.CameraPreview.

I didn't digged the example, but I saw it's working fine just as my real camera, no distortion at all. 我没有挖掘这个例子,但我看到它的工作正常,就像我真正的相机一样,完全没有失真。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM