在做摄像头相关的项目时很可能会涉及到一些摄像头本身的参数查看。作为万能的linux,我们可以用luvcview这款软件查看所有基于UVC的摄像头的信息。(某宝上说的免驱摄像头其实就是依据UVC制作的摄像头,UVC作为一个协议已经被所有主流操作系统支持。)这款软件是写于12.04的ubuntu版本,当前16.04的ubuntu版本当中已经不提供默认的官方软件源下载了,不过原来12.04的版本还在网上可以查到。网址是这里。在页面右侧的luvcview_0.2.6-5_amd64.deb (52.3 KiB)超链接就是下载地址。
下载安装之后,打开terminal。用luvcview -d /dev/video0 -L
即可。其中/dev/video0就是我笔记本自带的UVC摄像头。如果你外接一个摄像头的话可能就是video1或者其他名字了。不过只要是在/dev/这个目录中出现的名字中带video的摄像头都是UVC摄像头!
在这个命令的输出中,你会看到一大串支持的格式,用我笔记本自带的摄像头为例:
luvcview 0.2.6
SDL information:
Video driver: x11
A window manager is available
Device information:
Device path: /dev/video0
{ pixelformat = 'YUYV', description = 'YUYV 4:2:2' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/8, 1/5,
{ pixelformat = 'MJPG', description = 'Motion-JPEG' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/30, 1/15,
{ pixelformat = 'RGB3', description = 'RGB3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/30, 1/15,
{ pixelformat = 'BGR3', description = 'BGR3' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/30, 1/15,
{ pixelformat = 'YU12', description = 'YU12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/30, 1/15,
{ pixelformat = 'YV12', description = 'YV12' }
{ discrete: width = 640, height = 480 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 160, height = 120 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 176, height = 144 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 320, height = 240 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 352, height = 288 }
Time interval between frame: 1/30, 1/15,
{ discrete: width = 1280, height = 720 }
Time interval between frame: 1/30, 1/15,
它支持的图像输出格式有:MJPG,YUYV,RGB3,BGR3,YV12,YU12。不同输出格式还对应了很多支持的分辨率,以及每帧之间的时间空隙,也就是帧数。这些信息基本上够了。
所以插上你自己的usb摄像头看看它都有哪些格式的支持吧!