本文介绍了PictureCallback得到字节[]数据“onPictureTaken”,但它并没有我CameraView看到的图像匹配。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OpenCV的人脸检测在我的Andr​​oid app.The我面临的问题如下。我的类,它实现PictureCallback'得到的byte []数据onPictureTaken,但它并没有我CameraView看到的图像匹配。图像被从右切断。

I am using opencv face detection in my android app.The problem I am facing is as follows. My class which implements 'PictureCallback' gets byte[] data in 'onPictureTaken' but it doesn't match the image I see in CameraView. Image is been cut from right.

我显示简单的ImageView收到位图。

I am showing received bitmap in simple ImageView.

请注意:这无关我的ImageView或XML布局。正如我可以用图像验证问题我节省SD卡。

Note: It has nothing to do with my ImageView or XML layout. As I can verify the issue with the image I save on sdcard.

我会强烈AP preciate如果有人能帮助我在这方面。无法弄清楚什么我做错了这里。

I would highly appreciate if someone can help me in this regard. Unable to figure it out that what I am doing wrong here.

谢谢
问候

推荐答案

Android的相机有两种独立的设置为 previewSize pictureSize 。它们可以具有不同的纵横比,也。例如。

Android camera has two independent settings: previewSize and pictureSize. They may have different aspect ratios, too. E.g.

previewSize=1920x1080
pictureSize=4200x2800

相机不扭曲的形象,它作物了。

The camera does not distort the image, it crops it.

如果你想保留的同一视场中捕获的图片作为你有你的取景器屏幕上,你应该选择两个相同的纵横比。即使这并不能保证捕捉将保留看法完全相同字段(例如,由于集中调整)。

If you want to keep the same field of view in your captured picture as you have on your viewfinder screen, you should choose same aspect ratios for both. Even this does not guarantee that the capture will keep exactly same field of view (e.g. due to focus adjustments).

请注意,您必须选择相机支持的preVIEW大小和图像尺寸。 Android的API包括的 的和的

Note that you must choose the preview size and picture size supported by your camera. Android API includes getSupportedPictureSizes() and getSupportedPreviewSizes().

这篇关于PictureCallback得到字节[]数据“onPictureTaken”,但它并没有我CameraView看到的图像匹配。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 10:30