Color AcquisitionCognex VisionPro

This topic contains the following sections.

The VisionPro acquisition system can acquire a wide variety of pixel formats including Grey8, Grey10, Bayer8, and others. Each video format will output a specific pixel format which you can convert by setting the OutputPixelFormat property. If the OutputPixelFormat property you specify requires no conversion, no conversion will take place and no time is wasted.

Pixel formats refer to how information associated with each pixel is stored in memory. VisionPro supports color acquisition for the following three pixel formats.

  • RGB Planer format. This is the standard color format for VisionPro color vision tools. This format is an image with three 8-bit planes: Red, Green and Blue. If this option is used with a grey-scale camera, each of the three planes (R, G, and B) are identical and each contains the grey-scale image.
  • Grey 8 format. When you use this format the image from the camera is converted to an 8-bit grey-scale image. Grey-scale images are required for most Cognex vision tools.
  • Raw format. This format is only available for color cameras that output the Bayer color format, and the acquired image is retained in the Bayer format. If you choose to work with the Bayer format you will have to convert it to RGB Planer or Grey 8 format if you want to use it with Cognex vision tools. Use the CogImageConvert tool to make this conversion.

Cognex vision tools can only accept images with RGB or Grey8 pixel formats. If the acquired image is not one of these formats, you should use the OutputPixelFormat property to have the Acqfifo convert it for you.

If you are developing a QuickBuild vision application, see the topic Using QuickBuild for information on acquiring images with a color camera. The following is an example of how you would code a color acquisition using the RGB Planer format.

Acquiring Color Images

To acquire color images, you must use a frame grabber and a camera that supports color acquisition, such as the Cognex MVS-8504 and the Sony DCX-390 camera, an MVS-8600 supported color camera, or a supported IEEE 1394 DCAM-compliant color camera. Color acquisition is similar to grey-scale acquisition except that you must specify a color camera video format.

Note: See the camera support table for a list of supported cameras.

Private fgs As CogFrameGrabbers
 Private acqFifo As ICogAcqFifo
 Private display As CogDisplay
 Private Const videoFormat As String = "Sony DXC-390 640x480 IntDrv (3 Plane Color) CCF"

 Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   fgs = New CogFrameGrabbers
   ' Note: For historical reasons, always specify Format8Grey when constructing any fifo.
   acqFifo = fgs(0).CreateAcqFifo(videoFormat, CogAcqFifoPixelFormatConstants.Format8Grey, 0, True)
 End Sub

 Private Sub cmdAcquireImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AcquireButton.Click
   Dim acquiredImage As ICogImage
   Dim trigNum As Integer
   acquiredImage = acqFifo.Acquire(trigNum)
   display.Image = acquiredImage
 End Sub

See Camera Acquisition for information on how to acquire color images using QuickBuild.