Pixel Format

Supported by ...

Monochrome cameras support Mono8 and Mono16 formats.  

Color cameras support PIXEL_FORMAT_YUV422, PIXEL_FORMAT_BAYER8 and PIXEL_FORMAT_BAYER16 formats.  

The driver and API can also format the image into RGB24, RGB32 or RGB48 for any color camera.

Description

The Pixel Format feature selects the output type of the camera.  The full range of possible settings is listed in the table below. Color Coding is the equivalent IIDC feature and needs to be used in conjunction with the IIDC Color Filter ID when using color sensors.

The Pixel Format refers to the output formatted pixel. In cases where the camera's raw pixel size is larger than the output, the data is truncated and the least significant bits are lost.  In cases where the camera's raw pixel size is smaller than the output, the lease significant bits in the output data are padded with zeros.  To determine what the raw pixel size is, see the Max Pixel Size feature. For more information on how the pixel is represented, refer to the Image Data Formats topic in the API reference.

PixeLINK cameras that do not support flip or rotate functions on-board have the color coding raw/Bayer filter fixed in a format defined by the sensor.  In IIDC, setting the Color Filter ID to a different value will have no effect on the output.  In the API, color cameras will accept any of the Bayer formats listed in this table, but they will only implement the default sensor defined formats.  For simplicity, PIXEL_FORMAT_BAYER8_GRBG is also defined as PIXEL_FORMAT_BAYER8 and PIXEL_FORMAT_BAYER16_GRBG is also defined as PIXEL_FORMAT_BAYER16.  These simplified compiler definitions can be used to set the BAYER8 or BAYER16 format without having to know what the default configuration is.

 

Note

While the camera pixel format is not affected by a rotation or flip, the captured frame will have the rotation or flip applied in the driver.  The pixel format of the captured frame is recorded in the frame descriptor that is returned along with the image buffer.  This pixel format value will be different depending on the rotation and flip settings.  Applications that process the raw Bayer formats will have to take these orientations into account.

The driver and API can also format the image into RGB24, RGB32 or RGB48 using the PxLFormatImage function.

 

 

 

Supported Settings by Camera

 

IIDC Name

API Name

Mono

681C

742

 

762

62XC

686C

774

776

778

782

871C

872C

873C

952

954

956

958

Description

Mono8 (0)

PIXEL_FORMAT_MONO8

·

 

 

 

 

Grayscale, 8 bits per pixel

Mono16 (5)

PIXEL_FORMAT_MONO16

·

 

 

 

 

Grayscale, 16 bits per pixel, with the first byte is the most significant byte

4:2:2 YUV (2)

PIXEL_FORMAT_YUV422

 

·

·

·

·

Color, 16 bits per pixel, with a coding pattern of U0, Y0, V0, Y1, U2, Y2, V2, Y3

Raw8 (9)

Filter ID = 0

PIXEL_FORMAT_BAYER8_RGGB

 

 

 

 

·

8 bits per pixel. Data in Bayer pattern format with first pixel being red.

Raw8 (9)

Filter ID = 2

PIXEL_FORMAT_BAYER8_GRBG or PIXEL_FORMAT_BAYER8

 

 

 

·

 

8 bits per pixel. Data in Bayer pattern format with first pixel being green (on a red line).

Raw8 (9)

Filter ID = 1

PIXEL_FORMAT_BAYER8_GBRG

 

·

 

 

 

8 bits per pixel. Data in Bayer pattern format with first pixel being green (on a blue line).

Raw8 (9)

Filter ID = 3

PIXEL_FORMAT_BAYER8_BGGR

 

 

·

 

 

8 bits per pixel. Data in Bayer pattern format with first pixel being blue.

Raw16 (10)

Filter ID = 0

PIXEL_FORMAT_BAYER16_RGGB

 

 

 

 

·

16 bits per pixel. Data in Bayer pattern format with first pixel being red.

Raw16 (10)

Filter ID = 2

PIXEL_FORMAT_BAYER16_GRBG or PIXEL_FORMAT_BAYER16

 

 

 

·

 

 

16 bits per pixel. Data in Bayer pattern format with first pixel being green (on a red line).

Raw16 (10)

Filter ID = 1

PIXEL_FORMAT_BAYER16_GBRG

 

·

 

 

 

16 bits per pixel. Data in Bayer pattern format with first pixel being green (on a blue line).

Raw16 (10)

Filter ID = 3

PIXEL_FORMAT_BAYER16_BGGR

 

 

·

 

 

16 bits per pixel. Data in Bayer pattern format with first pixel being blue.

RGB8 (4)

PIXEL_FORMAT_RGB24

 

 

 

 

 

Color, 24 bits per pixel

RGB16 (8)

PIXEL_FORMAT_RGB48

 

 

 

 

 

Color, 48 bits per pixel

n/a

PIXEL_FORMAT_RGB32

 

 

 

 

 

Color, 32 bits per pixel in the format (R,G,B,0)

 

API Control

PxLGetFeature, PxLSetFeature

Feature ID

Number of Parms

Parameters

Units

Restrictions

FEATURE_PIXEL_FORMAT 

Format of the pixel data

1

fValue

N/A

Integer only (see Pixel Format)

 

 

Note

The Pixel Format returned in the frame descriptor in PxlGetNextFrame will reflect that settings of FEATURE_ROTATE and FEATURE_FLIP and may be different than the setting of FEATURE_PIXEL_FORMAT reported by the camera.

 

Note

The stream state must be off (STREAM_OFF) to modify this feature.  See PxLSetStreamState.  For IIDC programmers, see Transmitting Video.

 

Feature Flags

Camera

Presence

Read Only

Auto

Manual

One-time Auto

Off

CiD

All cameras

Yes

No

No

Yes

No

No

Yes

Parameters

Camera

Parameter

Unit

Type

Min

Max

Default

Step Size

Comments

Monochrome

Color coding format

None

Absolute

0

5

0

N/A

Not all modes between the min and max value are supported

Color

Color coding format

None

Absolute

2

10

9

N/A

Not all modes between the min and max value are supported

IIDC Control

COLOR_CODING_ID and COLOR_CODING_INQ.  Also see COLOR_FILTER_ID in the IIDC specification.

 

Note

The Color Coding Inquiry Register uses bit 31 to indicate if the color coding can change between descriptors.

 

Offset

Name

Field

Bit

Description

014h

Color Coding Inquiry Register

Mono8

[0]

Y only, Y=8bits, non compressed

ID=0

4:1:1 YUV8

[1]

4:1:1, Y=U=V=8bits, non compressed

ID=1

4:2:2 YUV8

[2]

4:2:2, Y=U=V=8bits, non compressed

ID=2

4:4:4 YUV8

[3]

4:4:4, Y=U=V=8bits, non compressed

ID=3

RGB8

[4]

R=G=B=8bits, non compressed

ID=4

Mono16

[5]

Y only, Y=16bits, non compressed

ID=5

RGB16

[6]

R=G=B=16bits, non compressed

ID=6

Signed Mono16

[7]

Y only, Y=16bits, non compressed (signed integer)

ID=7

Signed RGB16

[8]

R=G=B=16bits, non compressed (signed integer)

ID=8

Raw8

[9]

Raw data output of color filter sensor, 8bits/pixel (Bayer pattern)

ID=9

Raw16

[10]

Raw data output of color filter sensor, 16bits/pixel (Bayer pattern)

ID=10

  

[9..30]

  

In_Desc_Inq

[31]

Can the Color Coding ID have different values in different descriptors

1 = Yes, 0 = No

Color Coding Inquiry CSR for Format_7 (Section 4.9 in the IIDC Spec.)