Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Using the JAI CV-A1 Camera in Asynchronous Reset Mode With the IMAQ 1409

1 ratings | 5.00 out of 5
Print

Overview

This article explains how to use the JAI CV-A1 camera in asynchronous reset mode with the National Instruments IMAQ 1409 image acquisition device to acquire clear images of moving objects.

Progressive Scan and Asynchronous Reset

Some industrial imaging and Web inspection applications involve acquiring images of fast-moving objects. In most cases, an external trigger produced by a photocell, proximity sensor, or a similar device starts the image acquisition.

Acquired images of moving objects are often blurred. However, triggered acquisition with a progressive scan camera is one way to produce an image without the blur. Progressive scan cameras, such as the JAI CV-A1, eliminate the blur that results from motion because they acquire one full frame at a time. Moving images acquired using interlaced cameras often produce a motion-induced blur because they acquire the odd and even fields separately and then interlace them. Motion-induced blur occurs when the two fields are not acquired at the same time and the object is moving between the fields.

Triggering only the acquisition device while using the camera in free-running mode creates a variable delay between the time the acquisition device receives the trigger and the time the image is acquired. The delay occurs because the acquisition device must finish acquiring the current frame before acquiring the triggered frame. Figure 1 illustrates this variable delay.


Figure 1: IMAQ 1409 Triggered Acquisition


Because the delay is variable, depending on when the trigger occurs, the object does not appear at the same location on all the triggered images. Asynchronous reset cameras offer one solution to this problem. Asynchronous reset techniques help keep the motion device (a conveyor belt, for example) moving while acquiring images on the fly. These techniques offer a way to introduce a vision system in an assembly line with very little modification of the environment.

When an asynchronous reset camera receives a trigger, it resets the CCD and immediately begins acquiring a new image, which ensures that the image is always taken at the same time after trigger assertion. In this case, the objects imaged appear at the same location in the image, which simplifies the preprocessing of the image, including locating the object under inspection and specifying the regions of inspection within the image.

Figure 2 illustrates the asynchronous reset principle.


Figure 2: Asynchronous Reset


The JAI CV-A1 supports the following external asynchronous trigger modes, which can be set with RS-232C commands.
  • Edge Preselect Mode—Exposure starts at the first HD pulse after the trigger leading edge. Exposure stops and the resulting video is read out after the duration of the shutter time selected by serial command.
  • Pulse Width Control Mode—Exposure starts from the leading edge of the trigger pulse. Exposure stops at the trailing edge of the trigger pulse, and the resulting video is read out.
  • Frame Delay Readout Mode—Exposure starts from the leading edge of the trigger pulse. It stops at the trailing edge of the trigger pulse. The resulting video is read out after an external VD pulse is applied. The difference between Frame Delay Readout mode and Pulse Width Control mode is that in Frame Delay Readout mode, you can get the image later when you send the VD to the camera.
  • Long Time Exposure Mode—Exposure time is the interval between two external VD pulses sent to the VD input. The exposure starts after the input of a VD, and it ends after the next VD input, which again starts a new exposure. Because thermal and dark current noise increase according to accumulation time, the exposure time should not exceed two seconds.
  • Start/Stop Mode—Exposure is controlled by the interval between the external trigger pulse and an external VD pulse. Exposure starts at the first HD pulse after the trigger leading edge and stops after the rising edge of the VD. The shortest exposure time in this mode is 75.9 microseconds (1.3H). The longest exposure time is 116.775 milliseconds (2000 H).
  • Smearless Readout Mode—This mode reduces the unwanted smear signal from a highlighted scene when a short exposure time is used. The trigger mode is similar to Edge Preselect mode, but Smearless Readout mode performs a dummy readout before the active accumulation is started. It removes the smear above the highlighted parts in the image, but a smear still remains below highlighted areas. The trigger leading edge starts the dummy readout. It takes 3.153 ms (54 H) before the exposure starts. The exposure stops and the resulting video signal is read out after the selected shutter time.
    The attached example program shows how to acquire in each of these modes.

    Camera Switches Setup

This section explains how to set up the JAI CV-A1 camera to run in asynchronous reset mode. Setting up the JAI CV-A1 to run in asynchronous reset mode requires modification of some jumpers on the PK8342A board (inside the camera). Refer to Figures 3 and 4 for an illustration of the internal camera jumpers and switches. Table 1 at the end of this section summarizes the camera switch and jumper configuration for revision A of the JAI CV-A1.

