<h2>Name</h2>

<b>uvc</b> - Interface to UVC cameras using <tt>libuvc</tt>

<h2>Synopsis</h2>

<tt>package require tcluvc</tt><br>
<tt>uvc <i>option</i> ?<i>arg

<h2>Description</h2>

This command provides several operations to interface UVC USB cameras using the infrastructure provided by <tt>libuvc</tt> and <tt>libusb</tt> which is available on common x86 Linux platforms and sometimes found on x86 based Android devices. indicates what to carry out. Any unique abbreviation for is acceptable. The valid options are:

<tt>uvc close

    Closes the device identified by which has been opened before using <tt>uvc open</tt>.

<tt>uvc counters</tt>

    Reports a three element list of statistic counters on the device identified by The first element is the number of video frames received, the second the number of video frames processed with <tt>uvc image</tt>, and the third the number of video frames dropped.

<tt>uvc devices</tt>

    Returns device information which can be used for <tt>uvc open</tt> as a list. Each device adds three elements to the list: a colon separated string with two or three fields (the device name) being vendor ID (hexadecimal, 0x prefix is optional), product ID (hexadecimal, 0x prefix is optional), and optional serial number string, the vendor name, and the product name. To open the device, the colon separated string must be used, the other two items are available for presentation purposes. If <tt>udev</tt> support is available, this list is refreshed on plug and unplug of devices. Otherwise, the list is a snapshot of suitable devices currently connected.

<tt>uvc format <i>devid</i> ?<i>index

    Returns or changes the frame format of the device identified by The optional parameter is an integer number giving the index of the frame format returned in <tt>uvc listformats</tt>. The optional parameter is the frame rate. If omitted, the currently active index and frame rate are returned. Changing the frame format and rate is only possible if the device is not capturing images.

<tt>uvc image <i>devid</i>

    Copies the most recent captured image of the device into the photo image identified by and returns non-zero on success or zero if no data transfer has taken place. If is omitted, a four element list is returned with the first element being the image width, the second the image height, the third the number of bytes per pixel, and the last the image's RGB values with 3 bytes per pixel in red, green, blue order as a byte array. In this case an error is indicated by throwing an exception.

<tt>uvc info

    Returns information on open devices. If is specified,
a list of two elements is returned, the first being the device nameand
the second the image callback command for that device, i.e. the same
arguments which were used on <tt>uvc open</tt>. If is omitted, a list of i.e. all currently opened devices is returned.

<tt>uvc listen

    Retrieves or sets the callback command called on plug and unplug of devices. When a device is plugged or unplugged that callback is invoked with two additional arguments: the type of event (<tt>add</tt> or <tt>remove</tt>) and the device name (see <tt>uvc devices</tt> for the naming convention) which was added or removed. Only usable if <tt>udev</tt> support is available.

<tt>uvc listformats

    Returns a dictionary keyed by a format index as integer with the values being another dictionary with information about the frame size and rate of the respective frame format. The returned indices can be used in in <tt>uvc format</tt> to switch to another frame size and/or to change the frame rate.

<tt>uvc mirror <i>devid</i> ?<i>x

    Retrieves or sets flags to mirror captured images along the X or Y axis. Parameters and if specified must be boolean values.

<tt>uvc open <i>devname

    Opens the device with device name and establishes as command to be invoked on captured images and finally returns a i.e. a handle to further deal with the device. An additional parameter is appended when is invoked: the of the device. For the format of see the description of <tt>uvc devices</tt>.

<tt>uvc orientation <i>devid</i>

    Retrieves or sets the orientation of captured images regarding image rotation. if specified must be an integer number.

<tt>uvc parameters <i>devid</i> ?<i>key value

    Returns or changes device parameters for the device identified by given as key-value pairs, e.g. <tt>brightness 100</tt> will change the brightness setting of captured images to the device dependent value 100. The command returns the current device parameters (after the potential change, when keys and values were given) as a key-value list which can be processed with <tt>array set</tt> or <tt>dict get</tt>.

<tt>uvc start

    Starts capturing images of the device identified by When an image is ready, the callback command set on <tt>uvc open</tt> is invoked.

<tt>uvc state

    Returns the image capture state of the device identified by The result is the string <tt>capture</tt> if the device is started, <tt>stopped</tt> if the device is stopped, or <tt>error</tt> if an error has been detected while image capture was active.

<tt>uvc stop

    Stop capturing images of the device identified by