简体   繁体   English

使用 OpenCV SDK 从手机摄像头捕获图像以在 Unity 中进行全景拍摄

[英]Capture images from phone camera for panorama in Unity using OpenCV SDK

How to capture images to create a panorama image using phone's camera(not unity camera) ?如何使用手机的相机(不是 unity 相机)捕捉图像以创建全景图像? In other words, I'm trying to replicate the camera app on phone using Unity.换句话说,我正在尝试使用 Unity 在手机上复制相机应用程序。 I know a couple of methods on how to stitch images after they are captured but what I don't know is the "capture" process, i,e, how to determine if the phone is rotating left-to-right or right-to-left or not moving at all ?我知道一些关于如何在捕获后拼接图像的方法,但我不知道的是“捕获”过程,即如何确定手机是从左向右旋转还是从右向旋转- 左还是根本不动? Should I be using the gyroscope readings ?我应该使用陀螺仪读数吗? If yes, what about the case when there is IMU drift ?如果是的话,IMU 漂移的情况呢? Also, what is the approach used by most of the modern phones supporting panorama feature ?此外,大多数支持全景功能的现代手机使用的方法是什么?

Phones use sensor fusion and sometime also combine vision in order to determine how to do the stiching with regard to the motion.手机使用传感器融合,有时还会结合视觉,以确定如何根据运动进行拼接。 Most common is the use of Kalman filter where you have multiple sources of information in different measurements that can be aggregated to the desired variable.最常见的是使用卡尔曼滤波器,其中您在不同的测量中有多个信息源,可以聚合到所需的变量。 Basically what you are looking for is device orientation https://developer.android.com/reference/android/hardware/Sensor#TYPE_GEOMAGNETIC_ROTATION_VECTOR in Android for example.基本上,您正在寻找的是 Android 中的设备方向https://developer.android.com/reference/android/hardware/Sensor#TYPE_GEOMAGNETIC_ROTATION_VECTOR例如。 It uses Magnetometer, Accelerometer and Gyroscope 1. Magnetometer to estimate earth north 2. Accelerometer to estimate gravity direction 3. Gyroscope to compute the motion in dynamic time, the accelerometer and magnetometer will keep the gyroscope from drifting while the gyroscope helps to give valid results while the device in motion and the accelerometer evaluation of gravity direction is not accurate due to the linear acceleration.它使用磁力计、加速度计和陀螺仪 1. 磁力计估计地球北 2. 加速度计估计重力方向 3. 陀螺仪计算动态时间的运动,加速度计和磁力计将防止陀螺仪漂移,而陀螺仪有助于给出有效结果而运动中的设备和重力方向的加速度计评估由于线性加速度而不准确。 I can go on and on for the details but its not that important as its already implemented for you.我可以继续了解细节,但它并不重要,因为它已经为您实施了。 This give you a rotation vector in reference to earth coordinate system.这为您提供了一个参考地球坐标系的旋转矢量。 After you make the desired images or in real time you should perfect the results using some vision as the sensor accuracy will give you at least 2-3 degrees of error.在您制作所需的图像或实时后,您应该使用一些视觉来完善结果,因为传感器精度至少会给您 2-3 度的误差。

Hope it helps, Good luck with the project!希望有帮助,祝项目顺利!

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

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