Chinaunix首页 | 论坛 | 博客
  • 博客访问: 235762
  • 博文数量: 25
  • 博客积分: 643
  • 博客等级: 上士
  • 技术积分: 359
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-03 13:18
文章分类

全部博文(25)

文章存档

2017年(1)

2013年(1)

2012年(7)

2011年(16)

分类: LINUX

2011-05-28 11:50:13

  一 软硬件介绍

       USB摄像头   Teclast(台电)

       PCLinux    :虚拟机环境,Ubuntu 10.04Linux 2.6.32

 

摄像头的使用调试

摄像头信息查询

新版本的内核中Linux内核中已经包含了大部分的USB摄像头驱动,因此,在高版本的linux内核系统中使用USB摄像头并不需要做很多工作。

       Linux环境为Ubuntu 10.04Linux 2.6.32内核,已经包含了大部分USB摄像头的驱动程序,插上摄像头时即可识别。直接将我们USB摄像头插上,查看系统中USB设备信息。

root@Ubuntu1004:~# lsusb    //查看系统中的usb设备

Bus 002 Device 002: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 005: ID 0ac8:3450 Z-Star Microelectronics Corp.  

//显示干插入的USB设备信息,ID0ac8:3450,芯片厂商信息为Z-Star Microelectronics Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

root@Ubuntu1004:~# lsusb –v   //使用lsusb –v命令可以查看详细的usb设备信息

