Image Acquisition Toolbox 3 User’s Guide
How to Contact The MathWorks Web Newsgroup www.mathworks.com/contact_TS.html Technical Support www.mathworks.com comp.soft-sys.matlab suggest@mathworks.com bugs@mathworks.com doc@mathworks.com service@mathworks.com info@mathworks.com Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information 508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc.
Revision History March 2003 September 2003 June 2004 July 2004 October 2004 March 2005 March 2005 August 2005 September 2005 March 2006 September 2006 March 2007 September 2007 First printing Online only Online only Online only Online only Online only Second printing Third printing Online only Fourth printing Online only Online only Fifth printing New for Version 1.0 (Release 13+) Revised for Version 1.1 (Release 13SP1) Revised for Version 1.5 (Release 14) Revised for Version 1.
Contents Getting Started 1 What Is Image Acquisition Toolbox? . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installation and Configuration Notes . . . . . . . . . . . . . . . . . Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Supported Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1-2 1-3 1-3 1-3 The Image Acquisition Tool (GUI) . . . . . . . . . . . . . . . . .
Setting Up DCAM Devices . . . . . . . . . . . . . . . . . . . . . . . . . . Resetting Your Image Acquisition Hardware . . . . . . . . . . . A Note About Frame Rates and Processing Speed . . . . . . . 2-6 2-6 2-6 Previewing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Opening a Video Preview Window . . . . . . . . . . . . . . . . . . . . Stopping the Preview Video Stream . . . . . . . . .
Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26 Saving Image Acquisition Tool Configurations . . . . . . . 3-28 Exporting Hardware Configurations to MATLAB . . . . . 3-30 Connecting to Hardware 4 Getting Hardware Information . . . . . . . . . . . . . . . . . . . . . Getting Hardware Information . . . . . . . . . . . . . . . . . . . . . . Determining the Device Adaptor Name . . . . . . . . . . . . . . . . Determining the Device ID . . . . . . . . . . . . . .
Using the obj2mfile Command . . . . . . . . . . . . . . . . . . . . . . . 4-30 Acquiring Image Data 5 Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Trigger Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 5-3 5-4 Setting the Values of Trigger Properties . . . . . . . . . . . . . About Trigger Properties . . . . . . . . . . . . . . . . . . .
Logging Image Data to Disk . . . . . . . . . . . . . . . . . . . . . . . . Logging Data to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating an AVI File Object for Logging . . . . . . . . . . . . . . . Example: Logging Data to Disk . . . . . . . . . . . . . . . . . . . . . . 5-40 5-40 5-41 5-43 Working with Acquired Image Data 6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Bringing Image Data into the MATLAB Workspace . . .
Retrieving Event Information . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Event Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example: Accessing Data in the Event Log . . . . . . . . . . . . . 7-7 7-7 7-7 7-9 Creating and Executing Callback Functions . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating Callback Functions . .
Adding Support for Additional Hardware 9 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 For More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 Troubleshooting 10 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 Troubleshooting DALSA Coreco IFC Hardware . . . . . . . Troubleshooting DALSA Coreco IFC Devices . . . . . . . . . . .
Troubleshooting QImaging Hardware . . . . . . . . . . . . . . . 10-19 Troubleshooting QImaging Devices . . . . . . . . . . . . . . . . . . . 10-19 Determining the Driver Version for QImaging Devices . . . 10-20 Troubleshooting National Instruments Hardware . . . . 10-21 Troubleshooting National Instruments Devices . . . . . . . . . 10-21 Determining the Driver Version for National Instruments Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions — Alphabetical List 12 Properties — By Category 13 Video Input Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Acquisition Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Acquiring Image Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3 Working with Acquired Data . . . . . . . . . . . . . . . . . . . . . . . . A-3 Events and Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 Getting Started The best way to learn about the capabilities of Image Acquisition Toolbox is to look at a simple example. This chapter introduces the toolbox and illustrates the basic steps required to create an image acquisition application by implementing a simple motion detection application. The example contains cross-references to other sections in the documentation that provide more in-depth discussions of the relevant concepts. What Is Image Acquisition Toolbox? (p.
1 Getting Started What Is Image Acquisition Toolbox? In this section... “Overview” on page 1-2 “Installation and Configuration Notes” on page 1-3 “Related Products” on page 1-3 “Supported Hardware” on page 1-3 Overview Image Acquisition Toolbox is a collection of functions that extend the capability of the MATLAB® numeric computing environment.
What Is Image Acquisition Toolbox? Installation and Configuration Notes To determine if Image Acquisition Toolbox is installed on your system, type this command at the MATLAB prompt: ver When you enter this command, MATLAB displays information about the version of MATLAB you are running, including a list of all toolboxes installed on your system and their version numbers. For information about installing the toolbox, see the MATLAB Installation Guide for your platform.
1 Getting Started The Image Acquisition Tool (GUI) In Version 2.0 of the toolbox, the functionality of Image Acquisition Toolbox is available in a desktop application. You connect directly to your hardware in the tool and can set acquisition parameters, and preview and acquire image data. You can log the data to MATLAB in several formats, and also generate an AVI file, right from the tool. To open the tool, select Start > Toolboxes > Image Acquisition > Image Acquisition Tool from MATLAB.
Basic Image Acquisition Procedure Basic Image Acquisition Procedure In this section...
1 Getting Started To use Image Acquisition Toolbox to acquire image data, you must perform the following basic steps: Step Description Step 1: Install and configure your image acquisition device Step 2: Retrieve information that uniquely identifies your image acquisition device to Image Acquisition Toolbox Step 3: Create a video input object Step 4: Preview the video stream (Optional) Step 5: Configure image acquisition object properties (Optional) Step 6: Acquire image data Step 7: Clean u
Basic Image Acquisition Procedure Step 2: Retrieve Hardware Information In this step, you get several pieces of information that the toolbox needs to uniquely identify the image acquisition device you want to access. You use this information when you create an image acquisition object, described in “Step 3: Create a Video Input Object” on page 1-9. The following table lists this information. You use the imaqhwinfo function to retrieve each item.
1 Getting Started Determining the Adaptor Name To determine the name of the adaptor, enter the imaqhwinfo function at the MATLAB prompt without any arguments. imaqhwinfo ans = InstalledAdaptors: MATLABVersion: ToolboxName: ToolboxVersion: {'dcam' 'winvideo'} '7.4 (R2007a)' 'Image Acquisition Toolbox' '2.1 (R2007a)' In the data returned by imaqhwinfo, the InstalledAdaptors field lists the adaptors that are available on your computer.
Basic Image Acquisition Procedure DeviceInfo: [1x1 struct] Determining the Supported Video Formats To determine which video formats an image acquisition device supports, look in the DeviceInfo field of the data returned by imaqhwinfo. The DeviceInfo field is a structure array where each structure provides information about a particular device. To view the device information for a particular device, you can use the device ID as a reference into the structure array.
1 Getting Started ObjectConstructor field. For more information the device information structure, see “Determining the Supported Video Formats” on page 1-9. The following example creates a video input object for the DCAM adaptor. Substitute the adaptor name of the image acquisition device available on your system. vid = videoinput('dcam',1,'Y8_1024x768') The videoinput function accepts three arguments: the adaptor name, device ID, and video format. You retrieved this information in step 2.
Basic Image Acquisition Procedure 'Y8_1024x768' video data to be logged upon START. Grabbing first of every 1 frame(s). Log data to 'memory' on trigger. Trigger Parameters: Status: 1 'immediate' trigger(s) on START. Waiting for START. 0 frames acquired since starting. 0 frames available for GETDATA. Step 4: Preview the Video Stream (Optional) After you create the video input object, MATLAB is able to access the image acquisition device and is ready to acquire data.
1 Getting Started The following figure shows the Video Preview window for the example. Video Preview Window To close the Video Preview window, click the Close button in the title bar or use the closepreview function, specifying the video input object as an argument. closepreview(vid) Calling closepreview without any arguments closes all open Video Preview windows.
Basic Image Acquisition Procedure Step 5: Configure Object Properties (Optional) After creating the video input object and previewing the video stream, you might want to modify characteristics of the image or other aspects of the acquisition process. You accomplish this by setting the values of image acquisition object properties.
1 Getting Started get(vid) The get function lists all the properties of the object with their current values.
Basic Image Acquisition Procedure Note Video source object properties are device specific. The list of properties supported by the device connected to your system might differ from the list shown in this example.
1 Getting Started by referencing the property as you would reference a field in a MATLAB structure. vid.FrameGrabInterval = 5; To set the value of a video source object property, you must first use the getselectedsource function to retrieve the object. (You can also get the selected source by searching the video input object Source property for the video source object that has the Selected property set to 'on'.) To illustrate, the example assigns a value to the Tag property.
Basic Image Acquisition Procedure In the example, because the TriggerType property is set to 'immediate' (the default) and the TriggerRepeat property is set to Inf, the object automatically begins executing triggers and acquiring frames of data, continuously. • Bringing data into the MATLAB workspace — The toolbox stores acquired data in a memory buffer, a disk file, or both, depending on the value of the video input object LoggingMode property.
1 Getting Started Note The example uses functions in Image Processing Toolbox. % Create video input object. vid = videoinput('dcam',1,'Y8_1024x768') % Set video input object properties for this application. % Note that example uses both SET method and dot notation method. set(vid,'TriggerRepeat',Inf); vid.FrameGrabInterval = 5; % Set value of a video source object property. vid_src = getselectedsource(vid); set(vid_src,'Tag','motion detection setup'); % Create a figure window.
Basic Image Acquisition Procedure The following figure shows how the example displays detected motion. In the figure, areas representing movement are displayed. Figure Window Displayed by Example Image Data in the MATLAB Workspace In the example, the getdata function returns the image frames in the variable data as a 480-by-640-by-1-by-10 array of 8-bit data (uint8).
1 Getting Started The third dimension represents the number of color bands in the image. Because the example data is a grayscale image, the third dimension is 1. For RGB formats, image frames have three bands: red is the first, green is the second, and blue is the third. The fourth dimension represents the number of frames that have been acquired from the video stream.
2 Introduction This chapter describes Image Acquisition Toolbox and its components. Overview (p. 2-2) Provides an overview of Image Acquisition Toolbox Setting Up Image Acquisition Hardware (p. 2-5) Describes how to set up your image acquisition device Previewing Data (p.
2 Introduction Overview In this section... “Introduction” on page 2-2 “Toolbox Components” on page 2-3 “The Image Acquisition Tool (GUI)” on page 2-3 “Supported Devices” on page 2-4 Introduction Image Acquisition Toolbox implements an object-oriented approach to image acquisition. Using toolbox functions, you create an object that represents the connection between MATLAB and specific image acquisition devices.
Overview Toolbox Components The toolbox uses components called hardware device adaptors to connect to devices through their drivers. The toolbox includes adaptors that support devices produced by several vendors of image acquisition equipment. In addition, the toolbox includes an adaptor for generic Windows video acquisition devices. The following figure shows these components and their relationship. Image Acquisition Toolbox Components The Image Acquisition Tool (GUI) In Version 2.
2 Introduction data. You can log the data to MATLAB in several formats, and also generate an AVI file, right from the tool. To open the tool, select Start > Toolboxes > Image Acquisition > Image Acquisition Tool from MATLAB. The tool has extensive Help in the desktop. As you click in different panes of the user interface, the relevant Help appears in the Image Acquisition Tool Help pane. Most of the User’s Guide describes performing tasks using the toolbox via the MATLAB command line.
Setting Up Image Acquisition Hardware Setting Up Image Acquisition Hardware In this section... “Introduction” on page 2-5 “Setting Up Frame Grabbers” on page 2-5 “Setting Up Generic Windows Video Acquisition Devices” on page 2-6 “Setting Up DCAM Devices” on page 2-6 “Resetting Your Image Acquisition Hardware” on page 2-6 “A Note About Frame Rates and Processing Speed” on page 2-6 Introduction To acquire image data, you must perform the setup required by your particular image acquisition device.
2 Introduction Setting Up Generic Windows Video Acquisition Devices IEEE 1394 (FireWire) and generic Windows video acquisition devices that use Windows Driver Model (WDM) or Video for Windows (VFW) device drivers typically require less setup. Plug the device into the USB or IEEE 1394 (FireWire) port on your computer and install the device driver provided by the vendor.
Setting Up Image Acquisition Hardware The rate at which Image Acquisition Toolbox can process images depends on the processor speed, the complexity of the processing algorithm, and the frame rate. Given a fast processor, a simple algorithm, and a frame rate tuned to the acquisition setup, Image Acquisition Toolbox can process data as it comes in.
2 Introduction Previewing Data In this section... “Introduction” on page 2-8 “Opening a Video Preview Window” on page 2-9 “Stopping the Preview Video Stream” on page 2-10 “Closing a Video Preview Window” on page 2-11 “Previewing Data in Custom GUIs” on page 2-11 “Performing Custom Processing of Previewed Data” on page 2-13 Introduction After you connect MATLAB to the image acquisition device (see Chapter 4, “Connecting to Hardware”), you can view the live video stream using the Video Preview window.
Previewing Data • “Performing Custom Processing of Previewed Data” on page 2-13 Opening a Video Preview Window To open a Video Preview window, use the preview function. The Video Preview window displays the live video stream from the device. You can only open one preview window per device. If multiple devices are used, you can open multiple preview windows at the same time. The following example creates a video input object and then opens a Video Preview window for the video input object.
2 Introduction Stopping the Preview Video Stream When you use the preview function to start previewing image data, the Video Preview window displays a view of the live video stream coming from the device. To stop the updating of the live video stream, call the stoppreview function. This example creates a video input object and opens a Video Preview window. The example then calls the stoppreview function on this video input object.
Previewing Data To restart the video stream in the Video Preview window, call preview again on the same video input object. preview(vid) Closing a Video Preview Window To close a particular Video Preview window, use the closepreview function, specifying the video input object as an argument. You do not need to stop the live video stream displayed in the Video Preview window before closing it.
2 Introduction % Create a video input object. vid = videoinput('winvideo'); % Create a figure window. This example turns off the default % toolbar, menubar, and figure numbering. figure('Toolbar','none',... 'Menubar', 'none',... 'NumberTitle','Off',... 'Name','My Preview Window'); % Create the image object in which you want to display % the video preview data. Make the size of the image % object match the dimensions of the video frames.
Previewing Data Performing Custom Processing of Previewed Data When you specify an image object to the preview function (see “Previewing Data in Custom GUIs” on page 2-11), you can optionally also specify a function that preview executes every time it receives an image frame. To use this capability, follow these steps: 1 Create the function you want executed for each image frame, called the update preview window function.
2 Introduction Argument Description event A data structure containing the following fields: Data Current image frame specified as an H-by-W-by-B array, where H is the image height and W is the image width, as specified in the ROIPosition property, and B is the number of color bands, as specified in the NumberOfBands property Resolution Text string specifying the current image width and height, as defined by the ROIPosition property Status String describing the status of the video input object Tim
Previewing Data ht = getappdata(himage,'HandleToTimestampLabel'); % Set the value of the text label. set(ht,'String',tstampstr); % Display image data. set(himage, 'CData', event.Data) Specifying the Update Preview Function To use an update preview window function, store a function handle to your function in the 'UpdatePreviewWindowFcn' application-defined data of the image object.
2 Introduction % Set up the push buttons uicontrol('String', 'Start Preview',... 'Callback', 'preview(vid)',... 'Units','normalized',... 'Position',[0 0 0.15 .07]); uicontrol('String', 'Stop Preview',... 'Callback', 'stoppreview(vid)',... 'Units','normalized',... 'Position',[.17 0 .15 .07]); uicontrol('String', 'Close',... 'Callback', 'close(gcf)',... 'Units','normalized',... 'Position',[0.34 0 .15 .
Previewing Data % Make handle to text label available to update function. setappdata(hImage,'HandleToTimestampLabel',hTextLabel); preview(vid, hImage); When you run this example, it creates the GUI shown in the following figure. Each time preview receives a video frame, it calls the update preview window function that you specified, which updates the timestamp text label in the GUI.
2 2-18 Introduction
3 Using the Image Acquisition Tool GUI The Image Acquisition Tool Desktop (p. 3-2) Describes opening the tool and all the parts of the desktop user interface Selecting Your Device (p. 3-5) Describes selecting a device and format, adding new hardware, and using a camera file Setting Acquisition Parameters (p.
3 Using the Image Acquisition Tool GUI The Image Acquisition Tool Desktop In this section... “Opening the Tool” on page 3-2 “Parts of the Desktop” on page 3-2 Opening the Tool The functionality of Image Acquisition Toolbox is now available in a desktop application. You connect directly to your hardware in the tool and can preview and acquire image data. You can log the data to MATLAB in several formats, and also generate an AVI file, right from the tool.
The Image Acquisition Tool Desktop • Hardware Browser – Shows the image acquisition devices currently connected to your system. Each device is a separate node in the browser. All of the formats the device supports are listed under the device. Each device’s default format is indicated in parentheses. Select the device format or camera file you want to use for the acquisition. When the format is selected, you can then set acquisition parameters and preview your data.
3 Using the Image Acquisition Tool GUI See “Selecting Your Device” on page 3-5 for more information about using the Hardware Browser. • Preview window – Use to preview and acquire image data from the selected device format, and to export data that has been acquired in memory to a MAT-file or the MATLAB Workspace. See “Previewing and Acquiring Data” on page 3-19 for more information about using the Preview window.
Selecting Your Device Selecting Your Device In this section... “Selecting a Device and Format” on page 3-5 “Adding New Hardware” on page 3-6 “Using a Camera File” on page 3-7 Selecting a Device and Format The Hardware Browser pane shows the image acquisition devices currently connected to your system. Each device is a separate node in the browser. All of the formats the device supports are listed under the device. Each device’s default format is indicated in parentheses.
3 Using the Image Acquisition Tool GUI Select the device format or camera file you want to use for the acquisition by clicking its name in the tree. When the format is selected, you can then set acquisition parameters and preview your data. Adding New Hardware When you open the Image Acquisition Tool, the Hardware Browser automatically shows the image acquisition devices supported by the toolbox that are currently connected to your system.
Selecting Your Device Acquisition Hardware to display the new device in the Hardware Browser. Using a Camera File If your device supports the use of a camera file, also known as a device configuration file, you can select it under the device name in the Hardware Browser. For example, some frame grabbers support them. Under the device name in the Hardware Browser, you would see a node that says Click to add camera file... if the device supports the use of camera files.
3 Using the Image Acquisition Tool GUI Setting Acquisition Parameters In this section...
Setting Acquisition Parameters Setting Frames Per Trigger The Frames Per Trigger field on the General tab is used to set the number of frames per trigger you want to acquire. • If you want your acquisition to be a specific number of frames per trigger, use the default of 1 frame, or use the arrows to select the number of frames or type in the number.
3 Using the Image Acquisition Tool GUI Note Some devices need a few frames to warm up, or may always skip the first frame. If your device does that, change the number of frames accordingly to adjust for that. You can also adjust for camera warm-up by using manual triggering on the Triggering tab. Setting the Color Space Use Color Space on the General tab to set the color space for the selected device format. The Returned Color Space field has three options: rgb, YCbCr, and grayscale.
Setting Acquisition Parameters 3 Start your acquisition using those settings. Setting Device-Specific Parameters Use the Device Properties tab to view or change device-specific properties. The selected device’s properties appear in the table. The specific properties that show up depend on your device. The Selected Source field is the source name of the selected device. Many device adaptors only have one input source, so for example, this might show something like input1, port1, or input0 by default.
3 Using the Image Acquisition Tool GUI Use the properties table to view or edit properties: • If a property has a pencil icon in the value column of the table, then that value is editable. • If a property has an arrow indicating a drop-down list, then you can select a value from the list. • If a property has a value listed that is grayed out, then that value is not editable.
Setting Acquisition Parameters Logging Your Data Use the Logging tab to set up logging options. This determines where your data is logged to when you do an acquisition. Use the Logging To field to select where your acquisition will be logged. Select one of the following: • Memory – Acquisition will be logged to memory. This means that the acquired data that you don’t otherwise save (using Export Data) will be logged to your system’s memory, and will be available to you only during the acquisition session.
3 Using the Image Acquisition Tool GUI Memory Logging If you select Memory or Disk and Memory in the Logging To field, the Memory Limit field will display how much memory is available on your system. This is equal to the total number of bytes image acquisition frames can occupy in memory. By default, the tool sets this limit to equal all available physical memory at the time the tool is first used, or 1 GB, whichever is less.
Setting Acquisition Parameters 4 Set your Frame Rate, which is the rate in frames per second that the logged AVI file is displayed when you play it back. Keep the default of 15 or enter a new rate. Setting Up Triggering Use the Triggering tab to set up triggering options. The total number of frames that will be acquired when you start an acquisition depends on what is set in the Frames Per Trigger field on the General tab and the Number of Triggers field on the Triggering tab.
3 Using the Image Acquisition Tool GUI triggers, you stop the acquisition manually by clicking the Stop Acquisition button in the Preview window. Selecting the Trigger Type The default of Immediate means that when you start an acquisition using the Start Acquisition button, the acquisition begins immediately. If you change the setting to Manual, the Trigger button is activated in the Preview window, and you use it to start the acquisition.
Setting Acquisition Parameters To perform hardware triggering: 1 Select your device format and optionally click Start Preview to preview the device. 2 Optionally set any acquisition parameters and stop the preview. 3 Select Hardware in the Trigger Type field on the Triggering tab. 4 Select your Trigger Source. This indicates the hardware source that is monitored for trigger conditions. When the condition specified in Trigger Condition is met, the trigger is executed and the acquisition starts.
3 Using the Image Acquisition Tool GUI 6 Click the Start Acquisition button to get live feed from the device. 7 When the Trigger Condition is met, the acquisition begins. If you have a defined number of triggers (not infinite), then the acquisition will stop when you have acquired that number of frames, based on the Frames Per Trigger field on the General tab. If Number of Triggers is set to infinite, use the Stop Acquisition button to stop the acquisition.
Previewing and Acquiring Data Previewing and Acquiring Data In this section... “The Preview Window” on page 3-19 “Previewing Data” on page 3-21 “Acquiring Data” on page 3-21 The Preview Window The Preview window displays the image data when you preview or acquire data.
3 Using the Image Acquisition Tool GUI Use the buttons in the Preview window to: • Preview your image. See “Previewing Data” on page 3-21 for more information. • Acquire data. See “Acquiring Data” on page 3-21 for more information.
Previewing and Acquiring Data • Export data. See “Exporting Data” on page 3-26 for more information. Below the area that displays the frames you will see text messages with information relative to the current state of the window. For example in the figure above, that text indicates that all the frames that were acquired are being displayed. After you start and stop a preview, the text will indicate that the tool is ready to acquire data.
3 Using the Image Acquisition Tool GUI The nodes listed under the device name are the formats the device supports. They may correspond to the different resolutions and color spaces that your device supports, or to different video standards or camera configurations. This information comes from your device adaptor. Select the format you want to use. See “Selecting Your Device” on page 3-5 for more information about devices and formats.
Previewing and Acquiring Data For more information about logging, see “Logging Your Data” on page 3-13. 6 Start the acquisition by clicking the Start Acquisition button. • If you set Trigger Type (on the Triggering tab) to Immediate, the tool will immediately start logging data. • If you set Trigger Type to Manual, click the Trigger button when you want to start logging data. For more information about manual triggering, see “Setting Up Triggering” on page 3-15.
3 Using the Image Acquisition Tool GUI If Images Are Blurry or Dark If the first one or more frames of your acquisition are blurry, black, or of low quality, your camera may need to warm up before you capture frames.
Previewing and Acquiring Data You can allow for device warm-up by using manual triggering. This allows you to start the acquisition after the device has warmed up and is acquiring image data that meets your needs. To use manual triggering, go to the Triggering tab of the Acquisition Parameters pane and select Manual in the Trigger Type field. For more detailed instructions about manual triggering, see “Selecting the Trigger Type” on page 3-16.
3 Using the Image Acquisition Tool GUI Exporting Data You can export the data that has been acquired in memory to a MAT-file or the MATLAB Workspace. To export the acquisition data: 1 Click the Export Data button in the Preview window to export the last acquisition that was logged to memory. 2 In the Data Exporter dialog box, select MAT-File or MATLAB Workspace from the Data Destination list. 3 In the Variable Name field, enter a name for the new variable, and click OK.
Exporting Data 4 If you exported to the MATLAB Workspace, the dialog box closes and the data will be saved to the MATLAB Workspace. If you are exporting to a MAT-File, the Export to MAT-File dialog box opens. Select the save location and type a file name, and then click Save. Note that this export is to a MAT-file or the MATLAB Workspace. To export image data to an AVI file, use the disk logging feature on the Logging tab of the Acquisition Parameters pane.
3 Using the Image Acquisition Tool GUI Saving Image Acquisition Tool Configurations You can save the configuration information about any of your device formats. This includes any parameters you set on any of the tabs in the Acquisition Parameters pane. Then when you return to the tool, you can load the configuration so that you do not have to reset those parameters. To save a configuration: 1 Select File > Save Configuration. The Save Configuration dialog box opens.
Saving Image Acquisition Tool Configurations The configuration is saved to an Image Acquisition Tool (IAT) file in the location you specified. You can then open the saved configuration file in a future tool session by selecting File > Open Configuration. In the Open Configuration dialog box, browse to an IAT file and click Open. Note You can also export hardware configuration information to other formats such as an M-file or a MAT-file that can be accessed from MATLAB.
3 Using the Image Acquisition Tool GUI Exporting Hardware Configurations to MATLAB You can export the video input objects and their configured parameters from the tool to a choice of multiple formats. You can then access the video object in MATLAB. To export a hardware configuration: 1 Select File > Export Hardware Configuration. The Object Exporter dialog box opens. 2 Select the file format from the Object destination list.
Exporting Hardware Configurations to MATLAB 3 Decide what object configuration(s) to export. The Object Exporter dialog box lists the currently selected device format, as well as any others you selected in the Hardware Browser during the tool session. All formats are selected by default, meaning their configurations will be saved. If you do not want to save a configuration, clear it from the list. 4 Click Save.
3 3-32 Using the Image Acquisition Tool GUI
4 Connecting to Hardware To connect to an image acquisition device from within MATLAB, you must create a video input object. This object represents the connection between MATLAB and the device. You can use object properties to control various aspects of the acquisition. Before you can create the object, you need several pieces of information about the device that you want to connect to. This chapter describes tasks related to establishing a connection between MATLAB and an image acquisition device.
4 4-2 Connecting to Hardware Deleting Image Acquisition Objects (p. 4-28) Describes how to delete the image acquisition objects you create Saving Image Acquisition Objects (p.
Getting Hardware Information Getting Hardware Information In this section...
4 Connecting to Hardware visit the Image Acquisition Toolbox product page at the MathWorks Web site (www.mathworks.com/products/imaq). To determine which adaptors are available on your system, call the imaqhwinfo function. The imaqhwinfo function returns information about the toolbox software and lists the adaptors available on the system in the InstalledAdaptors field. In this example, there are two adaptors available on the system.
Getting Hardware Information info = imaqhwinfo('matrox'); info = AdaptorDllName: AdaptorDllVersion: AdaptorName: DeviceIDs: DeviceInfo: [1x73 char] '2.1 (R2007a)' 'matrox' {[1]} [1x1 struct] The fields in the structure returned by imaqhwinfo provide the following information.
4 Connecting to Hardware DefaultFormat: DeviceFileSupported: DeviceName: DeviceID: ObjectConstructor: SupportedFormats: 'M_RS170' 1 'Orion' 1 'videoinput('matrox', 1)' {1x10 cell} The fields in the device information structure provide the following information about a device.
Getting Hardware Information Image acquisition devices typically support multiple video formats. You can specify the video format when you create the video input object to represent the connection to the device. See “Creating Image Acquisition Objects” on page 4-9 for more information. Note Specifying the video format is optional; the toolbox uses one of the supported formats as the default.
4 Connecting to Hardware M_RS170_VIA_RGB ans{3} = M_CCIR ans{4} = M_CCIR_VIA_RGB ans{5} = M_NTSC ans{6} = M_NTSC_RGB ans{7} = M_NTSC_YC ans{8} = M_PAL ans{9} = M_PAL_RGB ans{10} = M_PAL_YC 4-8
Creating Image Acquisition Objects Creating Image Acquisition Objects In this section...
4 Connecting to Hardware At any one time, only one of the video source objects, called the selected source, can be active. This is the source used for acquisition. The toolbox selects one of the video source objects by default, but you can change this selection. See “Specifying the Selected Video Source Object” on page 4-15 for more information. The following figure illustrates how a video input object acts as a container for one or more video source objects.
Creating Image Acquisition Objects default videoinput syntax in the ObjectConstructor field of the device information structure. vid = videoinput('matrox'); This syntax uses the default video format listed in the DefaultFormat field of the data returned by imaqhwinfo. You can optionally specify the video format. See “Specifying the Video Format” on page 4-12 for more information.
4 Connecting to Hardware format, the toolbox creates a video source object for each connection. For an example showing the video source objects created with another video format, see “Specifying the Video Format” on page 4-12. 3 The Acquisition Parameters section lists the values of key video input object properties. These properties control various aspects of the acquisition, such as the number of frames to acquire and the location where acquired frames are stored.
Creating Image Acquisition Objects The following sections describe these options. If you do not specify a video format, the videoinput function uses one of the video formats supported by the device. For Matrox and Data Translation devices, it chooses the RS170 video format. For Windows devices, it uses the first RGB format in the list of supported formats or, if no RGB formats are supported, the device’s default format.
4 Connecting to Hardware Note For Matrox devices, the M_NTSC_RGB format string represents a component video format. This example creates a video input object, specifying a color video format. vid2 = videoinput('matrox', 1,'M_NTSC_RGB'); Using Device Configuration Files (Camera Files) For some devices, you can use a device configuration file, also known as a camera file, to specify the video format as well as other configuration settings.
Creating Image Acquisition Objects This example creates a video input object specifying a Matrox device configuration file as an argument. Specifying the Selected Video Source Object When you create a video input object, the toolbox creates one or more video source objects associated with the video input object. The number of video source objects created depends on the device and the video format. The Source property of the video input object lists these video source objects.
4 Connecting to Hardware By default, the video input object makes the first video source object in the array the selected source. To use another video source, change the value of the SelectedSourceName property. This example changes the currently selected video source object from CH0 to CH1 by setting the value of the SelectedSourceName property. vid.
Configuring Image Acquisition Object Properties Configuring Image Acquisition Object Properties In this section...
4 Connecting to Hardware Note Three video input object trigger properties require the use of a special configuration function. For more information, see “Setting Trigger Properties” on page 4-23. Viewing the Values of Object Properties To view all the properties of an image acquisition object, with their current values, use the get function. You can also use the inspect function to view a list of object properties in the Property Inspector window, where you can also edit their values.
Configuring Image Acquisition Object Properties Type = videoinput UserData = [] VideoFormat = M_RS170 VideoResolution = [640 480] Callback Function Settings: ErrorFcn = @imaqcallback FramesAcquiredFcn = [] FramesAcquiredFcnCount = 0 StartFcn = [] StopFcn = [] TimerFcn = [] TimerPeriod = 1 TriggerFcn = [] Trigger Settings: InitialTriggerTime = [0 0 0 0 0 0] TriggerCondition = none TriggerFrameDelay = 0 TriggerRepeat = 0 TriggersExecuted = 0 TriggerSource = none TriggerType = immediate Acquisition Sources: S
4 Connecting to Hardware Note The video source object for your device might not include device-specific properties. For example, devices accessed with the 'winvideo' adaptor, such as webcams, that use a Video for Windows (VFW) driver, may not provide a way for the toolbox to programmatically query for device properties. Use the configuration tools provided by the manufacturer to configure these devices.
Configuring Image Acquisition Object Properties vid.Previewing ans = off Getting Information About Object Properties To get information about a particular property, you can view the reference page for the property in Chapter 13, “Properties — By Category” and Chapter 14, “Properties — Alphabetical List”. You can also get information about a particular property at the command line by using the propinfo or imaqhelp functions.
4 Connecting to Hardware Note Because some properties are read only, only a subset of all video input and video source properties can be set. This example uses the set function to set the value of the LoggingMode property. set(vid,'LoggingMode','disk&memory') To verify the new value of the property, use the get function. get(vid,'LoggingMode') ans = disk&memory This example sets the value of a property by assigning the value to the object as if it were a MATLAB structure. vid.LoggingMode = 'disk'; vid.
Configuring Image Acquisition Object Properties Setting Trigger Properties The values of certain trigger properties, TriggerType, TriggerCondition, and TriggerSource, are interrelated. For example, some TriggerCondition values are only valid with specific values of the TriggerType property.
4 Connecting to Hardware Starting and Stopping a Video Input Object When you create a video input object, you establish a connection between MATLAB and an image acquisition device. However, before you can acquire data from the device, you must start the object, using the start function. start(vid); When you start an object, you reserve the device for your exclusive use and lock the configuration. Thus, certain properties become read only while running.
Starting and Stopping a Video Input Object The following figure illustrates how an object moves from a running to a stopped state. Transitions from Running to Stopped States The following example illustrates starting and stopping an object: 1 Create an image acquisition object — This example creates a video input object for a webcam image acquisition device.
4 Connecting to Hardware Configure an acquisition that takes several seconds so that you can see the video input in logging state. vid.FramesPerTrigger = 100; 4 Start the image acquisition object — Call the start function to start the image acquisition object. start(vid) 5 Verify that the image is running but not logging — Use the isrunning and islogging functions to determine the current state of the video input object.
Starting and Stopping a Video Input Object After it acquires the specified number of frames, the video input object stops running. isrunning(vid) ans = 0 7 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
4 Connecting to Hardware Deleting Image Acquisition Objects When you finish using your image acquisition objects, use the delete function to remove them from memory. After deleting them, clear the variables that reference the objects from the MATLAB workspace by using the clear function. Note When you delete a video input object, all the video source objects associated with the video input object are also deleted. To illustrate, this example creates several video input objects and then deletes them.
Deleting Image Acquisition Objects You can also delete all the video input objects that currently exist in memory in one call to delete by using the imaqfind function. The imaqfind function returns an array of all the video input objects in memory.
4 Connecting to Hardware Saving Image Acquisition Objects In this section... “Using the save Command” on page 4-30 “Using the obj2mfile Command” on page 4-30 Using the save Command You can save a video input object to a MAT-file just as you would any workspace variable by using the save command. This example saves the video input object vid to the MAT-file myvid.mat. save myvid vid When you save a video input object, all the video source objects associated with the video input object are also saved.
5 Acquiring Image Data The core of any image acquisition application is the data acquired from the input device. A trigger is the event that initiates the acquisition of image frames, a process called logging. A trigger event occurs when a certain condition is met. For some types of triggers, the condition can be the execution of a toolbox function. For other types of triggers, the condition can be a signal from an external source that is monitored by the image acquisition hardware.
5 5-2 Acquiring Image Data Managing Memory Usage (p. 5-35) Describes how to use the imaqmem function to monitor toolbox memory usage Logging Image Data to Disk (p.
Data Logging Data Logging In this section... “Overview” on page 5-3 “Trigger Properties” on page 5-4 Overview When a trigger occurs, the toolbox sets the object’s Logging property to 'on' and starts storing the acquired frames in a buffer in memory, a disk file, or both. When the acquisition stops, the toolbox sets the object’s Logging property to 'off'. The following figure illustrates when an object moves into a logging state and the relation between running and logging states.
5 Acquiring Image Data The following figure illustrates a group of frames being acquired from the video stream and being logged to memory and disk. Overview of Data Logging Trigger Properties The video input object supports several properties that you can use to configure aspects of trigger execution. Some of these properties return information about triggers. For example, to find out when the first trigger occurred, look at the value of the InitialTriggerTime property.
Data Logging Property Description TriggerCondition Specifies the condition that must be met for a trigger to be executed. This property is always set to 'none' for immediate and manual triggers. TriggerFcn Specifies the callback function to execute when a trigger occurs. For more information about callbacks, see Chapter 7, “Using Events and Callbacks”. TriggerFrameDelay Specifies the number of frames to skip before logging data to memory, disk, or both.
5 Acquiring Image Data Setting the Values of Trigger Properties In this section... “About Trigger Properties” on page 5-6 “Specifying Trigger Type, Source, and Condition” on page 5-6 About Trigger Properties Most trigger properties can be set using the same methods you use to set any other image acquisition object property: using the set function or referencing the property as you would a field in a structure.
Setting the Values of Trigger Properties Determining Valid Configurations To find all the valid configurations of the TriggerType, TriggerSource, and TriggerCondition properties, use the triggerinfo function, specifying a video input object as an argument. config = triggerinfo(vid); This function returns an array of structures, one structure for each valid combination of property values. Each structure in the array is made up of three fields that contain the values of each of these trigger properties.
5 Acquiring Image Data If you are specifying a manual trigger, you only need to specify the trigger type value as an argument. triggerconfig(vid,'manual') You can also pass one of the structures returned by the triggerinfo function to the triggerconfig function and set all three properties at once. triggerconfig(vid, config(1)) See the triggerconfig function documentation for more information.
Specifying the Trigger Type Specifying the Trigger Type In this section... “Comparison of Trigger Types” on page 5-9 “Example: Using an Immediate Trigger” on page 5-11 “Example: Using a Manual Trigger” on page 5-13 “Example: Using a Hardware Trigger” on page 5-16 Comparison of Trigger Types To specify the type of trigger you want to execute, set the value of the TriggerType property of the video input object. You must use the triggerconfig function to set the value of this property.
5 Acquiring Image Data Comparison of Trigger Types (Continued) TriggerType Value TriggerSource and TriggerCondition Values 'manual' Always 'none' The trigger occurs when you issue the trigger function. A manual trigger can provide more control over image acquisition. For example, you can monitor the video stream being acquired, using the preview function, and manually execute the trigger when you observe a particular condition in the scene.
Specifying the Trigger Type Example: Using an Immediate Trigger To use an immediate trigger, simply create a video input object. Immediate triggering is the default trigger type for all video input objects. With an immediate trigger, the object executes the trigger immediately after you start the object running with the start command. The following figure illustrates an immediate trigger.
5 Acquiring Image Data Verify that the object has not acquired any frames. get(vid,'FramesAcquired') ans = 0 2 Configure properties — To use an immediate trigger, you do not have to configure the TriggerType property because 'immediate' is the default trigger type. You can verify this by using the triggerconfig function to view the current trigger configuration or by viewing the video input object’s properties.
Specifying the Trigger Type To execute another immediate trigger, you must restart the object. Note, however, that this deletes the data acquired by the first trigger. To execute multiple immediate triggers, specify a value for the TriggerRepeat property. See “Specifying Multiple Triggers” on page 5-29 for more information. 4 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
5 Acquiring Image Data your image acquisition device and substitute that syntax for the following code. vid = videoinput('winvideo',1); Verify that the object has not acquired any frames. get(vid,'FramesAcquired') ans = 0 2 Configure properties — Set the video input object’s TriggerType property to 'Manual'. To set the values of certain trigger properties, including the TriggerType property, you must use the triggerconfig function.
Specifying the Trigger Type 0 Verify that the object has still not acquired any frames. get(vid,'FramesAcquired') ans = 0 4 Execute the manual trigger — Call the trigger function to execute the manual trigger. trigger(vid) The object initiates the acquisition of five frames. Check the FramesAcquired property again to verify that five frames have been acquired. get(vid,'FramesAcquired') ans = 5 After it acquires the specified number of frames, the video input object stops running.
5 Acquiring Image Data Example: Using a Hardware Trigger To use a hardware trigger, create a video input object and set the value of the TriggerType property to 'hardware'. You must also specify the source of the hardware trigger and the condition type. The hardware monitors the source you specify for the condition you specify. The following figure illustrates a hardware trigger. For hardware triggers, the video stream does not start until the trigger occurs.
Specifying the Trigger Type your image acquisition device and substitute that syntax for the following code. The device must support hardware triggers. vid = videoinput('matrox',1); 2 Determine valid trigger property configurations — Use the triggerinfo function to determine if your image acquisition device supports hardware triggers, and if it does, to find out valid configurations of the TriggerSource and TriggerCondition properties.
5 Acquiring Image Data 4 Start the image acquisition object — Call the start function to start the image acquisition object. start(vid) The object is running but not logging any data. isrunning(vid) ans = 1 islogging(vid) ans = 0 The hardware begins monitoring the trigger source for the specified condition. When the condition is met, the hardware executes a trigger and begins providing image frames to the object. The object acquires the number of frames specified by the FramesPerTrigger property.
Specifying the Trigger Type execute multiple triggers, specify a value for the TriggerRepeat property. See “Specifying Multiple Triggers” on page 5-29 for more information. 5 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
5 Acquiring Image Data Controlling Logging Parameters In this section... “Data Logging” on page 5-20 “Specifying Logging Mode” on page 5-20 “Specifying the Number of Frames to Log” on page 5-21 “Determining How Much Data Has Been Logged” on page 5-23 “Determining How Many Frames Are Available” on page 5-25 “Delaying Data Logging After a Trigger” on page 5-28 “Specifying Multiple Triggers” on page 5-29 Data Logging The following subsections describe how to control various aspects of data logging.
Controlling Logging Parameters memory buffer. For more information, see “Bringing Image Data into the MATLAB Workspace” on page 6-3. You can also log data to a disk file by setting the LoggingMode property to 'disk' or to 'disk&memory'. By logging frames to a disk file, you create a permanent record of the frames you acquire. For example, this code sets the value of the LoggingMode property of the video input object vid to 'disk&memory'.
5 Acquiring Image Data Specifying the Amount of Data to Log Note While you can specify any size acquisition, the number of frames you can acquire is limited by the amount of memory you have available on your system for image storage. A large acquisition can potentially fill all available system memory. For large acquisitions, you might want to remove frames from the buffer as they are logged. For more information, see “Moving Multiple Frames into the Workspace” on page 6-4.
Controlling Logging Parameters The following figure illustrates how the FrameGrabInterval property affects an acquisition. Impact of FrameGrabInterval on Data Logging Determining How Much Data Has Been Logged To determine how many frames have been acquired by a video input object, check the value of the FramesAcquired property. This property tells how many frames the object has acquired since it was started.
5 Acquiring Image Data 2 Configure properties — Specify the amount of data you want to acquire as the number of frames per trigger. By default, a video input object acquires 10 frames per trigger. For this example, set the value of this property to 100. set(vid,'FramesPerTrigger',100) 3 Start the image acquisition object -— Call the start function to start the image acquisition object. start(vid) The object executes an immediate trigger and begins acquiring frames of data.
Controlling Logging Parameters Determining How Many Frames Are Available The FramesAcquired property tells how many frames the object has logged since it was started, described in “Determining How Much Data Has Been Logged” on page 5-23. Once you move frames from the memory buffer into the MATLAB workspace, the number of frames stored in the memory buffer will differ from the FramesAcquired value.
5 Acquiring Image Data The object executes an immediate trigger and begins acquiring frames of data. The start function returns control to the command line immediately but the object continues logging the data to the memory buffer. After logging the specified number of frames, the object stops running.
Controlling Logging Parameters 5 Remove frames from the memory buffer — When you remove frames from the memory buffer, the object decrements the value of the FramesAvailable property by the number of frames removed. To remove frames from the memory buffer, call the getdata function, specifying the number of frames to retrieve. For more information about using getdata, see “Bringing Image Data into the MATLAB Workspace” on page 6-3.
5 Acquiring Image Data Contents of Memory Buffer Before and After Removing Frames 6 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them. delete(vid) clear vid Delaying Data Logging After a Trigger In some image acquisition setups, you might not want to log the first few frames returned from your camera or other imaging device. For example, some cameras require a short warmup time when activated.
Controlling Logging Parameters Specifying a Delay Before Data Logging Begins Specifying Multiple Triggers When a trigger occurs, a video input object acquires the number of frames specified by the FramesPerTrigger property and logs the data to a memory buffer, a disk file, or both. When it acquires the specified number of frames, the video input object stops running. To execute another trigger, you must restart the video input object.
5 Acquiring Image Data Executing Multiple Triggers 5-30
Waiting for an Acquisition to Finish Waiting for an Acquisition to Finish In this section... “Using the wait Function” on page 5-31 “Example: Blocking the Command Line Until an Acquisition Completes” on page 5-32 Using the wait Function The start function and the trigger function are asynchronous functions. That is, they start the acquisition of frames and return control to the MATLAB command line immediately.
5 Acquiring Image Data Using wait to Block the MATLAB Command Line Example: Blocking the Command Line Until an Acquisition Completes The following example illustrates how to use the wait function to put a 60 second time limit on the execution of a hardware trigger. If the hardware trigger does not execute within the time limit, wait returns control to the MATLAB command line.
Waiting for an Acquisition to Finish 1 Create an image acquisition object — This example creates a video input object for a Matrox image acquisition device. To run this example on your system, use the imaqhwinfo function to get the object constructor for your image acquisition device and substitute that syntax for the following code.
5 Acquiring Image Data 4 Start the image acquisition object — Call the start function to start the image acquisition object. start(vid) The start function sets the object running and returns control to the command line. 5 Block the command line until the acquisition finishes — After the start function returns, call the wait function.
Managing Memory Usage Managing Memory Usage In this section... “Memory Usage” on page 5-35 “Monitoring Memory Usage” on page 5-35 “Modifying the Frame Memory Limit” on page 5-36 “Freeing Memory” on page 5-37 Memory Usage The first time it needs to allocate memory to store an image frame, the toolbox determines the total amount of memory it has available to store acquired image frames.
5 Acquiring Image Data out = imaqmem; mem_left = out.FrameMemoryLimit - out.FrameMemoryUsed; To see an example of using a callback function to monitor memory usage, see “Example: Monitoring Memory Usage” on page 7-17. Modifying the Frame Memory Limit To enable your image acquisition application to work with more image frames, you might want to increase the frame memory limit. Using the imaqmem function you can determine the current frame memory limit and specify a new one.
Managing Memory Usage Freeing Memory At times, while acquiring image data, you might want to delete some or all of the frames that are stored in memory. Using the flushdata function, you can delete all the frames currently stored in memory or only those frames associated with the execution of a trigger. The following example illustrates how to use flushdata to delete all the frames in memory or one trigger’s worth of frames.
5 Acquiring Image Data To verify that the object acquired data, view the value of the FramesAvailable property. This property reports how many frames are currently stored in the memory buffer. vid.FramesAvailable ans = 15 4 Delete a trigger’s worth of image data — Call the flushdata function, specifying the mode 'triggers'. This deletes the frames associated with the oldest trigger. flushdata(vid,'triggers'); The following figure shows the frames acquired before and after the call to flushdata.
Managing Memory Usage 5 Empty the entire memory buffer — Calling flushdata without specifying the mode deletes all the frames stored in memory. flushdata(vid); To verify that the object deleted the frames, view the value of the FramesAvailable property. vid.FramesAvailable ans = 0 6 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
5 Acquiring Image Data Logging Image Data to Disk In this section... “Logging Data to Disk” on page 5-40 “Creating an AVI File Object for Logging” on page 5-41 “Example: Logging Data to Disk” on page 5-43 Logging Data to Disk While a video input object is running, you can log the image data being acquired to a disk file. Logging image data to disk provides a record of your data. To set up data logging to disk, perform these steps: 1 Create a disk file to store the data.
Logging Image Data to Disk Logging Data to a Disk File Creating an AVI File Object for Logging To create an AVI file in the MATLAB environment, use the avifile function. You specify the name of the AVI file to the avifile function. For example, to create the AVI file named my_datalog.avi, enter this code at the MATLAB command prompt. aviobj = avifile('my_datalog.avi'); The avifile function returns an AVI file object.
5 Acquiring Image Data Logging Grayscale Images When logging images in grayscale format, such as RS170, you must set the value of the AVI object’s Colormap property to be a grayscale colormap. Otherwise, the image data in the AVI file will not display correctly. This example uses the MATLAB gray function to create a grayscale colormap and sets the value of the AVI file object’s Colormap property with this colormap. logfile = avifile('my_datalog.
Logging Image Data to Disk Note When you log frames to disk, the video input object queues the frames for writing but the operating system might not perform the write operation immediately. Closing an AVI file causes the data to be written to the disk. Example: Logging Data to Disk This example illustrates how to configure a video input object to log data to a disk file: 1 Create a MATLAB AVI file object — Create the MATLAB AVI file that you want to use for data logging, using the avifile function.
5 Acquiring Image Data to a midlevel value. By lowering the quality, the AVI file object creates smaller log files. aviobj.Quality = 50; Because this example acquires image data in grayscale format (RS170), you must also specify the colormap used with the AVI object to ensure that the stored data displays correctly. aviobj.Colormap = gray(256); 3 Create a video input object — This example creates a video input object for a Matrox image acquisition device, using the default video format M_RS170.
Logging Image Data to Disk vid.DiskLoggerFrameCount ans = 40 Note Because it takes longer to write frames to a disk file than to memory, the value of the DiskLoggerFrameCount property can lag behind the value of the FramesAvailable property, which specifies the number of frames logged to memory. To verify that a disk file was created, go to the directory in which the log file resides and make sure it exists. The exist function returns 2 if the file exists. if(exist(my_log)==2) disp('AVI file created.
5 5-46 Acquiring Image Data
6 Working with Acquired Image Data When you trigger an acquisition, the toolbox stores the image data in a memory buffer, a disk file, or both. To work with this data, you must bring it into the MATLAB workspace. This chapter describes how you use video input object properties and toolbox functions to bring the logged data into the MATLAB workspace. Overview (p.
6 Working with Acquired Image Data Overview When a trigger occurs, the toolbox acquires frames from the video stream and logs the frames to a buffer in memory, a disk file, or both, depending on the value of the LoggingMode property. To work with this logged image data, you must bring it into the MATLAB workspace. The following figure illustrates a group of frames being acquired from the video stream, logged to memory and disk, and brought into the MATLAB workspace as a multidimensional numeric array.
Bringing Image Data into the MATLAB Workspace Bringing Image Data into the MATLAB Workspace In this section...
6 Working with Acquired Image Data the value of the FramesAvailable property. For more information, see “Bringing a Single Frame into the Workspace” on page 6-10. Moving Multiple Frames into the Workspace To move multiple frames of data from the memory buffer into the MATLAB workspace, use the getdata function. By default, getdata retrieves the number of frames specified in the FramesPerTrigger property but you can specify any number.
Bringing Image Data into the MATLAB Workspace getdata Blocks Until Frames Become Available Example: Acquiring 10 Seconds of Image Data This example shows how you can configure an approximate time-based acquisition using the FramesPerTrigger property: 1 Create an image acquisition object — This example creates a video input object for a Windows image acquisition device.
6 Working with Acquired Image Data set(vid,'FramesPerTrigger',300) 3 Start the image acquisition object — Call the start function to start the image acquisition object. start(vid) The object executes an immediate trigger and begins acquiring frames of data. The start function returns control to the command line immediately but the object continues logging the data to the memory buffer. After logging the specified number of frames, the object stops running.
Bringing Image Data into the MATLAB Workspace the frames returned by peekdata at each call. (peekdata returns frames without removing them from the memory buffer.) Note in the figure that, at T3, only two frames have become available since the last call to peekdata. In this case, peekdata returns only the two frames, with a warning that it returned less data than was requested.
6 Working with Acquired Image Data triggerconfig(vid,'manual') In addition, configure a large enough acquisition to allow several calls to peekdata before it finishes. set(vid,'FramesPerTrigger',300); 3 Start the image acquisition object — Call the start function to start the image acquisition object. start(vid) The video object is now running but not logging.
Bringing Image Data into the MATLAB Workspace Name Size Bytes Class pdata vid 96x128x3 1x1 36864 1060 uint8 array videoinput object Verify that the object has not acquired any frames. get(vid,'FramesAcquired') ans = 0 5 Trigger the acquisition — Call the trigger function to trigger an acquisition. trigger(vid) The object begins logging frames to the memory buffer.
6 Working with Acquired Image Data 7 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them. delete(vid) clear vid Bringing a Single Frame into the Workspace To bring a single frame of image data into the MATLAB workspace, use the getsnapshot function. You can call the getsnapshot function at any time after object creation. This example illustrates how simple it is to use the getsnapshot function.
Bringing Image Data into the MATLAB Workspace Note that the frame returned by getsnapshot is not removed from the memory buffer, if frames are stored there, and does not affect the value of the FramesAvailable property. 3 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
6 Working with Acquired Image Data Working with Image Data in the MATLAB Workspace In this section... “Understanding Image Data” on page 6-12 “Determining the Dimensions of Image Data” on page 6-13 “Determining the Data Type of Image Frames” on page 6-16 “Specifying the Color Space” on page 6-17 “Viewing Acquired Data” on page 6-19 Understanding Image Data The illustrations in this documentation show the video stream and the contents of the memory buffer as a sequence of individual frames.
Working with Image Data in the MATLAB Workspace • Determines the color space of the data This section also describes several ways to view acquired image data. Determining the Dimensions of Image Data The video format used by the image acquisition device is the primary determinant of the width, height, and the number of bands in each image frame. Image acquisition devices typically support multiple video formats.
6 Working with Acquired Image Data image data being provided by the device; the ROIPosition property specifies the dimensions of the image frames being logged. See the ROIPosition property reference page for more information. Example: Video Format and Image Dimensions The following example illustrates how video format affects the size of the image frames returned. 1 Select a video format — Use the imaqhwinfo function to view the list of video formats supported by your image acquisition device.
Working with Image Data in the MATLAB Workspace 3 View the video format and video resolution properties — The toolbox creates the object with the default video format. This format defines the video resolution. get(vid,'VideoFormat') ans = M_RS170 get(vid,'VideoResolution') ans = [640 480] 4 Bring a single frame into the workspace — Call the getsnapshot function to bring a frame into the workspace.
6 Working with Acquired Image Data 6 Bring multiple frames into the workspace — Call the getdata function to bring multiple image frames into the MATLAB workspace. data = getdata(vid,10); The getdata function brings 10 frames of data into the workspace. Note that the returned data is a four-dimensional array: each frame is three-dimensional and the nth frame is indicated by the fourth dimension.
Working with Image Data in the MATLAB Workspace vid = videoinput('matrox',1); 2 Bring a single frame into the workspace — Call the getsnapshot function to bring a frame into the workspace. frame = getsnapshot(vid); 3 View the class of the returned data — Use the class function to determine the data type used for the returned image data. class(frame) ans = uint8 4 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
6 Working with Acquired Image Data MathWorks product, Image Processing Toolbox, includes functions that convert YCbCr data to RGB data, and vice versa. Note Some devices that claim to support the YUV color space actually support the YCbCr color space. YUV is similar to YCbCr but not identical. The difference between YUV and YCbCr is the scaling factor applied to the result. YUV refers to a particular scaling factor used in composite NTSC and PAL formats.
Working with Image Data in the MATLAB Workspace 4 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them. delete(vid) clear vid Viewing Acquired Data Once you bring the data into the MATLAB workspace, you can view it as you would any other image in MATLAB. Image Acquisition Toolbox includes a function, imaqmontage, that you can use to view all the frames of a multiframe image array in a single MATLAB image object.
6 Working with Acquired Image Data Retrieving Timing Information In this section...
Retrieving Timing Information InitialTriggerTime Records First Trigger Execution The trigger timing information is stored in MATLAB clock vector format. The following example displays the time of the first trigger for the video input object vid. The example uses the MATLAB datestr function to convert the information into a form that is more convenient to view. datestr(vid.
6 Working with Acquired Image Data To see an example, see “Example: Determining the Frame Delay Duration” on page 6-22. Getting the Absolute Acquisition Time When you use the getdata function, you can optionally specify three return values. The first contains the image data, the second contains a vector of relative acquisition times, and the third is an array of structures where each structure contains metadata associated with a particular frame.
Retrieving Timing Information imaqhwinfo function to get the object constructor for your image acquisition device and substitute that syntax for the following code. vid = videoinput('dt',1); 2 Configure properties — For this example, configure a trigger frame delay large enough to produce a noticeable duration. set(vid,'TriggerFrameDelay',50) 3 Start the image acquisition object — Call the start function to start the image acquisition object.
6 Working with Acquired Image Data 6.0544 6.2143 6.3424 5 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
7 Using Events and Callbacks You can enhance the power and flexibility of your image acquisition application by using event callbacks. An event is a specific occurrence that can happen while an image acquisition object is running. The toolbox defines a set of events that include starting, stopping, or acquiring frames of data. When a particular event occurs, the toolbox can execute a function that you specify. This is called a callback. Certain events can result in one or more callbacks.
7 Using Events and Callbacks Example: Using the Default Callback Function To illustrate how to use callbacks, this section presents a simple example that creates an image acquisition object and associates a callback function with the start event, trigger event, and stop event. For information about all the event callbacks supported by the toolbox, see “Event Types” on page 7-4. The example uses the default callback function provided with the toolbox, imaqcallback.
Example: Using the Default Callback Function Trigger event occurred at 14:38:46 for video input object: M_RS170-matrox-1. Stop event occurred at 14:38:49 for video input object: M_RS170-matrox-1. 4 Clean up — Always remove image acquisition objects from memory, and the variables that reference them, when you no longer need them.
7 Using Events and Callbacks Event Types Image Acquisition Toolbox supports several different types of events. Each event type has an associated video input object property that you can use to specify the function that executes when the event occurs. This table lists the supported event types, the name of the video input object property associated with the event, and a brief description of the event.
Event Types Events and Callback Function Properties (Continued) Event Callback Property Description Start StartFcn The toolbox generates a start event when an object is started. You use the start function to start an object. When a start event occurs, the toolbox executes the function specified by the StartFcn property. Note The StartFcn callback executes synchronously.
7 Using Events and Callbacks Events and Callback Function Properties (Continued) Event Callback Property Description Timer TimerFcn The toolbox generates a timer event when a specified amount of time expires. Time is measured relative to when the object starts running. You use the TimerPeriod property to specify the amount of time. Note Some timer events might not execute if your system is significantly slowed or if the TimerPeriod is set too small.
Retrieving Event Information Retrieving Event Information In this section... “Introduction” on page 7-7 “Event Structures” on page 7-7 “Example: Accessing Data in the Event Log” on page 7-9 Introduction Each event has associated with it a set of information, generated by the toolbox and stored in an event structure. This information includes the event type, the time the event occurred, and other event-specific information.
7 Using Events and Callbacks occurred. For information about the information associated with specific events, see the following sections: • “Data Fields for Start, Stop, Frames Acquired, and Trigger Events” on page 7-8 • “Data Fields for Error Events” on page 7-8 • “Data Fields for Timer Events” on page 7-9 Data Fields for Start, Stop, Frames Acquired, and Trigger Events For start, stop, frames acquired, and trigger events, the Data structure contains these fields.
Retrieving Event Information Field Name Description AbsTime Absolute time the event occurred, returned in MATLAB clock format [year month day hour minute seconds] FrameMemoryLimit Amount of memory allotted for frame storage. You can specify this value using the imaqmem function.
7 Using Events and Callbacks The toolbox adds event structures to the EventLog array in the order in which the events occur. The first event structure reflects the first event recorded, the second event structure reflects the second event recorded, and so on. Note Only start, stop, error, and trigger events are recorded in the EventLog property. Frames-acquired events and timer events are not included in the EventLog.
Retrieving Event Information To list the events that are recorded in the EventLog property, examine the contents of the Type field. {events.Type} ans = 'Start' 'Trigger' 'Stop' To get information about a particular event, access the Data field in that event structure. The example retrieves information about the trigger event. trigdata = events(2).Data trigdata = AbsTime: FrameMemoryLimit: FrameMemoryUsed: FrameNumber: RelativeFrame: TriggerIndex: [2004 12 29 16 40 52.
7 Using Events and Callbacks Creating and Executing Callback Functions In this section... “Introduction” on page 7-12 “Creating Callback Functions” on page 7-12 “Specifying Callback Functions” on page 7-14 “Example: Viewing a Sample Frame” on page 7-16 “Example: Monitoring Memory Usage” on page 7-17 Introduction The power of using event callbacks is the processing that you can perform in response to events.
Creating and Executing Callback Functions M-file callback functions require at least two input arguments: • The image acquisition object • The event structure associated with the event The function header for this callback function illustrates this basic syntax. function mycallback(obj,event) The first argument, obj, is the image acquisition object itself.
7 Using Events and Callbacks function display_frame(obj,event) sample_frame = peekdata(obj,1); imagesc(sample_frame); drawnow; % force an update of the figure window abstime = event.Data.AbsTime; t = fix(abstime); sprintf('%s %d:%d:%d','timestamp', t(4),t(5),t(6)) To see how this function can be used as a callback, see “Example: Viewing a Sample Frame” on page 7-16.
Creating and Executing Callback Functions Using a Text String to Specify Callback Functions You can specify the callback function as a string. For example, this code specifies the callback function mycallback as the value of the start event callback property StartFcn for the video input object vid. vid.StartFcn = 'mycallback'; In this case, the callback is evaluated in the MATLAB workspace.
7 Using Events and Callbacks If you are executing a local callback function from within an M-file, you must specify the callback as a function handle. Specifying a Toolbox Function as a Callback In addition to specifying callback functions of your own creation, you can also specify the start, stop, or trigger toolbox functions as callbacks. For example, this code sets the value of the stop event callback to Image Acquisition Toolbox start function. vid.
Creating and Executing Callback Functions vid = videoinput('matrox', 1); 2 Configure property values — This example sets the FramesPerTrigger value to 30 and the TriggerRepeat property to 4. The example also specifies as the value of the FramesAcquiredFcn callback the event callback function display_frame, created in “Example: Writing a Callback Function” on page 7-13. The object will execute the FramesAcquiredFcn every five frames, as specified by the value of the FramesAcquiredFcnCount property.
7 Using Events and Callbacks function mem_mon(obj,event) out = imaqmem; mem_left = out.FrameMemoryLimit - out.FrameMemoryUsed; msg = 'Memory left for frames'; msg2 = 'Memory load'; low_limit = 2000000; if(mem_left > low_limit) sprintf('%s: %d \n%s: %d',msg, mem_left,msg2, out.MemoryLoad) else disp('Memory available for frames getting low.'); disp('Stopping acquisition.
Creating and Executing Callback Functions 3 Acquire data — Start the video input object. Every 5 seconds, the object executes the callback function associated with the timer event. This function outputs the current memory available for frame storage and the memory load statistic. When the amount of memory reaches the specified lower limit, the callback function stops the acquisition.
7 7-20 Using Events and Callbacks
8 Using the From Video Device Block in Simulink Image Acquisition Toolbox includes a block that can be used in Simulink to bring live video data into models. Overview (p. 8-2) Introduces the Image Acquisition Toolbox block library Opening the Block Library (p. 8-3) Describes how to open the Image Acquisition Toolbox block library Example: Saving Video Data to a File (p.
8 Using the From Video Device Block in Simulink Overview This chapter describes how to use the Image Acquisition Toolbox block library. The toolbox block library contains one block called the From Video Device block. You can use this block to acquire live video data in a Simulink model. You can connect this block with blocks in other Simulink libraries to create sophisticated models. Use of the Image Acquisition Toolbox From Video Device block requires Simulink, a tool for simulating dynamic systems.
Opening the Block Library Opening the Block Library In this section... “Using the imaqlib Command” on page 8-3 “Using the Simulink Library Browser” on page 8-3 Using the imaqlib Command To open the Image Acquisition Toolbox block library, enter imaqlib at the MATLAB prompt. MATLAB displays the contents of the library in a separate window.
8 Using the From Video Device Block in Simulink To start the Simulink Library Browser, enter simulink at the MATLAB prompt. MATLAB opens the browser window. The left pane contains a list of available block libraries in alphabetical order. To open the Image Acquisition Toolbox block library, click its icon.
Example: Saving Video Data to a File Example: Saving Video Data to a File In this section...
8 Using the From Video Device Block in Simulink Step 2: Open a Model or Create a New Model To use a block, you must add it to an existing model or create a new model. To create a new model, select File > New > Model from the Simulink Library Browser. Simulink opens an empty model window. To assign the new model a name, use the Save option.
Example: Saving Video Data to a File Step 3: Drag the From Video Device Block into the Model To use the From Video Device block in a model, click the block in the library and, holding the mouse button down, drag it into the model window. Note how the name on the block changes to reflect the device connected to your system that is associated with the block.
8 Using the From Video Device Block in Simulink Step 4: Drag Other Blocks to Complete the Model To illustrate using the block, this example creates a simple model that acquires data and then outputs the data to a file in Audio Video Interleave (AVI) format. To create this model, the example uses a block from Video and Image Processing Blockset. Open the Video and Image Processing Blockset library. In the library window, open the Sinks subsystem.
Example: Saving Video Data to a File Drag Output Block to Model Window 8-9
8 Using the From Video Device Block in Simulink Step 5: Connect the Blocks Connect the three outputs from the From Video Device block to the three corresponding inputs on the To Multimedia File block. (You can leave the Audio input on the To Multimedia File block unconnected.) One quick way to make all three connections at once is to select the From Video Device block, press and hold the Ctrl key, and then click the To Multimedia File block.
Example: Saving Video Data to a File box for the From Video Device block, shown in the following figure. Use the various fields in the dialog box to determine the current values of From Video Device block parameters or change the values. For example, using this dialog box, you can specify the device you want to use, select the video format you want to use with the device, or specify the block sample time. For more details, see the From Video Device block reference page.
8 Using the From Video Device Block in Simulink Step 7: Run the Simulation To run the simulation, click the Start simulation button on the model window toolbar. You can use toolbar options to specify how long to run the simulation and to stop a running simulation. While the simulation is running, the status bar at the bottom of the model window indicates the progress of the simulation.
9 Adding Support for Additional Hardware Image Acquisition Toolbox supports connections with hardware from many common vendors but it might not support the hardware you use. To add support for your hardware, you can create an adaptor using the Image Acquisition Toolbox Adaptor Kit. Overview (p. 9-2) Introduces the Image Acquisition Toolbox Adaptor Kit For More Information (p.
9 Adding Support for Additional Hardware Overview The Image Acquisition Toolbox Adaptor Kit is a C++ framework that you can use to implement an adaptor. An adaptor is a dynamic link library (DLL) that implements the connection between the Image Acquisition Toolbox engine and a device driver via the vendor’s SDK API.
For More Information For More Information To build an adaptor requires familiarity with C++, knowledge of the application programming interface (API) provided by the manufacturer of your hardware, and familiarity with Image Acquisition Toolbox concepts, functionality, and terminology. To learn more about creating an adaptor, read the Image Acquisition Toolbox Adaptor Kit User’s Guide.
9 9-4 Adding Support for Additional Hardware
10 Troubleshooting This chapter provides information about solving common problems you might encounter with Image Acquisition Toolbox and the video acquisition hardware it supports. Overview (p. 10-3) Provides an overview of the troubleshooting procedure Troubleshooting DALSA Coreco IFC Hardware (p. 10-4) Provides some helpful tips on diagnosing problems you might encounter using the toolbox with DALSA Coreco IFC image acquisition devices Troubleshooting DALSA Coreco Sapera Hardware (p.
10 10-2 Troubleshooting Troubleshooting Hamamatsu Hardware (p. 10-16) Provides some helpful tips on diagnosing problems you might encounter using the toolbox with Hamamatsu image acquisition devices Troubleshooting Matrox Hardware (p. 10-17) Provides some helpful tips on diagnosing problems you might encounter using the toolbox with Matrox image acquisition devices Troubleshooting QImaging Hardware (p.
Overview Overview If, after installing Image Acquisition Toolbox and using it to establish a connection to your image acquisition device, you are unable to acquire data or encounter other problems, try these troubleshooting steps first. They might help fix the problem. 1 Verify that your image acquisition hardware is functioning properly. 2 If the hardware is functioning properly, verify that you are using a hardware device driver that is compatible with Image Acquisition Toolbox.
10 Troubleshooting Troubleshooting DALSA Coreco IFC Hardware In this section... “Troubleshooting DALSA Coreco IFC Devices” on page 10-4 “Determining the Driver Version for DALSA Coreco IFC Devices” on page 10-5 Troubleshooting DALSA Coreco IFC Devices Image Acquisition Toolbox supports the use of both DALSA Coreco IFC hardware and DALSA Coreco Sapera hardware. Please see the appropriate section depending on which driver your hardware uses.
Troubleshooting DALSA Coreco IFC Hardware If you discover that you are using an unsupported driver version, visit the DALSA Coreco Web site (www.imaging.com) to download the correct driver. Determining the Driver Version for DALSA Coreco IFC Devices To determine the DALSA Coreco IFC Library version you are using, view the release notes for the driver. You can access the release notes through the Windows Start menu. 1 Click the Start button. 2 On the Start menu, select Programs.
10 Troubleshooting Troubleshooting DALSA Coreco Sapera Hardware In this section... “Troubleshooting DALSA Coreco Sapera Devices” on page 10-6 “Determining the Driver Version for DALSA Coreco Sapera Devices” on page 10-7 Troubleshooting DALSA Coreco Sapera Devices Image Acquisition Toolbox supports the use of both DALSA Coreco IFC hardware and DALSA Coreco Sapera hardware. Please see the appropriate section depending on which driver your hardware uses.
Troubleshooting DALSA Coreco Sapera Hardware • Verify that the version is compatible with Image Acquisition Toolbox. For the correct driver information, check the list of supported drivers on the Image Acquisition Toolbox product page at the MathWorks Web site (www.mathworks.com/products/imaq). If you discover that you are using an unsupported driver version, visit the DALSA Coreco Web site (www.imaging.com) to download the correct driver.
10 Troubleshooting Troubleshooting Data Translation Hardware If you are having trouble using Image Acquisition Toolbox with a supported Data Translation frame grabber, follow these troubleshooting steps: 1 Verify that your image acquisition hardware is functioning properly. For Data Translation devices, run the application that came with your hardware and verify that you can receive live video.
Troubleshooting DCAM IEEE 1394 (FireWire) Hardware Troubleshooting DCAM IEEE 1394 (FireWire) Hardware In this section...
10 Troubleshooting 3 Verify that your IEEE 1394 (FireWire) camera is using the Carnegie Mellon University (CMU) DCAM driver version 6.4.4. Note The toolbox only supports connections to IEEE 1394 (FireWire) DCAM-compliant devices using the CMU DCAM driver. The toolbox is not compatible with any other vendor-supplied driver, even if the driver is DCAM compliant. To verify this, run the demo application provided by CMU, 1394CameraDemo.exe.
Troubleshooting DCAM IEEE 1394 (FireWire) Hardware Note The CMU DCAM driver is the only DCAM driver supported by the toolbox. You cannot use vendor-supplied drivers, even if they are compliant with the DCAM specification. Installing the Driver To install the CMU DCAM driver on your system, follow this procedure: 1 Obtain the CMU DCAM driver files. Image Acquisition Toolbox includes the CMU DCAM installation file, 1394camera644.
10 Troubleshooting 3 From the Camera Demo application, select Camera > Check Link. This option causes the demo application to look for DCAM-compatible cameras that are available through the IEEE 1394 (FireWire) connection. The demo application displays the results of this search in a pop-up message box. In the following example, the demo application found a camera. Click OK to continue. 4 Select Camera > Select Camera and select the camera you want to use.
Troubleshooting DCAM IEEE 1394 (FireWire) Hardware Note If you are using 1394b, select Camera > 1394b Support, and then check the Maximum Speed option after choosing 1394b support. If you do not see 400 MB per second or higher, refer to the customer technical solution on that topic, http://www.mathworks.com/support/solutions/data/1-3LNN8U.html. 6 Select Camera > Show Camera to start acquiring video.
10 10-14 Troubleshooting
Troubleshooting DCAM IEEE 1394 (FireWire) Hardware The demo application starts displaying live video in the window. 7 To exit, select Stop Camera from the Camera menu and then click Exit.
10 Troubleshooting Troubleshooting Hamamatsu Hardware If you are having trouble using Image Acquisition Toolbox with a Hamamatsu digital camera, follow these troubleshooting steps: 1 Verify that your image acquisition hardware is functioning properly. • Make sure that your camera is plugged into the IEEE 1394 (FireWire) port on your computer and is powered up. • Run the application that came with your hardware and verify that you can acquire video frames. Use the exAcq.
Troubleshooting Matrox Hardware Troubleshooting Matrox Hardware In this section... “Troubleshooting Matrox Devices” on page 10-17 “Determining the Driver Version for Matrox Devices” on page 10-18 Troubleshooting Matrox Devices If you are having trouble using Image Acquisition Toolbox with a supported Matrox frame grabber, follow these troubleshooting steps: 1 Verify that your image acquisition hardware is functioning properly.
10 Troubleshooting Determining the Driver Version for Matrox Devices To determine the Matrox Imaging Library version you are using, run the Matrox MIL Configuration utility. You can access this software through the Windows Start button. Select Start > Programs > Matrox Imaging Products > MIL Configuration. The software version is listed on the Information tab.
Troubleshooting QImaging Hardware Troubleshooting QImaging Hardware In this section... “Troubleshooting QImaging Devices” on page 10-19 “Determining the Driver Version for QImaging Devices” on page 10-20 Troubleshooting QImaging Devices If you are having trouble using Image Acquisition Toolbox with a supported QImaging frame grabber, follow these troubleshooting steps: 1 Verify that your image acquisition hardware is functioning properly.
10 Troubleshooting If you discover that you are using an unsupported driver version, visit the QImaging Web site (www.qimaging.com) to download the correct drivers. Determining the Driver Version for QImaging Devices To determine the QImaging driver version you are using, run the QImaging QCapture utility. Select Start > Programs > QCapture Suite > QCapture, and then select Help > About to see the driver version number.
Troubleshooting National Instruments Hardware Troubleshooting National Instruments Hardware In this section...
10 Troubleshooting Note Image Acquisition Toolbox is compatible only with specific driver versions provided with the National Instruments software and is not guaranteed to work with any other versions. • Find out the driver version you are using on your system. To learn how to get this information, see Determining the Driver Version. • Verify that the version is compatible with Image Acquisition Toolbox.
Troubleshooting Windows Video Hardware Troubleshooting Windows Video Hardware In this section... “Troubleshooting Windows Video Devices” on page 10-23 “Determining the Microsoft DirectX Version” on page 10-24 Troubleshooting Windows Video Devices If you are having trouble using Image Acquisition Toolbox with a supported Windows video acquisition device, follow these recommended troubleshooting steps: 1 Verify that your image acquisition hardware is functioning properly.
10 Troubleshooting If you discover that you are using an unsupported driver version, visit the hardware manufacturer’s Web site for the correct drivers. 3 Make sure you have the correct version of Microsoft DirectX installed on your computer. Image Acquisition Toolbox is only compatible with specific versions of the Microsoft DirectX multimedia technology and is not guaranteed to work with any other versions. • Find out which driver version you are using on your system.
Troubleshooting Windows Video Hardware In the DirectX Diagnostic Tool, the Microsoft DirectX version is listed on the System tab under the System Information section.
10 Troubleshooting Troubleshooting a Video Preview Window When previewing the video stream, if you encounter a problem, try one of the following solutions. Problem Possible Solutions Video Preview window stops running. • Close the preview window and reopen it. • Verify that your image acquisition device is working properly. Close MATLAB and run the application that came with your device. • Make sure no other application is using the device. Video Preview window displays blank, gray window.
Contacting The MathWorks and Using the imaqsupport Function Contacting The MathWorks and Using the imaqsupport Function If you need support from The MathWorks, visit our Web site at http://www.mathworks.com/support/. Before contacting The MathWorks, you should run the imaqsupport function.
10 10-28 Troubleshooting
11 Functions — By Category Objects General Purpose (p. 11-2) Functions related to objects Triggering (p. 11-3) Functions related to triggering Data (p. 11-3) Functions related to data Tools (p. 11-4) Functions related to image acquisition tools Getting Command-Line Function Help (p.
11 Functions — By Category Objects General Purpose Video input objects have one or more video source objects associated with them. In this table, functions that work on both types of objects use the phrase “image acquisition object” to refer to both types of objects.
Triggering stop Stop video input object videoinput Create video input object wait Wait until image acquisition object stops running or logging trigger Initiate data logging triggerconfig Configure video input object trigger properties triggerinfo Provide information about available trigger configurations flushdata Remove data from memory buffer used to store acquired image frames getdata Acquired image frames to MATLAB workspace getsnapshot Immediately return single image frame peekdata
11 Functions — By Category Tools 11-4 closepreview Close Video Preview window imaqhelp Image acquisition object function and property help imaqhwinfo Information about available image acquisition hardware imaqmem Limit memory or display memory usage for Image Acquisition Toolbox imaqmontage Sequence of image frames as montage imaqreset Disconnect and delete all image acquisition objects imaqtool Launch Image Acquisition Tool preview Preview of live video data propinfo Property character
Getting Command-Line Function Help Getting Command-Line Function Help To get command-line function help, you can use the MATLAB help function. For example, to get help for the getsnapshot function, type the following: help getsnapshot However, Image Acquisition Toolbox provides “overloaded” versions of several MATLAB functions. That is, it provides toolbox-specific implementations of these functions using the same function name.
11 Functions — By Category You can also use this function to get help on image acquisition object properties. For more information on overloaded functions and class directories, refer to MATLAB Classes and Objects in the Help browser.
12 Functions — Alphabetical List
clear Purpose Clear image acquisition object from MATLAB workspace Syntax clear obj Description clear obj removes the image acquisition object obj from the MATLAB workspace. obj can be either a video input object or a video source object. Note If you clear a video input object that is running (the Running property is set to 'on'), the object continues executing. You can restore cleared objects to the MATLAB workspace with the imaqfind function.
closepreview Purpose Close Video Preview window Syntax closepreview(obj) closepreview Description closepreview(obj) stops the image acquisition object obj from previewing and, if the default Video Preview window was used, closes the window. closepreview stops all image acquisition objects from previewing and, for all image acquisition objects that used the default Video Preview window, closes the windows.
delete Purpose Remove image acquisition object from memory Syntax delete(obj) Description delete(obj) removes obj, an image acquisition object or array of image acquisition objects, from memory. Use delete to free memory at the end of an image acquisition session. If obj is an array of image acquisition objects and one of the objects cannot be deleted, the delete function deletes the objects that can be deleted and returns a warning. When obj is deleted, it becomes invalid and cannot be reused.
disp Purpose Display method for image acquisition objects Syntax obj disp(obj) Description obj displays summary information for image acquisition object obj. disp(obj) displays summary information for image acquisition object obj. If obj is an array of image acquisition objects, disp outputs a table of summary information about the image acquisition objects in the array.
disp This example shows the summary information displayed for an array of video input objects.
flushdata Purpose Remove data from memory buffer used to store acquired image frames Syntax flushdata(obj) flushdata(obj,mode) Description flushdata(obj) removes all the data from the memory buffer used to store acquired image frames. obj can be a single video input object or an array of video input objects.
get Purpose Image acquisition object properties Syntax get(obj) V = get(obj) V = get(obj,PropertyName) Description get(obj) displays all property names and their current values for image acquisition object obj. V = get(obj) returns a structure, V, in which each field name is the name of a property of obj and each field contains the value of that property. V = get(obj,PropertyName) returns the value of the property specified by PropertyName for image acquisition object obj.
getdata Purpose Acquired image frames to MATLAB workspace Syntax data = getdata(obj) data = getdata(obj,n) data = getdata(obj,n,type) data = getdata(obj,n,type,format) [data,time] = getdata(...) [data, time, metadata] = getdata(...) Description data = getdata(obj) returns data, which contains the number of frames specified in the FramesPerTrigger property of the video input object obj. obj must be a 1-by-1 video input object.
getdata Type String Data Type 'uint8' Unsigned 8-bit integer 'uint16' Unsigned 16-bit integer 'uint32' Unsigned 32-bit integer 'single' Single precision 'double' Double precision 'native' Uses native data type. This is the default. If type is not specified, 'native' is used as the default. If there is no MATLAB data type that matches the object’s native data type, getdata chooses a MATLAB data type that preserves numerical accuracy.
getdata is measured continuously with respect to 0 until the acquisition stops. When the acquisition stops, the object’s Running property is set to 'Off'. [data, time, metadata] = getdata(...) returns metadata, an F-by-1 array of structures, where F is the number of frames returned in data. Each structure contains information about the corresponding frame in data.
getdata data = getdata(obj); Display each image frame acquired. imaqmontage(data); Remove the video input object from memory.
getselectedsource Purpose Currently selected video source object Syntax src = getselectedsource(obj) Description src = getselectedsource(obj) searches all the video source objects associated with the video input object obj and returns the video source object, src, that has the Selected property value set to 'on'. To select a source for acquisition, use the SelectedSourceName property of the video input object. obj must be a 1-by-1 video input object.
getsnapshot Purpose Immediately return single image frame Syntax frame = getsnapshot(obj) Description frame = getsnapshot(obj) immediately returns one single image frame, frame, from the video input object obj. The frame of data returned is independent of the video input object FramesPerTrigger property and has no effect on the value of the FramesAvailable or FramesAcquired property. The object obj must be a 1-by-1 video input object.
getsnapshot Acquire and display a single frame of data. frame = getsnapshot(obj); image(frame); Remove the video input object from memory.
imaqfind Purpose Find image acquisition objects Syntax imaqfind out = imaqfind out = imaqfind(PropertyName, Value, PropertyName2, Value2, ...) out = imaqfind(S) out = imaqfind(obj, PropertyName, Value, PropertyName2, Value2,...) Description imaqfind returns an array containing all the video input objects that exist in memory. If only a single video input object exists in memory, imaqfind displays a detailed summary of that object.
imaqfind Note When searching for properties with specific values, imaqfind performs case-sensitive searches. For example, if the value of an object’s Name property is 'MyObject', imaqfind does not find a match if you specify 'myobject'. Note, however, that searches for properties that have an enumerated list of possible values are not case sensitive. For example, imaqfind will find an object with a Running property value of 'Off' or 'off'.
imaqhelp Purpose Image acquisition object function and property help Syntax imaqhelp imaqhelp(Name) imaqhelp(obj) imaqhelp(obj,Name) out = imaqhelp(...) Description imaqhelp provides a complete listing of image acquisition object functions. imaqhelp(Name) provides online help for the function or property specified by the text string Name. imaqhelp(obj) displays a listing of functions and properties for the image acquisition object obj along with the online help for the object’s constructor.
imaqhelp vid = videoinput('dt', 1); src = getselectedsource(vid); imaqhelp(vid, 'TriggerType') imaqhelp(src, 'FrameRate') See Also propinfo 12-19
imaqhwinfo Purpose Information about available image acquisition hardware Syntax out out out out out out Description out = imaqhwinfo returns out, a structure that contains information about the image acquisition adaptors available on the system. An adaptor is the interface between MATLAB and the image acquisition devices connected to the system. The adaptor’s main purpose is to pass information between MATLAB and an image acquisition device via its driver.
imaqhwinfo is an array of device objects, then out is a 1-by-n cell array of structures where n is the length of obj. out = imaqhwinfo(obj,field) returns the information in the field specified by field for the device object obj. field can be a single field name or a cell array of field names. out is an m-by-n cell array where m is the length of obj and n is the length of field. You can return a list of valid field names with the imaqhwinfo(obj) syntax.
imaqhwinfo This example returns information about a specific device accessible through a particular adaptor. You identify the device by its device ID. dev_info = imaqhwinfo('winvideo', 1) dev_info = DefaultFormat: DeviceFileSupported: DeviceName: DeviceID: ObjectConstructor: SupportedFormats: 'RGB555_128x96' 0 'IBM PC Camera' 1 'videoinput('winvideo', 1)' {1x34 cell} This example gets information about the device associated with a particular video input object.
imaqhwinfo winvideo See Also imaqhelp, imaqreset 12-23
imaqmem Purpose Limit memory or display memory usage for Image Acquisition Toolbox Syntax mem = imaqmem imaqmem(field) imaqmem(limit) Description mem = imaqmem returns a structure containing the following fields: Field Description MemoryLoad Number between 0 and 100 that gives a general idea of current memory utilization TotalPhys Total number of bytes of physical memory AvailPhys Number of bytes of physical memory currently available TotalPageFile Total number of bytes that can be stored in
imaqmem imaqmem(field) returns information for the field specified by the text string field. imaqmem(limit) configures the frame memory limit, in bytes, for Image Acquisition Toolbox. limit is used to determine the maximum amount of memory the toolbox can use for logging image frames. Note Configuring the frame memory limit does not remove any logged frames from the image acquisition memory buffer.
imaqmem Specify the amount of memory available for the toolbox to log image frames (FrameMemoryLimit). imaqmem(30000000) ans = MemoryLoad: TotalPhys: AvailPhys: TotalPageFile: AvailPageFile: TotalVirtual: AvailVirtual: FrameMemoryLimit: FrameMemoryUsed: See Also 12-26 85 263766016 37634048 643878912 391479296 2.1474e+009 1.
imaqmontage Purpose Sequence of image frames as montage Syntax imaqmontage(frames) imaqmontage(obj) imaqmontage(...,CLIM) imaqmontage(..., 'CLim', CLIM, 'Parent', PARENT) h = imaqmontage(...) Description imaqmontage(frames) displays a montage of image frames in a MATLAB figure window using the imagesc function. frames can be any data set returned by getdata, peekdata, or getsnapshot.
imaqmontage Create an axes object. a = axes; Display each image frame acquired on axes a. imaqmontage(data, 'Parent', a); Remove the video input object from memory.
imaqreset Purpose Disconnect and delete all image acquisition objects Syntax imaqreset Description imaqreset deletes any image acquisition objects that exist in memory and unloads all adaptors loaded by the toolbox. As a result, the image acquisition hardware is reset. imaqreset is the image acquisition command that returns MATLAB to the known state of having no image acquisition objects and no loaded image acquisition adaptors.
imaqtool Purpose Launch Image Acquisition Tool Syntax imaqtool imaqtool(file) Description imaqtool launches an interactive GUI to allow you to explore, configure, and acquire data from your installed and supported image acquisition devices. The functionality of Image Acquisition Toolbox is available in this desktop application. You connect directly to your hardware in the tool and can preview and acquire image data.
islogging Purpose Determine whether video input object is logging Syntax bool = islogging(obj) Description bool = islogging(obj) returns true if the video input object obj is logging data, otherwise false. A video input object is logging if the value of its Logging property is set to 'on'. If obj is an array of video input objects, bool is a logical array where each element in bool represents the corresponding element in obj.
islogging Start one of the video input objects again, such as vid, and use islogging to determine which of the two objects is logging.
isrunning Purpose Determine whether video input object is running Syntax bool = isrunning(obj) Description bool = isrunning(obj) returns true if the video input object obj is running, otherwise false. A video input object is running if the value of its Running property is set to 'on'. If obj is an array of video input objects, bool is a logical array where each element in bool represents the corresponding element in obj.
isrunning Properties Running 12-34
isvalid Purpose Determine whether image acquisition object is associated with image acquisition device Syntax bool = isvalid(obj) Description bool = isvalid(obj) returns true if the video input object obj is valid, otherwise false. An object is an invalid image acquisition object if it is no longer associated with any hardware; that is, the object was deleted using the delete function. If this is the case, obj should be cleared from the workspace.
load Purpose Load image acquisition object into MATLAB workspace Syntax load filename load filename obj1 obj2 ... S = load(filename,obj1,obj2,...) Description load filename returns all variables from the MAT-file filename to the MATLAB workspace. load filename obj1 obj2 ... returns the specified image acquisition objects (obj1, obj2, etc.) from the MAT-file specified by filename to the MATLAB workspace. S = load(filename,obj1,obj2,...
obj2mfile Purpose Convert video input objects to MATLAB code Syntax obj2mfile(obj,filename) obj2mfile(obj,filename,syntax) obj2mfile(obj,filename,syntax,mode) obj2mfile(obj,filename,syntax,mode,reuse) Description obj2mfile(obj,filename) converts the video input object obj into an M-file with the name specified by filename. The M-file contains the MATLAB code required to create the object and set its properties. obj can be a single video input object or an array of objects.
obj2mfile obj2mfile(obj,filename,syntax) converts obj to the equivalent MATLAB code where syntax specifies how obj2mfile assigns values to properties of the object. syntax can be either of the following text strings. The default value is enclosed in braces ({}). String Description {'set'} obj2mfile uses the set function when specifying property values. 'dot' obj2mfile uses subscripted assignment (dot notation) when specifying property values.
obj2mfile String Description {'reuse'} Find and modify an existing object, if the existing object is associated with the same adaptor and the values of the DeviceID, VideoFormat, and Tag properties match the object being created. If no matching object can be found, obj2mfile creates a new object. 'create' Create a new object regardless of whether there are reusable objects. Note that obj2mfile(obj,filename,reuse) is a valid syntax.
obj2mfile delete(vidobj); clear vidobj; Execute the M-file to recreate the object. Note that obj2mfile creates and configures the associated video source object as well.
peekdata Purpose Most recently acquired image data Syntax data = peekdata(obj,frames) Description data = peekdata(obj,frames) returns data containing the latest number of frames specified by frames. If frames is greater than the number of frames currently acquired, all available frames are returned with a warning message stating that the requested number of frames was not available. obj must be a 1-by-1 video input object.
peekdata The behavior of peekdata depends on the settings of the Running and the Logging properties. Running Logging Object State Result On Off The object has been started but is waiting for a trigger. (TriggerType is set to 'manual' or 'hardware'). No data has been acquired so none is available. peekdata returns a single The object has been started, a trigger has executed, and the object is actively acquiring data.
preview Purpose Preview of live video data Syntax preview(obj) preview(obj,himage) himage = preview(...) Description preview(obj) creates a Video Preview window that displays live video data for video input object obj. The window also displays the timestamp and video resolution of each frame, and the current status of obj. The Video Preview window displays the video data at 100% magnification (one screen pixel represents one image pixel).
preview The Video Preview window remains active until it is either stopped using stoppreview or closed using closepreview. If you delete the object, by calling delete(obj), the Video Preview window stops previewing and closes automatically. preview(obj,himage) displays live video data for video input object obj in the image object specified by the handle himage. preview scales the image data to fill the entire area of the image object but does not modify the values of any image object properties.
preview Object State Preview Window Behavior Running=on If TriggerType is set to immediate or manual, the Video Preview window continues to update the image displayed. If TriggerType is set to hardware, the Video Preview window stops updating the image displayed until a trigger occurs. Logging=on Custom Update Function Video Preview window might drop some data frames, but this will not affect the frames logged to memory or disk.
preview The event structure contains the following fields: See Also 12-46 Field Description Data Current image frame specified as an H-by-W-by-B matrix where H and W are the image height and width, respectively, as specified in the ROIPosition property, and B is the number of color bands, as specified in the NumberOfBands property. Resolution String specifying current image width and height, as defined by the ROIPosition property.
propinfo Purpose Property characteristics for image acquisition objects Syntax out = propinfo(obj) out = propinfo(obj,PropertyName) Description out = propinfo(obj) returns the structure out whose field names are the names of all the properties supported by obj. obj must be a 1-by-1 image acquisition object. The value of each field is a structure containing the fields shown below. Field Name Description Type Data type of the property.
propinfo array of strings, propinfo returns a structure for each property, stored in a cell array. Examples Create the video input object vid. vid = videoinput('winvideo',1); Capture all property information for all properties. out = propinfo(vid); Access property information for a particular property.
save Purpose Save image acquisition objects to MAT-file Syntax save filename save filename obj1 obj2 ... save(filename,obj1,obj2,...) Description save filename saves all variables in the MATLAB workspace to the MAT-file filename. If filename does not include a file extension, save appends the .MAT extension to the filename. save filename obj1 obj2 ... saves the specified image acquisition objects (obj1, obj2, etc.) to the MAT-file filename. save(filename,obj1,obj2,...
set Purpose Configure or display image acquisition object properties Syntax set(obj) prop_struct = set(obj) set(obj,PropertyName) prop_cell = set(obj,PropertyName) set(obj,PropertyName,PropertyValue,...) set(obj,S) set(obj,PN,PV) Description set(obj) displays property names and any enumerated values for all configurable properties of image acquisition object obj. obj must be a single image acquisition object.
set objects, in which case set configures the property values for all the image acquisition objects specified. set(obj,S) configures the properties of obj with the values specified in S, where S is a structure whose field names are object property names. set(obj,PN,PV) configures the properties specified in the cell array of strings, PN, to the corresponding values in the cell array PV, for the image acquisition object obj. PN must be a vector.
start Purpose Obtain exclusive use of image acquisition device Syntax start(obj) Description start(obj) obtains exclusive use of the image acquisition device associated with the video input object obj and locks the device’s configuration. Starting an object is a necessary first step to acquire image data, but it does not control when data is logged. obj can either be a 1-by-1 video input object or an array of video input objects. Data logging is controlled with the TriggerType property.
start An image acquisition object stops running when one of the following conditions is met: • The stop function is issued. • The requested number of frames is acquired. This occurs when FramesAcquired = FramesPerTrigger * (TriggerRepeat + 1) where FramesAcquired, FramesPerTrigger, and TriggerRepeat are properties of the video input object. • A run-time error occurs. • The object’s Timeout value is reached. Examples The start function can be called by a video input object’s event callback. obj.
stop Purpose Stop video input object Syntax stop(obj) Description stop(obj) halts an acquisition associated with the video input object obj. obj can be either a single video input object or an array of video input objects.
stoppreview Purpose Stop previewing video data Syntax stoppreview(obj) Description stoppreview(obj) stops the previewing of video data from image acquisition object obj. To restart previewing, call preview again. Examples Create a video input object and open a Video Preview window. vid = videoinput('winvideo',1); preview(vid) Stop previewing video data. stoppreview(vid); Restart previewing.
trigger Purpose Initiate data logging Syntax trigger(obj) Description trigger(obj) initiates data logging for the video input object obj. obj can be either a single video input object or an array of video input objects.
triggerconfig Purpose Configure video input object trigger properties Syntax triggerconfig(obj,type) triggerconfig(obj,type,condition) triggerconfig(obj,type,condition,source) config = triggerconfig(obj) triggerconfig(obj,config) Description triggerconfig(obj,type) configures the value of the TriggerType property of the video input object obj to the value specified by the text string type. For a list of valid TriggerType values, use triggerinfo(obj). type must specify a unique trigger configuration.
triggerconfig input object obj using config, a MATLAB structure with field names TriggerType, TriggerCondition, and TriggerSource, each containing the desired property value. Examples Example 1 Construct a video input object. vid = videoinput('winvideo', 1); Configure trigger properties for the object. triggerconfig(vid, 'manual') Trigger the acquisition. start(obj) trigger(obj) Remove video input object from memory.
triggerconfig delete(vid); See Also imaqhelp, trigger, triggerinfo, videoinput 12-59
triggerinfo Purpose Provide information about available trigger configurations Syntax triggerinfo(obj) triggerinfo(obj,type) config = triggerinfo(...) Description triggerinfo(obj) displays all available trigger configurations for the video input object obj. obj can only be a 1-by-1 video input object. triggerinfo(obj,type) displays the available trigger configurations for the specified TriggerType, type, for the video input object obj.
triggerinfo 2 Get information about the available trigger configurations for this object. config = triggerinfo(vid) config = 1x2 struct array with fields: TriggerType TriggerCondition TriggerSource 3 View one of the trigger configurations returned by triggerinfo.
videoinput Purpose Create video input object Syntax obj = videoinput(adaptorname) obj = videoinput(adaptorname,deviceID) obj = videoinput(adaptorname,deviceID,format) obj = videoinput(adaptorname,deviceID,format,P1,V1,...) Description obj = videoinput(adaptorname) constructs the video input object obj. A video input object represents the connection between MATLAB and a particular image acquisition device.
videoinput The property name and property value pairs can be in any format supported by the set function, i.e., parameter/value string pairs, structures, or parameter/value cell array pairs. To view a complete listing of video input object functions and properties, use the imaqhelp function. imaqhelp videoinput Remarks The toolbox chooses the first available video source object as the selected source and specifies this video source object’s name in the object’s SelectedSourceName property.
videoinput See Also 12-64 delete, imaqfind, isvalid, preview
wait Purpose Wait until image acquisition object stops running or logging Syntax wait(obj) wait(obj,waittime) wait(obj,waittime,state) Description wait(obj) blocks the MATLAB command line until the video input object obj stops running (Running = 'off'). obj can be either a single video input object or an array of video input objects. When obj is an array of objects, the wait function waits until all objects in the array stop running.
wait An image acquisition object stops running or logging when one of the following conditions is met: • The stop function is issued. • The requested number of frames is acquired. This occurs when FramesAcquired = FramesPerTrigger * (TriggerRepeat + 1) where FramesAcquired, FramesPerTrigger, and TriggerRepeat are properties of the video input object. • A run-time error occurs. • The object’s Timeout value is reached. Examples Create a video input object.
13 Properties — By Category This chapter contains brief descriptions of all the properties of the video input object and the properties of the video source object that are common to all video source objects. Video source objects can also support device-specific properties that vary depending on the image acquisition hardware. To get help on these device-specific properties, use the imaqhelp function, specifying the video source object as an argument. Video Input Objects (p.
13 Properties — By Category Video Input Objects General (p. 13-2) General image acquisition properties Callback (p. 13-3) Properties related to callback events Triggering (p. 13-4) Properties related to triggering Acquisition Source (p.
Video Input Objects Name Specify name of image acquisition object NumberOfBands Indicate number of color bands in data to be acquired Previewing Indicate whether object is currently previewing data in separate window ReturnedColorSpace Specify color space used in MATLAB ROIPosition Specify region-of-interest (ROI) window Running Indicate whether video input object is ready to acquire data Tag Specify descriptive text to associate with image acquisition object Timeout Specify how long to wait
13 Properties — By Category FramesAcquiredFcnCount Specify number of frames that must be acquired before frames acquired event is generated StartFcn Specify M-file executed when start event occurs StopFcn Specify M-file executed when stop event occurs TimerFcn Specify M-file callback function to execute when timer event occurs TimerPeriod Specify number of seconds between timer events TriggerFcn Specify M-file callback function to execute when trigger event occurs Triggering 13-4 InitialTrig
Video Input Objects Acquisition Source SelectedSourceName Specify name of currently selected video source Source Indicate video source objects associated with video input object 13-5
13 Properties — By Category Video Source Objects Video input objects create one or more video source objects that represent the image acquisition data sources. The following table lists the properties common to all video source objects. Note A video source object can support additional, device-specific properties. These properties vary, depending on the image acquisition hardware. To get information about these properties, use the imaqhelp function, specifying the video source object as an argument.
14 Properties — Alphabetical List
BayerSensorAlignment Purpose Specify sensor alignment for Bayer demosaicing Description If the ReturnedColorSpace property is set to 'bayer', then Image Acquisition Toolbox will demosaic Bayer patterns returned by the hardware. This color space setting will interpolate Bayer pattern encoded images into standard RGB images. If your camera uses Bayer filtering, the toolbox supports the Bayer pattern and can return color if desired.
BayerSensorAlignment The value of this property is only used if the ReturnedColorSpace property is set to 'bayer'.
DeviceID Purpose Identify image acquisition device represented by video input object Description The DeviceID property identifies the device represented by the video input object. A device ID is a number, assigned by an adaptor, that uniquely identifies an image acquisition device. The adaptor assigns the first device it detects the identifier 1, the second device it detects the identifier 2, and so on.
DeviceID Use the imaqhwinfo function again, specifying the name of the adaptor, to find out how many devices are available through that adaptor. The imaqhwinfo function returns the device IDs for all the devices in the DeviceIds field. info = imaqhwinfo('winvideo') info = AdaptorDllName: AdaptorDllVersion: AdaptorName: DeviceIDs: DeviceInfo: See Also [1x73 char] '2.
DiskLogger Purpose Specify MATLAB AVI file object used to log data Description The DiskLogger property specifies the AVI file object used to log data when the LoggingMode property is set to 'disk' or 'disk&memory'. A MATLAB AVI file object specifies the name and other characteristics of an AVI file. For example, you can use AVI file object properties to specify the codec used for data compression and the desired quality of the output.
DiskLogger Examples Create and configure an AVI file object. file = avifile('logfile.avi'); file.Quality = 50; Create and configure a video input object. vid = videoinput('winvideo', 1); vid.LoggingMode = 'disk&memory'; vid.DiskLogger = file; Start logging data to disk. start(vid) To ensure that the logged data is written to the disk file, close the AVI file. As an argument to the close function, specify the value of the video input object DiskLogger property, vid.
DiskLoggerFrameCount Purpose Specify number of frames written to disk Description The DiskLoggerFrameCount property indicates the current number of frames written to disk by the DiskLogger. This value is only updated when the LoggingMode property is set to 'disk' or 'disk&memory'. After Logging and Running are off, it is possible that the DiskLogger might still be writing data to disk.
ErrorFcn Purpose Specify M-file callback function to execute when run-time error occurs Description The ErrorFcn property specifies the function to execute when an error event occurs. A run-time error event is generated immediately after a run-time error occurs. Run-time errors include hardware errors and timeouts. Run-time errors do not include configuration errors such as setting an invalid property value. Run-time error event information is stored in the EventLog property.
EventLog Purpose Store information about events Description The EventLog property is an array of structures that stores information about events. Each structure in the array represents one event. Events are recorded in the order in which they occur. The first EventLog structure reflects the first event recorded, the second EventLog structure reflects the second event recorded, and so on. Each event log structure contains two fields: Type and Data.
EventLog Characteristics Access Examples Read only Data type Structure array Values Default is empty structure array. Create a video input object. vid = videoinput('winvideo'); Start the object. start(vid) View the event log to see which events occurred. elog = vid.EventLog; {elog.Type} ans = 'Start' 'Trigger' 'Stop' View the data associated with a trigger event. elog(2).
FrameGrabInterval Purpose Specify how often to acquire frame from video stream Description The FrameGrabInterval property specifies how often the video input object acquires a frame from the video stream. By default, objects acquire every frame in the video stream, but you can use this property to specify other acquisition intervals. Note Do not confuse the frame grab interval with the frame rate.
FrameGrabInterval Characteristics Access See Also Read only while running Data type double Values Any positive integer. The default value is 1 (acquire every frame).
FramesAcquired Purpose Indicate total number of frames acquired Description The FramesAcquired property indicates the total number of frames that the object has acquired, regardless of how many frames have been extracted from the memory buffer. The video input object continuously updates the value of the FramesAcquired property as it acquires frames. Note When you issue a start command, the video input object resets the value of the FramesAcquired property to 0 (zero) and flushes the buffer.
FramesAcquiredFcn Purpose Specify M-file executed when specified number of frames have been acquired Description The FramesAcquiredFcn specifies the M-file function to execute every time a predefined number of frames have been acquired. A frames acquired event is generated immediately after the number of frames specified by the FramesAcquiredFcnCount property is acquired from the selected video source. This event executes the M-file specified for FramesAcquiredFcn.
FramesAcquiredFcnCount Purpose Specify number of frames that must be acquired before frames acquired event is generated Description The FramesAcquiredFcnCount property specifies the number of frames to acquire from the selected video source before a frames acquired event is generated. The object generates a frames acquired event immediately after the number of frames specified by FramesAcquiredFcnCount is acquired from the selected video source.
FramesAvailable Purpose Indicate number of frames available in memory buffer Description The FramesAvailable property indicates the total number of frames that are available in the memory buffer. When you extract data, the object reduces the value of the FramesAvailable property by the appropriate number of frames. You use the getdata function to extract data and move it into the MATLAB workspace.
FramesPerTrigger Purpose Specify number of frames to acquire per trigger using selected video source Description The FramesPerTrigger property specifies the number of frames the video input object acquires each time it executes a trigger using the selected video source. When the value of the FramesPerTrigger property is set to Inf, the object keeps acquiring frames until an error occurs or you issue a stop command.
InitialTriggerTime Purpose Record absolute time of first trigger Description The InitialTriggerTime property records the absolute time of the first trigger. The absolute time is recorded as a MATLAB clock vector. For all trigger types, InitialTriggerTime records the time when the Logging property is set to 'on'. To find the time when a subsequent trigger executed, view the Data.AbsTime field of the EventLog property for the particular trigger.
InitialTriggerTime sprintf('%d:%d:%d', t(4),t(5),t(6)) ans = 13:26:20 See Also Functions clock, getdata Properties EventLog, Logging, TriggerType 14-20
Logging Purpose Indicate whether object is currently logging data Description The Logging property indicates whether the video input object is currently logging data. When a trigger occurs, the object sets the Logging property to 'on' and logs data to memory, a disk file, or both, depending on the value of the LoggingMode property. The object sets the Logging property to 'off' when it acquires the requested number of frames, an error occurs, or you issue a stop command.
LoggingMode Purpose Specify destination for acquired data Description The LoggingMode property specifies where you want the video input object to store the acquired data. You can specify any of the following values: Value Description 'disk' Log acquired data to a disk file. 'disk&memory' Log acquired data to both a disk file and to a memory buffer. 'memory' Log acquired data to a memory buffer.
LoggingMode Properties DiskLogger, Logging 14-23
Name Purpose Specify name of image acquisition object Description The Name property specifies a descriptive name for the image acquisition object. Characteristics Access Examples Read/write Data type String Values Any text string. The toolbox creates the default name by combining the values of the VideoFormat and DeviceID properties with the adaptor name in this format: VideoFormat + '-' + adaptor name + '-' + DeviceID Create an image acquisition object.
NumberOfBands Purpose Indicate number of color bands in data to be acquired Description The NumberOfBands property indicates the number of color bands in the data to be acquired. The toolbox defines band as the third dimension in a 3-D array, as shown in this figure. The value of the NumberOfBands property indicates the number of color bands in the data returned by getsnapshot, getdata, and peekdata. Characteristics Access Examples Read only Data type double Values Any positive integer.
NumberOfBands If you retrieve the value of the VideoFormat property, you can see that the video data is in RGB format.
Parent Purpose Identify video input object that is parent of video source object Description The Parent property identifies the video input object that is the parent of a video source object. The parent of a video source object is defined as the video input object owning the video source object.
Previewing Purpose Indicate whether object is currently previewing data in separate window Description The Previewing property indicates whether the object is currently previewing data in a separate window. The object sets the Previewing property to 'on' when you call the preview function. The object sets the Previewing property to 'off' when you close the preview window using the closepreview function or by clicking the Close button in the preview window title bar.
ReturnedColorSpace Purpose Specify color space used in MATLAB Description The ReturnedColorSpace property specifies the color space you want the toolbox to use when it returns image data to the MATLAB workspace. This is only relevant when you are accessing acquired image data with the getsnapshot, getdata, and peekdata functions. This property can have any of the following values: Value Description 'grayscale' MATLAB grayscale color space. 'rgb' MATLAB RGB color space.
ROIPosition Purpose Specify region-of-interest (ROI) window Description The ROIPosition property specifies the region-of-interest acquisition window. The ROI window defines the actual size of the frame logged by the toolbox, measured with respect to the top left corner of an image frame. ROIPosition is specified as a 1-by-4 element vector [XOffset YOffset Width Height] where 14-30 XOffset Position of the upper left corner of the ROI, measured in pixels.
ROIPosition Characteristics Access See Also Read only while running Data type 1-by-4 element vector of doubles Values Default is [ 0 0 width height ] where width and height are determined by VideoResolution.
Running Purpose Indicate whether video input object is ready to acquire data Description The Running property indicates if the video input object is ready to acquire data. Along with the Logging property, Running reflects the state of a video input object. The Running property indicates that the object is ready to acquire data, while the Logging property indicates that the object is acquiring data. The object sets the Running property to 'on' when you issue the start command.
Selected Purpose Indicate whether video source object will be used for acquisition Description The Selected property indicates if the video source object will be used for acquisition. You select a video source object by specifying its name as the value of the video input object’s SelectedSourceName property. The video input object Source property is an array of all the video source objects associated with the video input object. If Selected is 'on', the video source object is selected.
Selected src = getselectedsource(vid); View its Name and Selected properties. src.SourceName ans = input1 src.
SelectedSourceName Purpose Specify name of currently selected video source Description The SelectedSourceName property specifies the name of the video source object from which the video input object acquires data. The name is specified as a string. By default, the video input object selects the first available video source object stored in the Source property. The toolbox defines a video source as one or more hardware inputs that are treated as a single entity.
Source Purpose Indicate video source objects associated with video input object Description The Source property is a vector of video source objects that represent the physical data sources connected to a device. When a video input object is created, the toolbox creates a vector of video source objects associated with the video input object. Each video source object created is provided a unique source name.
Source Examples Create an image acquisition object. vid = videoinput('matrox'); To access all the video source objects associated with a video input object, use the Source property of the video input object. (To view only the currently selected video source object, use the getselectedsource function.) sources = vid.Source; src = sources(1); To view the properties of the video source object src, use the get function.
SourceName Purpose Indicate name of video source object Description The SourceName property indicates the name of a video source object. SourceName is one of the values in the video input object’s SelectedSourceName property.
StartFcn Purpose Specify M-file executed when start event occurs Description The StartFcn property specifies the M-file function to execute when a start event occurs. A start event occurs immediately after you issue the start command. The StartFcn callback executes synchronously. The toolbox does not set the object’s Running property to 'on' until the callback function finishes executing. If the callback function encounters an error, the object never starts running.
StopFcn Purpose Specify M-file executed when stop event occurs Description The StopFcn property specifies the M-file function to execute when a stop event occurs. A stop event occurs immediately after you issue the stop command. The StopFcn callback executes synchronously. Under most circumstances, the image acquisition object will be stopped and the Running property will be set to 'off' by the time the M-file completes execution. Stop event information is stored in the EventLog property.
Tag Purpose Specify descriptive text to associate with image acquisition object Description The Tag property specifies any descriptive text that you want to associate with an image acquisition object. The Tag property can be useful when you are constructing programs that would otherwise need to define the image acquisition object as a global variable, or pass the object as an argument between callback routines.
Timeout Purpose Specify how long to wait for image data Description The Timeout property specifies the amount of time (in seconds) that the getdata and getsnapshot functions wait for data to be returned. The Timeout property is only associated with these blocking functions. If the specified time period expires, the functions return control to the MATLAB command line. A timeout is one of the conditions for stopping an acquisition.
TimerFcn Purpose Specify M-file callback function to execute when timer event occurs Description The TimerFcn property specifies the M-file callback function to execute when a timer event occurs. A timer event occurs when the time period specified by the TimerPeriod property expires. The toolbox measures time relative to when the object is started with the start function. Timer events stop being generated when the image acquisition object stops running.
TimerPeriod Purpose Specify number of seconds between timer events Description The TimerPeriod property specifies the amount of time, in seconds, that must pass before a timer event is triggered. The toolbox measures time relative to when the object is started with the start function. Timer events stop being generated when the image acquisition object stops running. Note Some timer events might not be processed if your system is significantly slowed or if the TimerPeriod value you specify is too small.
TriggerCondition Purpose Indicate required condition before trigger event occurs Description The TriggerCondition property indicates the condition that must be met, via the TriggerSource, before a trigger event occurs. The trigger conditions that you can specify depend on the value of the TriggerType property. TriggerType Value Conditions Available 'hardware' Device-specific. For example, some Matrox hardware support conditions such as 'risingEdge' and 'fallingEdge'.
TriggerCondition Properties TriggerSource, TriggerType 14-46
TriggerFcn Purpose Specify M-file callback function to execute when trigger event occurs Description The TriggerFcn property specifies the M-file callback function to execute when a trigger event occurs. The toolbox generates a trigger event when a trigger is executed based on the configured TriggerType, and data logging is initiated. Under most circumstances, the M-file callback function is not guaranteed to complete execution until sometime after the toolbox sets the Logging property to 'on'.
TriggerFrameDelay Purpose Specify number of frames to skip before acquiring frames after trigger occurs Description The TriggerFrameDelay property specifies the number of frames to skip before acquiring frames after a trigger occurs. The object waits the specified number of frames after the trigger before starting to log frames. In this figure, the TriggerFrameDelay is set to 5, so the object lets five frames pass before starting to acquire frames.
TriggerFrameDelay Properties FramesPerTrigger 14-49
TriggerRepeat Purpose Specify number of additional times to execute trigger Description The TriggerRepeat property specifies the number of additional times you want the object to execute a trigger. This table describes the behavior for several typical TriggerRepeat values. Value Behavior 0 (default) Execute the trigger once when the trigger condition is met. Any positive integer Execute the trigger the specified number of additional times when the trigger condition is met.
TriggersExecuted Purpose Indicate total number of executed triggers Description The TriggersExecuted property indicates the total number of triggers that the video input object has executed. Characteristics Access See Also Read only Data type double Values Any nonnegative integer. The default value is 0 (zero).
TriggerSource Purpose Indicate hardware source to monitor for trigger conditions Description The TriggerSource property indicates the hardware source the image acquisition object monitors for trigger conditions. When the condition specified in the TriggerCondition property is met, the object executes the trigger and starts acquiring data. You use the triggerconfig function to specify this value. The value of the TriggerSource property is device specific.
TriggerType Purpose Indicate type of trigger used by video input object Description The TriggerType property indicates the type of trigger used by the video input object. Triggers initiate data acquisition. You use the triggerconfig function to specify one of the following values for this property. Trigger Type Description 'hardware' Trigger executes when a specified condition is met.
TriggerType Properties TriggerCondition, TriggerSource 14-54
Type Purpose Identify type of image acquisition object Description The Type property identifies the type of image acquisition object. An image acquisition object can be either one of two types: • Video input object • Video source object Characteristics Access Read only Data type String Values [ 'videoinput' | 'videosource' ] Defined at object creation time Examples vid = videoinput('winvideo',1) get(vid,'Type') ans = videoinput This example gets the type of a video source object.
UserData Purpose Store data to associate with image acquisition object Description The UserData property specifies any data that you want to associate with an image acquisition object. Note The object does not use the data in UserData directly. However, you can access the data by using the get function or by referencing the property as you would a field in a MATLAB structure.
VideoFormat Purpose Specify video format or name of device configuration file Description The VideoFormat property specifies the video format used by the image acquisition device or the name of a device configuration file, depending on which you specified when you created the object using the videoinput function. Image acquisition devices typically support multiple video formats. When you create a video input object, you can specify the video format that you want the device to use.
VideoFormat AdaptorDllName: AdaptorDllVersion: AdaptorName: DeviceIDs: DeviceInfo: [1x73 char] '2.1 (R2007a)' 'winvideo' {[1]} [1x1 struct] info.
VideoResolution Purpose Indicate width and height of incoming video stream Description The VideoResolution property is a two-element vector indicating the width and height of the frames in the incoming video stream. VideoResolution is specified as [Width Height] Width is measured in pixels and height is measured in rows. Note You specify the video resolution when you create the video input object, by passing in the video format argument to the videoinput function.
VideoResolution 14-60
15 Blocks — Alphabetical List
From Video Device Purpose Acquire live image data from image acquisition device Library Image Acquisition Toolbox Description The From Video Device block lets you acquire image and video data streams from image acquisition devices, such as cameras and frame grabbers, in order to bring the image data into a Simulink model. The block also lets you configure and preview the acquisition directly from Simulink. The From Video Device block opens, initializes, configures, and controls an acquisition device.
From Video Device For more information on these features, see the Simulink documentation. Note For an in-depth example of using this block, see Using the From Video Device Block in Simulink. To see a demo of using this block, go to the Demos tab in the Help browser, under Toolboxes > Image Acquisition. Dialog Box In the Source Block Parameters dialog box, the options that show up are dependent on the device you are using.
From Video Device 15-4
From Video Device The second diagram illustrates the options that may appear if your device supports using either one output port or multiple output ports for the color bands (the Ports mode option). Ports mode is visible if the selected device and format settings can output color data. The following fields appear in the Source Block Parameters dialog box. Some fields may not appear, as they are device dependent. If your selected device does not support a feature, it may not appear in the dialog box.
From Video Device connected to your system. All video capture devices supported by Image Acquisition Toolbox are supported by the block. Video format Shows the video formats supported by the selected device. This list varies with each device. If your device supports the use of camera files, From camera file will be one of the choices in the list. Camera file This option only appears if you select a device that supports camera files.
From Video Device ROI position Use this field to input a row vector that specifies the region of acquisition in the video image. The format is [row, column, height, width]. The default values for row and column are 0. The default values for height and width are set to the maximum allowable value, indicated by the video format’s resolution. Therefore you only need to change the values in this field if you do not want to capture the full image size. Preview button Preview the video image.
From Video Device corresponding to the uncompressed red, green, and blue color bands. Note that some devices will use YCbCr for the separate color signals. Note The block acquires data in the default ReturnedColorSpace setting for the specified device and format. Data type The image data type when the block outputs frames. This data type indicates how image frames are output from the block to Simulink. It supports all MATLAB data types and single is the default.
Video Input (Obsolete) Purpose Connect to image acquisition device Library Image Acquisition Toolbox Description The Video Input block is obsolete. It may be removed in a future version of the Image Acquisition Toolbox block library. Use the replacement block From Video Device. The Video Input block opens, initializes, configures, and controls an acquisition device. The opening, initializing, and configuration occur once, at the start of the model’s execution.
Video Input (Obsolete) Device name The image acquisition device to which you want to connect. The items in the list vary, depending on which devices you have connected to your system. Input video format The video formats supported by the device. This list varies with each device. Frame rate The speed at which frames are delivered to the block, expressed as frames per second (fps). Output data type The image data type used when the block outputs frames.
A Examples Use this list to find examples in the documentation.
A Examples Fundamentals “Basic Image Acquisition Procedure” on page 1-5 “Determining the Device Adaptor Name” on page 4-3 “Determining the Device ID” on page 4-4 “Getting More Information About a Particular Device” on page 4-5 “Determining Supported Video Formats” on page 4-6 “Creating a Video Input Object” on page 4-10 “Specifying the Video Format” on page 4-12 “Using Device Configuration Files (Camera Files)” on page 4-14 “Specifying the Selected Video Source Object” on page 4-15 “Viewing the Values of
Acquiring Image Data Acquiring Image Data “Specifying Trigger Type, Source, and Condition” on page 5-6 “Example: Using an Immediate Trigger” on page 5-11 “Example: Using a Manual Trigger” on page 5-13 “Example: Using a Hardware Trigger” on page 5-16 “Example: Acquiring 100 Frames” on page 5-23 “Determining How Many Frames Are Available” on page 5-25 “Waiting for an Acquisition to Finish” on page 5-31 “Freeing Memory” on page 5-37 “Example: Logging Data to Disk” on page 5-43 Working with Acquired Data “Exa
A A-4 Examples
Index A B acquiring data 3-21 acquiring images basic procedure 1-5 connecting to devices 4-1 overview 5-3 specifying a delay 5-28 specifying the amount 5-21 specifying the frame grab interval 5-22 specifying the timeout value 14-42 troubleshooting hardware 10-3 waiting for completion 5-31 Acquisition Parameters Device Properties 3-11 Disk Logging 3-14 Frames Per Trigger 3-9 hardware triggering 3-17 Logging 3-13 Memory Logging 3-14 Number of Triggers 3-15 Region of Interest (ROI) 3-10 Trigger Type 3-16 Tri
Index troubleshooting 10-4 DALSA Coreco Sapera devices determining driver version 10-7 troubleshooting 10-6 dark frames 3-24 Data Translation devices troubleshooting 10-8 data type used by device finding 4-16 DCAM support for 2-4 troubleshooting 10-9 DCAM driver installing and configuring 10-10 debugging your hardware 10-27 imaqsupport 10-27 delete function 12-4 deleting image acquisition objects 4-28 desktop user interface 3-2 device configuration files 4-14 device drivers determining version 10-5 10-7 10
Index Firewire (IEEE 1394) Digital Camera (DCAM) specification support for 2-4 flushdata function 12-7 using 5-37 frame delay specifying 14-48 frame grabbers 2-2 troubleshooting 10-3 troubleshooting DALSA Coreco IFC devices 10-4 troubleshooting DALSA Coreco Sapera devices 10-6 troubleshooting Data Translation devices 10-8 frame memory limit setting 5-35 frame rates in example 6-5 relation to processing speed 2-6 FrameGrabInterval property 14-12 using 5-22 frames determining dimensions of 6-13 determining h
Index specifying a delay 14-48 specifying the timeout value 14-42 time-based acquisition 6-5 using timers with 14-43 image acquisition devices 2-2 adaptors 4-3 adding support for 9-1 connecting to 4-1 finding the device ID 4-3 list of supported devices 2-4 setting up 2-5 troubleshooting 10-3 10-23 troubleshooting Hamamatsu devices 10-16 image acquisition objects associating data with 14-56 avoiding global variables 14-41 configuring properties 4-17 creating 4-9 deleting 4-28 determining the device ID 14-4
Index imaqcallback function using default callback function 7-2 imaqfind function 12-16 using 4-28 imaqhelp function 12-18 getting property information 4-21 imaqhwinfo function 12-20 using 4-3 imaqmem function 12-24 using 5-35 imaqmontage function 12-27 imaqreset function 12-29 imaqsupport function 10-27 imaqtool 3-2 imaqtool function 12-30 immediate triggers defined 5-9 example 5-11 InitialTriggerTime property 14-19 using 6-20 islogging function 12-31 isrunning function 12-33 isvalid function 12-35 L d
Index Preview window 3-19 previewing closing the preview window 2-11 creating custom preview GUIs 2-11 opening the Video Preview window 2-9 performing custom processing 2-13 stopping the preview video stream 2-10 previewing data 3-21 Previewing property 14-28 properties determining their value 4-20 getting information about 4-21 of image acquisition objects 4-17 propinfo function 12-47 getting property information 4-21 Q QImaging devices determining driver version 10-20 troubleshooting 10-19 R refreshing
Index specifying period of 14-44 specifying with image acquisition 14-43 timing of acquisition retrieving 6-20 trigger events definition 7-6 information returned 7-8 specifying callback function 14-47 trigger function 12-56 Trigger Type 3-16 TriggerCondition property 14-45 configuring 5-7 triggerconfig function 12-57 TriggerFcn 7-12 TriggerFcn property 14-47 TriggerFrameDelay property 14-48 using 5-28 triggerinfo function 12-60 Triggering 3-15 TriggerRepeat property 14-50 using 5-29 triggers configuring 5-
Index opening 2-9 stopping the preview video stream 2-10 troubleshooting 10-26 video source objects array of 14-36 currently selected source 14-33 displaying list of 4-15 names of 14-38 relation to video input objects 4-9 specifying selected object 4-15 VideoFormat property 14-57 videoinput function 12-62 using 4-9 Index-8 VideoResolution property 14-59 viewing images 6-19 W wait function 12-65 using 5-31 waiting for an acquisition to complete 5-31 webcams support for 2-4 winvideo adaptor troubleshooti