Android调用外置USB摄像头

环境

某Android系统的POS机

AndroidSDK: 22 Android: 5.1.1

USB摄像头

intelRealSense

AliFacePayCamera

解决思路

根据网上的教程,先验证设备是否支持UVC。

将Android设备与开发机相连,并启用USB调试

adb shell

shell@xxxx:/ $ ls -l /dev/v*
crw-rw-rw- system   system    81,   9 2017-12-20 14:18 v4l-subdev0
crw-rw-rw- system   system    81,  10 2017-12-20 14:18 v4l-subdev1
crw-rw-rw- system   system    81,  19 2017-12-20 14:18 v4l-subdev10
crw-rw-rw- system   system    81,  20 2017-12-20 14:18 v4l-subdev11
crw-rw-rw- system   system    81,  11 2017-12-20 14:18 v4l-subdev2
crw-rw-rw- system   system    81,  12 2017-12-20 14:18 v4l-subdev3
crw-rw-rw- system   system    81,  13 2017-12-20 14:18 v4l-subdev4
crw-rw-rw- system   system    81,  14 2017-12-20 14:18 v4l-subdev5
crw-rw-rw- system   system    81,  15 2017-12-20 14:18 v4l-subdev6
crw-rw-rw- system   system    81,  16 2017-12-20 14:18 v4l-subdev7
crw-rw-rw- system   system    81,  17 2017-12-20 14:18 v4l-subdev8
crw-rw-rw- system   system    81,  18 2017-12-20 14:18 v4l-subdev9
crw-rw-rw- system   system    81,   0 2017-12-20 14:18 video0
crw-rw-rw- system   system    81,   1 2017-12-20 14:18 video1
crw-rw-rw- system   system    81,   2 2017-12-20 14:18 video2
crw-rw-rw- system   system    81,   3 2017-12-20 14:18 video3
crw-rw-rw- system   system    81,   4 2017-12-20 14:18 video4
crw-rw-rw- system   system    81,   5 2017-12-20 14:18 video5
crw-rw-rw- system   system    81,   6 2017-12-20 14:18 video6
crw-rw-rw- system   system    81,   7 2017-12-20 14:18 video7
crw-rw-rw- system   system    81,   8 2017-12-20 14:18 video8
crw-rw-rw- system   system    10,  42 2017-12-20 14:18 vr

插拔USB设备,再来一次

shell@xxxx:/ $ ls -l /dev/v*
crw-rw-rw- system   system    81,   9 2017-12-20 14:18 v4l-subdev0
crw-rw-rw- system   system    81,  10 2017-12-20 14:18 v4l-subdev1
crw-rw-rw- system   system    81,  19 2017-12-20 14:18 v4l-subdev10
crw-rw-rw- system   system    81,  20 2017-12-20 14:18 v4l-subdev11
crw-rw-rw- system   system    81,  11 2017-12-20 14:18 v4l-subdev2
crw-rw-rw- system   system    81,  12 2017-12-20 14:18 v4l-subdev3
crw-rw-rw- system   system    81,  13 2017-12-20 14:18 v4l-subdev4
crw-rw-rw- system   system    81,  14 2017-12-20 14:18 v4l-subdev5
crw-rw-rw- system   system    81,  15 2017-12-20 14:18 v4l-subdev6
crw-rw-rw- system   system    81,  16 2017-12-20 14:18 v4l-subdev7
crw-rw-rw- system   system    81,  17 2017-12-20 14:18 v4l-subdev8
crw-rw-rw- system   system    81,  18 2017-12-20 14:18 v4l-subdev9
crw-rw-rw- system   system    81,   0 2017-12-20 14:18 video0
crw-rw-rw- system   system    81,   1 2017-12-20 14:18 video1
crw-rw-rw- system   system    81,   2 2017-12-20 14:18 video2
crw-rw-rw- system   system    81,   3 2017-12-20 14:18 video3
crw-rw-rw- system   system    81,   4 2017-12-20 14:18 video4
crw-rw-rw- system   system    81,   5 2017-12-20 14:18 video5
crw-rw-rw- system   system    81,   6 2017-12-20 14:18 video6
crw-rw-rw- system   system    81,   7 2017-12-20 14:18 video7
crw-rw-rw- system   system    81,   8 2017-12-20 14:18 video8
crw-rw-rw- system   system    10,  42 2017-12-20 14:18 vr

没有任何变化,看来要不摄像头不支持UVC,要不就是没发现设备。

判断一个设备是否支持UVC协议

adb shell
cd sys/bus/usb/drivers
ls

如果存在uvcvedio文件夹则是支持协议

后来研究了下设备,目前排除AliFacePay摄像头,它采用的调用方式是OpenNI2,下面转入OpenNI2的研究。

android设备带宽不够

[11019*stream.c:1589: uvc_stream_start_bandwidth]:fail

未完待续……

转载于:https://my.oschina.net/daxian1110/blog/1855192

你可能感兴趣的:(Android调用外置USB摄像头)