Tech Tip: Remote Control of XCAP
|
Many end-user applications need the imaging support of PIXCI® imaging boards and XCAP, but require a custom user-interface. If programming convenience is more important than the raw efficiency of direct access to the XCOBJ and PXIPL "C" libraries, then XCAP offers a welcome compromise. For such applications, XCAP can be used as a hidden, off-screen, black box. The end-user application simply sends commands to XCAP, and receives processed images, or analyses results, in return. Familiarity with OLE, DDE, or other special Win API(s) isn't needed - any application that can manipulate files, can also remote control XCAP.
The remote control feature utilizes XCAP scripts. In XCAP, the "Scripts, Remote Control" feature is activated with a selected file name. XCAP then waits for a file with the specified name to appear, executes the file as a script, deletes the file to indicate completion, and repeats the process.
While writing the end-user application, XCAP is used to record one or more scripts, each recording implements a "command" to be later used by the end-user application. When running the end-user application, a "command" is executed by copying a previously recorded script to the selected file name (or, since script files are ascii text, simply writing the script to the selected file name), and then waiting for that file to be executed and deleted by XCAP.
Scripts can replicate most of a user's interactions within the windows of XCAP. A simple script for remote control might, (a) Set imaging board options, such as exposure time or video input, (b) Snap an image, and (c) Save the captured image to a file.
More advanced scripts can also perform analysis, such as, (a) Snap an image, (b) Perform blob analysis, and (c) Save the blob analysis results to a file.