自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
旋转矢量 CV 交叉检验
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
图 1. 测试图案的缩略图。请下载上方链接的完整分辨率图片。
本页面将介绍对旋转矢量传感器实现的兼容性正确进行测试的步骤。如果设备声明具有 TYPE_ROTATION_VECTOR 复合传感器功能,则应该运行该测试。
测试
- 在接受测试的 Android 设备上安装 OpenCV Manager。
- 从
SourceForge.net 下载
OpenCV-3.0.0-android-sdk.zip
软件包。
- 从所下载归档文件内的
apk
文件夹中查找相关 APK。搭配使用 adb install
命令和 --bypass-low-target-sdk-block
选项,从计算机加载设备上的 APK。对于搭载 Android 13 或更低版本的设备,此 --bypass-low-target-sdk-block
选项不是必要的。如需了解详情,请参阅安装应用。
如果存在登录到 Google Play 的有效账号,请在 Google Play 中找到 OpenCV Manager,并在上下文菜单(“...”按钮触发的弹出式菜单)中停用“自动更新”。
图 2. 在 Google Play 中停用自动更新。
- 打印链接的测试图案,并在打印时停用任何缩放选项。使用横向的 US Letter 纸张应该可以完整打印出该图案,您也可以使用更大尺寸的纸张打印。
注意:上面正文中的图片分辨率较低,仅用于说明。请勿直接将其作为您的图案打印出来。
- 将该图案放在水平面上。
- 在 CTS 验证程序应用中启动旋转矢量 CV 交叉检验。按照下面的指南开启飞行模式,关闭自动屏幕旋转,并调整自适应亮度和位置信息(如果尚未进行这些更改)。
图 3. 启动测试。
- 当视频预览出现时,将手机放置在图案上方三英尺(或一米)处,使主摄像头朝向图案且屏幕上的黄色标记与图案上的黄色标记在同一角落对齐。
图 4. 放置测试图案。
- 使图案一直完全位于摄像头的取景范围内,同时围绕图案以三个不同的方向旋转被测 Android 设备 (DUT):按照旋转范围指示图的提示,逐个方向进行旋转(1、2,然后是 3,如下图所示)。请保持平稳移动,以获得最准确的结果。
图 5. 操控被测设备。
- 拍照完成后,摄像头预览画面将会消失,而分析过程则会开始。耐心等待分析完成;该过程通常需要一到五分钟,具体取决于手机的性能。分析完成后,手机会发出提示音并振动。如果分析成功,屏幕上会出现数值结果。
图 6. 完成测试。
- 点击 NEXT 以转到通过/失败屏幕并查看结果。
图 7. 通过测试。
- 按照以下提示进行操作以获得最准确的结果:
- 这是一个比较复杂的手动测试,因此您可能需要尝试多次以获得最佳效果。
- 测试之前,应对加速度计、陀螺仪和磁力计进行校准,以获得良好效果。
问题排查
- 症状:启动测试用例时或视频录制刚刚完成后测试就崩溃了。
原因:可能存在 OpenCV Manager 兼容性问题。您可以检查 logcat
进行确认。如果确认是兼容性问题,则可以检查安装的 OpenCV Manager 的版本和架构。
- 症状:由于出现“太多无效帧”错误,测试频繁失败。
原因:可能是由于视频质量较低所致。请确认以下条件:
- 有充足的环境光源便于进行测试。自然光线的效果通常最好。但是,如果没有自然光线,来自多个角度且不会形成明显阴影的充足光线也可以达到效果。避免低角度光线,以减少眩光。
- 在视频拍摄期间动作应保持平稳。抖动会导致画面变模糊,并使计算机视觉软件产生混淆。
- 图案应始终完全位于视频预览范围内,并靠近中心位置。图案的大小应为视频预览窗口大小的 1/4 ~ 1/2。如果图案太小,则准确度会降低。如果图案太大,则镜头失真会更加明显,而且更难于将图案始终保持在视频录制取景范围内。
- 摄像头能够很好地聚焦。某些设备在视频录制过程中难以聚焦。这通常是因为场景变化太少,例如纯色的光滑地板表面。将测试图案移到具有纹理表面的位置或在测试图案周围放置物品,通常有助于解决该问题。
- 防抖功能已关闭。
- 症状:Pitch 和 Roll 测试正常,但 Yaw 测试经常失败。
原因:首先,确保磁场传感器校准结果正常。如果没有校准磁场传感器,则旋转矢量无法正常工作。
此外,偏航轴也可能因拍摄视频而出现故障。对于 Yaw 测试,请让设备保持稳定,然后围绕测试图案行走/移动。用手旋转设备时很难保持视频质量。
提交反馈
如果上述步骤无法解决问题,请务必按照以下反馈步骤报告您的问题。
请在报告错误时收集以下信息:
- Android 错误报告
- 屏幕截图(如果屏幕上有任何错误消息)。
/sdcard/RVCVRecData/
的内容。该文件夹包含视频文件,因此如果已进行多次测试,该文件夹可能会非常大。清空该文件夹后再重新执行测试将有助于减小文件夹大小。检查其中的视频文件,找出录制方面的明显问题。
- OpenCV Manager 应用的屏幕截图。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Rotation vector CV crosscheck\n\n**Figure 1.** Thumbnail of test pattern. Download the\nfull-resolution image linked above.\n\nThis page provides the steps to properly test the compatibility of your [rotation vector\nsensor](/docs/core/interaction/sensors/sensor-types#rotation_vector) implementation. This test should be run when the device declares the\nTYPE_ROTATION_VECTOR composite sensor feature.\n\nTest\n----\n\n1. Install OpenCV Manager on the Android device being tested.\n2. Download the `OpenCV-3.0.0-android-sdk.zip` package from [SourceForge.net](https://sourceforge.net/projects/opencvlibrary/files/opencv-android/3.0.0).\n3. Find the APK from the `apk` folder inside the downloaded archive. Load the APK on the device from a computer using the `adb install` command with the `--bypass-low-target-sdk-block` option. For devices running Android 13 or lower, this `--bypass-low-target-sdk-block` option isn't necessary. For more information, see [Install an app](http://developer.android.com/tools/help/adb#move).\n4. If there is an active account logged into Google Play, locate OpenCV Manager in Google Play\n and disable *Auto-update* in the context menu (the popup menu from the \"...\" button).\n\n\n **Figure 2.** Disabling Auto-update in Google Play.\n5. Print out the linked [test pattern](/static/docs/compatibility/cts/images/acircles_pattern.pdf), disabling any scaling options when printing. The pattern should fit US Letter paper in landscape or anything bigger.\n\n **Note:** The inline picture above is low\n resolution and just for illustration. Please do not directly print it as your\n pattern.\n6. Place the pattern on a horizontal surface.\n7. Start the **Rotation Vector CV Crosscheck** in the CTS Verifier app. Follow the guide to turn on airplane mode, turn off auto rotate, and adjust adaptive brightness and location if these changes have not been made. \n\n\n **Figure 3.** Initiating the test.\n8. When the video preview appears, place the phone three feet (or one meter) over the pattern so the main camera is facing the pattern with yellow marker on the screen and yellow marker on the pattern aligned at the same corner. \n\n\n **Figure 4.** Placing the test pattern.\n9. While keeping the pattern entirely in the camera view, rotate the Android device under test (DUT) around the pattern in three different directions, one by one (1, 2 and then 3 illustrated in picture below) as prompted by the rotation range indicator. Keep movement smooth and steady for the best result. \n\n\n **Figure 5.** Manipulating the device under test.\n10. After the capture, the camera preview will disappear and the analysis process will start. Wait patiently for analysis to finish; it usually takes one to five minutes depending on the phone performance. The phone will sound and vibrate at analysis completion. A numerical result will be presented on screen if the analysis is successful. \n\n\n **Figure 6.** Finishing the test.\n11. Click **next** to proceed to the pass/fail screen and review the result. \n\n\n **Figure 7.** Passing the test.\n12. Follow these tips for best results:\n 1. Since this is a manual test with complexity, you may want to try it a few times for the best results.\n 2. Accelerometer, gyroscope, and magnetometer should be calibrated before testing for good results.\n\nTroubleshoot\n------------\n\n1. Symptom: Test crashed when starting test case or immediately after finishing video recording. \n Cause: Likely an OpenCV Manager compatibility issue. Check `logcat` to confirm. If confirmed, check version and arch of the installed OpenCV Manager.\n2. Symptom: Test fails frequently due to \"Too many invalid frame\" errors. \n Cause: Likely due to video quality. Confirm the following conditions:\n 1. There is enough ambient lighting for the test. Natural light usually gives the best result. However, when it is not available, abundant light from multiple angles that does not form obvious shadows works, as well. Avoid low angle lighting to reduce glare.\n 2. The motion during video taking is smooth. Jerky movement causes blur and confuses the computer vision software.\n 3. The pattern should always be entirely in video preview frame and located around the center. The pattern should be 1/4 \\~ 1/2 the size of the video preview window. If the pattern is too small, the accuracy is reduced. If the pattern is too big, lens distortion is more obvious, and it is more difficult to keep the pattern always inside video recording frame.\n 4. The camera is able to focus well. Some devices have trouble in focusing during video recording. This is usually due to there is too few variations in the scene, e.g. solid color smooth floor surface. Moving test pattern to a place with textured surface or introducing objects around the test pattern usually helps.\n 5. Image stabilization is turned off.\n3. Symptom: The pitch and roll test works fine, but the yaw test regularly fails. \n Cause: First, make sure the magnetic field sensor is well calibrated. Rotation vector does not function well if magnetic field sensor is not calibrated. \n It is also possible that yaw axis fails due to video taking. Hold the device steady and walk/move around the test pattern for the yaw section of test. It is hard to maintain the quality of video while rotating device in hand.\n\nReport feedback\n---------------\n\nIf the steps above do not help, please make sure to follow the feedback steps below to report your issue.\n\nPlease gather the following information when reporting a bug:\n\n1. Android bugreport\n2. Screenshot if there is any error message on screen.\n3. Contents of `/sdcard/RVCVRecData/`. This folder contains video files and thus can be quite large if the test has already been taken multiple times. Clearing the folder and performing the test again will help reduce size. Inspect video files inside to find obvious issues in recording.\n4. Screenshot of the OpenCV Manager app."]]