Note: If you are unsure of how to modify the internal camera jumpers, contact JAI technical support for more information.

To set up the JAI CV-A1 for asynchronous reset, make the following modifications to internal camera switches.
  • Verify that switch SW1-1 (VD) on PK8342A board is set to the IN position to input the vertical synchronization signal (VSYNC). This setting is the factory default. The Write Enable (WEN) signal connects to the IMAQ 1409 VSYNC.
    Note: Frame Delay Readout mode, Long Time Exposure mode, and Start/Stop mode require that the IMAQ device provide the VSYNC signal to the camera.
  • Set switch SW1-2 on PK8342A board to OUT to output the horizontal synchronization signal (HSYNC).
  • Verify that switches SW2-1 and SW2-2 on PK8342A board are set to the off (lower) position to set the termination of the external synchronization signals to TTL. This setting is the factory default.

      Figure 3: PK8342 Board, Side A (from JAI CV-A1 Operation Manual, Rev. A)
  • To use pixel clock pulse output, short-circuit jumper JP2. This jumper is located on the board at the connector end (back) of the camera. Pixel clock pulse is output from pin 9 of the 12-pin multi-connector.

    Figure 4: Back Board of the JAI CV-A1 (from JAI CV-A1 Operation Manual, Rev. A)

Summary: Camera Settings
Table 1 below offers a quick reference for adjusting your camera settings.

Table 1: Internal Switches and Jumper Settings

[+] Enlarge Image

Cabling Requirements

This section discusses cabling and power supply requirements.

Note: You can use the IMAQ-A6822 breakout box to easily prototype your cable.

Figure 5 shows the cable schematics for the JAI CV-A1 and the IMAQ 1409, and the serial port of the computer if you prototype your cable with the IMAQ-A6822.


Figure 5: Prototype Cable

Figure 6 shows the cable schematics for the JAI CV-A1 and the IMAQ 1409 as you can build it when you deploy your system.


Figure 6: Cable Schematics

Tables 2, 3, 4, and 5 outline connection for the power supply, connections from the IMAQ 1409 to the JAI CV-A1, external BNCs, and serial cable connections.

Table 2: Power Supply

National Instruments recommends using a 26-gauge shielded twisted pair for the power supply.

Table 3: Connecting the IMAQ 1409 to the JAI CV-A1 (12-Pin Hirose Connector)

National Instruments recommends using 30-gauge shielded twisted pairs for the timing signals.

Note: Because this cable transmits high-frequency signals, National Instruments recommends limiting the cable length to 4 meters to limit the attenuation and to preserve the quality of the signal and signal-to-noise ratio of the analog video signal.

Table 4: External BNCs



Table 5: Connecting the PC Serial Port to the JAI CV-A1 (6-Pin Hirose Connector)



PC Serial Port (DSUB9) Loopback Connections
1. Connect pins 1, 4, and 6 of the DSUB9 connector. These pins correspond to the Data Carrier Detect, Data Terminal Ready, and Data Set Ready signals, respectively.
2. Connect pins 7 and 8 of the DSUB9 connector. These pins correspond to the Request to Send and Clear to Send signals, respectively.

Interfacing With the IMAQ 1409


This section explains how to configure your hardware and software to acquire images with the JAI CV-A1.

Note: Before configuring your software, make sure to remove the W1 jumper on the 1409 device.

1. Download and install the camera control utility from the JAI Web site.
2. Launch the JAI A1 control utility, and click Start>>Programs>>CV-A1 Control Tool>>CV-A1 Control Tool.
3. Click the Shutter and Sync Signals button.
4. Set the Pixel Clock Out radio button to On to output the pixel clock.

Configuration Files
1. Copy the JAI CV-A1(1409).icd file into the <NI-IMAQ>\Data folder. Go to ftp://ftp.ni.com/support/imaq/camera_support/camera_files/analog/jai/ to download this camera configuration file.
2. Launch Measurement & Automation Explorer (MAX).
3. Expand the Devices and Interfaces branch of the tree view.
4. Expand the IMAQ PCI/PXI-1409 branch of the tree view.
5. Right-click Channel 0: RS-170, and select Camera>>JAI>>JAI CV-A1.
6. Click Save and exit MAX.

Note: Because asynchronous reset mode requires that you provide the trigger signals to the camera, image acquisition within MAX is not possible.

