13.04.2015 Views

Blackfly - CYLOD

Blackfly - CYLOD

Blackfly - CYLOD

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Point Grey <strong>Blackfly</strong> Technical Reference<br />

Appendix C: FlyCapture API Code Examples<br />

C.12 Example: Setting White Balance Using the FlyCapture API<br />

The following FlyCapture 2.0 code snippet adjusts the white balance red channel to 500 and the blue channel to 850<br />

using the C++ interface. The snippet assumes a Camera object cam.<br />

//Declare a Property struct.<br />

Property prop;<br />

//Define the property to adjust.<br />

prop.type = WHITE_BALANCE;<br />

//Ensure the property is on.<br />

prop.onOff = true;<br />

//Ensure auto-adjust mode is off.<br />

prop.autoManualMode = false;<br />

//Set the white balance red channel to 500.<br />

prop.valueA = 500;<br />

//Set the white balance blue channel to 850.<br />

prop.valueB = 850;<br />

//Set the property.<br />

error = cam.SetProperty( &prop );<br />

C.13 Example: Accessing Raw Bayer Data using FlyCapture<br />

Using the FlyCapture SDK, raw image data can be accessed programmatically via the getData method of the<br />

Image class. In Raw8 modes, the first byte represents the pixel at [row 0, column 0], the second byte at [row 0,<br />

column 1], and so on.<br />

Read the BAYER_TILE_MAPPING register 0x1040 to determine the current Bayer output format (RGGB, GRBG, and so<br />

on). Using a Bayer format of RGGB, for example, the getData method returns the following (assuming char*<br />

data = rawImage.GetData(); and an Image object rawImage):<br />

• data[0] = Row 0, Column 0 = red pixel (R)<br />

• data[1] = Row 0, Column 1 = green pixel (G)<br />

• data[640] = Row 1, Column 0 = green pixel (G)<br />

• data[641] = Row 1, Column 1 = blue pixel (B)<br />

Revised 12/13/2012<br />

Copyright ©2012 Point Grey Research Inc.<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!