Bus 001 Device 002: ID 0ac8:3450 Z-Star Microelectronics Corp.

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass          239 Miscellaneous Device

  bDeviceSubClass         2 ?

  bDeviceProtocol         1 Interface Association

  bMaxPacketSize0        64

  idVendor           0x0ac8 Z-Star Microelectronics Corp.

  idProduct           0x3450    

  bcdDevice            1.a2

  iManufacturer           1 Vimicro Corp.

  iProduct                2 Altair USB2.0 Camera

  iSerial                 0

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength          481

    bNumInterfaces          2

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x80

      (Bus Powered)

    MaxPower              320mA

    Interface Association:

      bLength                 8

      bDescriptorType        11

      bFirstInterface         0

      bInterfaceCount         2

      bFunctionClass         14 Video

      bFunctionSubClass       3 Video Interface Collection

      bFunctionProtocol       0

      iFunction               2 Altair USB2.0 Camera

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      1 Video Control

      bInterfaceProtocol      0

      iInterface              2 Altair USB2.0 Camera

      VideoControl Interface Descriptor:

        bLength                13

        bDescriptorType        36

        bDescriptorSubtype      1 (HEADER)

        bcdUVC               1.00

        wTotalLength           79

        dwClockFrequency       30.000000MHz

        bInCollection           1

        baInterfaceNr( 0)       1

      VideoControl Interface Descriptor:

        bLength                18

        bDescriptorType        36

        bDescriptorSubtype      2 (INPUT_TERMINAL)

        bTerminalID             1

        wTerminalType      0x0201 Camera Sensor

        bAssocTerminal          0

        iTerminal               0

        wObjectiveFocalLengthMin      0

        wObjectiveFocalLengthMax      0

        wOcularFocalLength            0

        bControlSize                  3

        bmControls           0x0002002a

          Auto-Exposure Mode

          Exposure Time (Absolute)

          Focus (Absolute)

          Focus, Auto

      VideoControl Interface Descriptor:

        bLength                11

        bDescriptorType        36

        bDescriptorSubtype      5 (PROCESSING_UNIT)

      Warning: Descriptor too short

        bUnitID                 2

        bSourceID               1

        wMaxMultiplier          0

        bControlSize            2

        bmControls     0x0000177b

          Brightness

          Contrast

          Saturation

          Sharpness

          Gamma

          White Balance Temperature

          Backlight Compensation

          Gain

          Power Line Frequency

          White Balance Temperature, Auto

        iProcessing             0

        bmVideoStandards     0x 9

          None

          SECAM - 625/50

      VideoControl Interface Descriptor:

        bLength                 9

        bDescriptorType        36

        bDescriptorSubtype      3 (OUTPUT_TERMINAL)

        bTerminalID             3

        wTerminalType      0x0101 USB Streaming

        bAssocTerminal          0

        bSourceID               2

        iTerminal               0

      VideoControl Interface Descriptor:

        bLength                28

        bDescriptorType        36

        bDescriptorSubtype      6 (EXTENSION_UNIT)

        bUnitID                 4

        guidExtensionCode         {5dc717a9-1941-da11-ae0e-000d56ac7b4c}

        bNumControl             8

        bNrPins                 1

        baSourceID( 0)          1

        bControlSize            3

        bmControls( 0)       0x59

        bmControls( 1)       0x80

        bmControls( 2)       0x80

        iExtension              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x000a  1x 10 bytes

        bInterval               5

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       0

      bNumEndpoints           0

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      VideoStreaming Interface Descriptor:

        bLength                            14

        bDescriptorType                    36

        bDescriptorSubtype                  1 (INPUT_HEADER)

        bNumFormats                         1

        wTotalLength                      243

        bEndPointAddress                  130

        bmInfo                              0

        bTerminalLink                       3

        bStillCaptureMethod                 2

        bTriggerSupport                     1

        bTriggerUsage                       1

        bControlSize                        1

        bmaControls( 0)                    27

      VideoStreaming Interface Descriptor:

        bLength                            27

        bDescriptorType                    36

        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)

        bFormatIndex                        1

        bNumFrameDescriptors                5

        guidFormat                            {59555932-0000-1000-8000-00aa00389b71}

        bBitsPerPixel                      16

        bDefaultFrameIndex                  1

        bAspectRatioX                       0

        bAspectRatioY                       0

        bmInterlaceFlags                 0x00

          Interlaced stream or variable: No

          Fields per frame: 1 fields

          Field 1 first: No

          Field pattern: Field 1 only

          bCopyProtect                      0

      VideoStreaming Interface Descriptor:

        bLength                            34

        bDescriptorType                    36

        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

        bFrameIndex                         1

        bmCapabilities                   0x00

          Still image unsupported

        wWidth                            640

        wHeight                           480

        dwMinBitRate                   768000

        dwMaxBitRate                196608000

        dwMaxVideoFrameBufferSize      614400

        dwDefaultFrameInterval         333333

        bFrameIntervalType                  2

        dwFrameInterval( 0)            333333

        dwFrameInterval( 1)            666667

      VideoStreaming Interface Descriptor:

        bLength                            34

        bDescriptorType                    36

        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

        bFrameIndex                         2

        bmCapabilities                   0x00

          Still image unsupported

        wWidth                            352

        wHeight                           288

        dwMinBitRate                   768000

        dwMaxBitRate                196608000

        dwMaxVideoFrameBufferSize      202752

        dwDefaultFrameInterval         333333

        bFrameIntervalType                  2

        dwFrameInterval( 0)            333333

        dwFrameInterval( 1)            666667

      VideoStreaming Interface Descriptor:

        bLength                            34

        bDescriptorType                    36

        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

        bFrameIndex                         3

        bmCapabilities                   0x00

          Still image unsupported

        wWidth                            320

        wHeight                           240

        dwMinBitRate                   768000

        dwMaxBitRate                196608000

        dwMaxVideoFrameBufferSize      153600

        dwDefaultFrameInterval         333333

        bFrameIntervalType                  2

        dwFrameInterval( 0)            333333

        dwFrameInterval( 1)            666667

      VideoStreaming Interface Descriptor:

        bLength                            34

        bDescriptorType                    36

        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

        bFrameIndex                         4

        bmCapabilities                   0x00

          Still image unsupported

        wWidth                            176

        wHeight                           144

        dwMinBitRate                   768000

        dwMaxBitRate                196608000

        dwMaxVideoFrameBufferSize       50688

        dwDefaultFrameInterval         333333

        bFrameIntervalType                  2

        dwFrameInterval( 0)            333333

        dwFrameInterval( 1)            666667

      VideoStreaming Interface Descriptor:

        bLength                            34

        bDescriptorType                    36

        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

        bFrameIndex                         5

        bmCapabilities                   0x00

          Still image unsupported

        wWidth                            160

        wHeight                           120

        dwMinBitRate                   768000

        dwMaxBitRate                196608000

        dwMaxVideoFrameBufferSize       38400

        dwDefaultFrameInterval         333333

        bFrameIntervalType                  2

        dwFrameInterval( 0)            333333

        dwFrameInterval( 1)            666667

      VideoStreaming Interface Descriptor:

        bLength                            26

        bDescriptorType                    36

        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)

        bEndpointAddress                    0

        bNumImageSizePatterns               5

        wWidth( 0)                        640

        wHeight( 0)                       480

        wWidth( 1)                        352

        wHeight( 1)                       288

        wWidth( 2)                        320

        wHeight( 2)                       240

        wWidth( 3)                        176

        wHeight( 3)                       144

        wWidth( 4)                        160

        wHeight( 4)                       120

        bNumCompressionPatterns             5

      VideoStreaming Interface Descriptor:

        bLength                             6

        bDescriptorType                    36

        bDescriptorSubtype                 13 (COLORFORMAT)

        bColorPrimaries                     0 (Unspecified)

        bTransferCharacteristics            0 (Unspecified)

        bMatrixCoefficients                 0 (Unspecified)

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       1

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x0080  1x 128 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       2

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x0200  1x 512 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       3

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x0400  1x 1024 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       4

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x0b00  2x 768 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       5

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x0c00  2x 1024 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       6

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x1380  3x 896 bytes

        bInterval               1

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       7

      bNumEndpoints           1

      bInterfaceClass        14 Video

      bInterfaceSubClass      2 Video Streaming

      bInterfaceProtocol      0

      iInterface              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            5

          Transfer Type            Isochronous

          Synch Type               Asynchronous

          Usage Type               Data

        wMaxPacketSize     0x1400  3x 1024 bytes

        bInterval               1

