Artifact [68d5a0a539]
Not logged in

Artifact 68d5a0a5399e90ad965b999260f64b1b387cb1e3:

Wiki page [wmf command] by chw 2016-08-14 18:14:55.
D 2016-08-14T18:14:55.349
L wmf\scommand
P d881bbe7fecdf87cd3f413633fa2f6612e8189a8
U chw
W 4729
<h2>Name</h2>

<b>wmf</b> - Tcl interface to cameras using Windows Media Foundation

<h2>Synopsis</h2>

<tt>package require tclwmf</tt><br>
<tt>wmf <i>option</i> ?<i>arg ...</i>?</tt>

<h2>Description</h2>

This  command  provides several operations to interface cameras using the infrastructure provided by Windows Media Foundation. <tt><i>option</i></tt> indicates what to carry out on  the  Windows Media Foundation subsystem. Any unique abbreviation for <tt><i>option</i></tt> is acceptable. The valid options are:

<tt>wmf close <i>devid</i></tt>

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

<tt>wmf devices</tt>

    Returns a list of device names which can be used for <tt>wmf open</tt>. Each device adds two elements to the list: its symbolic link to be used in <tt>wmf open</tt> and its friendly name for presentation.

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

    Returns or changes the media format of the device identified by <tt><i>devid</i></tt>. The optional parameter <tt><i>index</i></tt> is an integer number giving the index of the media format to be used as returned in <tt>wmf listformats</tt>. If omitted, the currently active index is returned. Changing the media format is only possible if the device is not capturing images.

<tt>wmf image <i>devid</i> ?<i>photoImage</i>?</tt>

    Copies the most recent captured image of the device <tt><i>devid</i></tt> into the photo image identified by <tt><i>photoImage</i></tt> and returns non-zero on success or zero if no data transfer has taken place. If <tt><i>photoImage</i></tt> 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>wmf info <i>devid</i></tt>

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

<tt>wmf listformats <i>devid</i></tt>

    Returns a dictionary keyed by a media format index as integer with the values being another dictionary with information about the frame size and rate of that media format. The respective index can be used in <tt>wmf format</tt>.

<tt>wmf mirror <i>devid</i> ?<i>x y</i>?</tt>

    Retrieves or sets flags to mirror captured images along the X or Y axis. Parameters <tt><i>x</i></tt> and <tt><i>y</i></tt> if specified must be boolean values.

<tt>wmf open <i>devname callback</i></tt>

    Opens the device with device symbolic link <tt><i>devname</i></tt> and establishes <tt><i>callback</i></tt> as command to be invoked on captured images and finally returns a <tt><i>devid</i></tt>, i.e. a handle to further deal with the device. Two additional parameters are appended when <tt><i>callback</i></tt> is invoked: the <tt><i>devid</i></tt> of the device and the current capture state as in <tt>wmf state</tt>. For the format of <tt><i>devname</i></tt> see the description of <tt>wmf devices</tt>.

<tt>wmf orientation <i>devid</i> ?<i>degrees</i>?</tt>

    Retrieves or sets the orientation of captured images regarding image rotation. <tt><i>degrees</i></tt> if specified must be an integer number.

<tt>wmf parameters <i>devid</i> ?<i>key value ...</i>?</tt>

    Returns or changes device parameters for the device identified by <tt><i>devid</i></tt> 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>wmf start <i>devid</i></tt>

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

<tt>wmf state <i>devid</i></tt>

    Returns the image capture state of the device identified by <tt><i>devid</i></tt>. The result is the string <tt>capture</tt> if the device is started, <tt>stopped</tt> if the device is stopped.

<tt>wmf stop <i>devid</i></tt>

    Stop capturing images of the device identified by <tt><i>devid</i></tt>.

Z e18955468446869c1d07049b8d880747