In order to acquire images in asynchronous reset mode, both the IMAQ 1409 and the camera must receive the trigger. The input trigger connects to the IMAQ device, which generates the trigger signal sent to the camera. This signal is synchronized with the input trigger. Start/Stop mode allows you to specify the exposure time by sending another pulse on another line (External Trigger 3, connected to VSYNC of the camera). The time difference between the first trigger sent to the camera and the VSYNC pulse corresponds to the exposure time. The attached example demonstrates how to use the software to generate these pulses and to drive the exposure time.

In Edge Preselect mode, send the start trigger and specify the exposure time by serial command.

Because the IMAQ 1409 generates the triggers sent to the camera, you can also use the camera without providing an external trigger input to the IMAQ device by specifying the frequency and delay of the pulse signals generated by the IMAQ device. These pulse signals determine the acquisition rate and exposure time (internal trigger mode).

When acquiring images of moving objects, decreasing the exposure time (increasing the shutter speed) ensures that the resulting images are not blurred. Decreasing the exposure time decreases the amount of light the CCD sensor can integrate. To compensate for the short exposure time and still acquire a well-contrasted image, provide a more intense lighting or use a strobe light at the time of the image acquisition. The strobe light can also control the exposure time, in which case the sensor exposure time can be set to the maximum.

In Edge Preselect mode and Pulse Width Control mode, the acquisition device is capable of outputting a signal that corresponds to the start of a frame (TRIG 1). For example, it can be useful to illuminate the object by firing a strobe light when the frame is acquired.

Computing Exposure Time
This section explains how to compute the correct exposure time for your application.

To compute the exposure time needed for your application, you need to know the following parameters:

  • Horizontal resolution of your camera (example: 640 pixels)
  • Horizontal field of view (example: 100 mm)
  • Speed of the moving object (example: 150 mm/s)
  • Acceptable blur—defines the maximum blur that is acceptable in the image (example: < 1 pixel). The acceptable blur corresponds to the number of pixels that the object moves during the exposure time.
The shutter speed needed for the application corresponds to the time needed for the object to move of the number of pixels specified by the blur. Figure 7 demonstrates how to compute exposure time.


Figure 7: Computing Exposure Time

In the example, the Exposure Time needs to be less than: 1 x 100 / (640 x 150) = 0.00104 s = 1.04 ms.

Example Program
This section describes a sample program (JAI CV-A1 Asynchronous Reset Example.llb) that demonstrates an asynchronous reset acquisition in Pulse Width Control mode.

This example shows how to control the camera's shutter speed and how to perform an asynchronous reset acquisition with an IMAQ 1409 and a JAI CV-A1 camera. You can either provide an external trigger to trigger the acquisition, or the IMAQ device can generate a signal to trigger the acquisition (internal trigger). The internal trigger allows you to test the example without having to provide an external trigger signal to the IMAQ device.

This example makes calls to VIs that use NI-VISA to communicate with the camera via the serial port. Make sure NI-VISA is installed before running the example.

  1. Launch MAX.
  2. Expand the Devices and Interfaces branch of the tree view.
  3. Make sure a Ports (Serial & Parallel) branch appears in the tree view with a sub-item called COM1. If the Ports (Serial & Parallel) branch does not appear in the tree view, reinstall NI-VISA and reboot your computer.

Code Description

In the first frame, the RS232 VIs that drive the camera are called to set the camera to Pulse Width Control mode.

Figure 8: Setting the Camera to Pulse Width Control Mode


In the second frame, IMAQ Init is called to initialize the IMAQ device. Next, IMAQ Generate Pulse is called to create the shutter pulse, which controls the camera's shutter and asynchronous reset.

In internal trigger mode (case False), a pulse train is generated at the specified frequency. The width of the pulse corresponds to the exposure time.

In external trigger mode, the pulse is re-armed to send the pulse to the camera at the same time that the IMAQ device receives the pulse from the external device.

In the next frame, IMAQ Configure List configures the buffer list for a ring acquisition, and IMAQ Start starts the acquisition.


Figure 9: Configuration of the Acquisition

Frame 4 contains the acquisition loop. IMAQ Copy provides a copy of the image currently being acquired. IMAQ WindDraw displays this image in an image window.

When the user clicks Stop, IMAQ Generate Pulse is called twice to stop generating the pulses. IMAQ Close is called to shut down the acquisition.


Figure 10: Acquisition loop


The last frame disposes the images and resets the camera in normal mode.
Related Links:
Interfacing the JAI CV-A1 With the IMAQ 1409
Using the JAI CV-A1 Camera in Asynchronous Reset Mode With the IMAQ 1409
1 ratings | 5.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).