Acquire Test Data Using Image Acquisition Toolbox Element

Add Video Input Element to a Test

This example illustrates how to use the Video Input element in the SystemTest™ software. The example uses the Video Input element to acquire a single frame of video for each iteration of the test and uses the MATLAB element to display the acquired image.

The first step is to add the element, as shown in this section. The two following sections contain the remaining steps.

To create a test using the Video Input element:

  1. Open the SystemTest software by typing systemtest at the MATLAB® command line.

  2. In the SystemTest desktop, start to create your test by selecting Main Test and adding the Video Input element. In the Test Browser, click New Test Element > Image Acquisition > Video Input.

    The SystemTest software adds the Video Input element to the Main Test section of the test and displays the Properties pane for the Video Input element. (You can also add elements to the Pre Test or Post Test sections of a test but this example does not require it.)

    In the following figure, note the red x in the Video Input element icon in the Test Browser. This red x indicates that the element is in an error state. The SystemTest software outlines the required fields in red in the Properties pane.

  3. Specify the device you want to use to acquire image data in the Properties pane for the Video Input element. You must specify the name of the adaptor you want to use in the Adaptor field, which is a required field. (The SystemTest software uses red outlining to indicate required fields that are not filled in yet.) The SystemTest software can detect any image acquisition devices supported by the Image Acquisition Toolbox™ software that are connected to your system and fills in this field with a default value based on the alphabetical list of devices, if one is available. For our example, in the figure, the SystemTest software sets the Adaptor field to winvideo. If your system has other adaptors that can connect to devices, select the adaptor that you want to use from the Adaptor list.

    After the Adaptor field is set, the SystemTest software fills in the Device, Video Format, and Selected Source fields with default values. The SystemTest software populates the drop-down lists associated with each field with all available options for the field. Adaptors can support multiple devices and devices can support multiple formats. The SystemTest software preselects the default values for these fields but lists all available options in the drop-down lists associated with these fields. The following figure shows the list for the Video Format field:

  4. Specify the number of frames you want to acquire at each iteration of the test in the Number of frames field, which is a required field. For this example, we only need to acquire one frame for each iteration, so set this field to 1.

  5. Specify the name of the SystemTest test variable that the acquired video data will be assigned to at each iteration. This is a required field. You can select a test variable from the list or create a new test variable by selecting New Test Variable.

    If you select New Test Variable, the SystemTest software opens the Edit dialog box. Assign a name to the test variable, or accept the default name, and click OK. You do not need to assign the test variable an initial value.

    The SystemTest software adds the new test variable to the list in the Test Variables pane.

  6. Optionally, verify the Video Input element settings by clicking the Preview Window button. The SystemTest software opens a Video Preview window and displays a live video stream from your camera. You can use this to verify that your hardware is configured correctly. You should close the preview window before running the test.

  7. To complete this example test, add a MATLAB element to the Main Test section. In this MATLAB element, call the MATLAB image function to display the image frame acquired at each iteration.

This completes this example test illustrating how to incorporate image data into the SystemTest software. In a real testing application, you can define test vectors that determine the number of iterations of your test that the SystemTest software performs. You can also compare test variables against defined limits in the Limit Check element and specify pass/fail criteria.

Save and View Test Results

Before running a test, you must specify which test variables you want to save as a test result. In the Save Results Properties pane, you select the test variable that you want to save and map it to a test result name.

The SystemTest software allows you to view the results you have chosen to save for your test using a workspace variable called stresults. It provides access to the test results object, which is useful for comparing the results of separate test runs and for postprocessing test results.

For more information, see View Test Results at the Command Line.

Run the Test

To run the test, do one of the following:

  • Click the Run button.

  • Select Run > Run.

  • Press the F5 key.

While the test executes, the SystemTest software reports on the progress of the test in the Run Status pane.

Was this topic helpful?