Device Qualifier (for other device speed):

  bLength                10

  bDescriptorType         6

  bcdUSB               2.00

  bDeviceClass          239 Miscellaneous Device

  bDeviceSubClass         2 ?

  bDeviceProtocol         1 Interface Association

  bMaxPacketSize0        64

  bNumConfigurations      1

Device Status:     0x0000

  (Bus Powered)

 

root@Ubuntu1004:~# ls /dev/video0  //插上摄像头后,在/dev目录下生成video0设备节点

/dev/video0

 

root@Ubuntu1004:~# ls /dev/v4l/    //插上摄像头后,在/dev目录下生成v4l文件夹

by-id  by-path

 

root@Ubuntu1004:~# cat /dev/video0 > /home/user/sss.jpg

cat: /dev/video0: No such device

//使用cat命令不能打开/dev/video0设备节点,网上有人说可以这样输出摄像头的照片,可以我从来没有成功过。

 

  安装linux摄像头应用软件cheese

Cheese是一个可以捕获视频摄像头输出的程序,使用它你既可以生成照片,也能够录制视频。该程序自带了一些预设的效果,你能够即时将其应用到所捕获的照片和视频上,可简单方便地安装到Linux系统中。Cheese设置效果如图2.1所示。

2.1 cheese效果图

Ubuntu上安装Cheese可使用如下命令:

~# sudo apt-get install cheese

       安装成功后ApplicatiosàSound&Video下打开Cheese Webcam Booth即可进行拍照或者录制video。如图22.2和图2.3所示。

2.2 打开Cheese

2.3 使用cheese进行拍照

 

 

 


 

阅读(13651) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

kangear2013-03-24 15:37:30

cheese很好用,太好了,3Q。