© 2013 Thorlabs GmbH
4 Programming (SDK)
127
4.1 First Steps to uc480 Programming
This chapter shows the most important functions of the uc480 API for integrating your camera into your own
applications. You will find comprehensive lists of the API functions, sorted by task, in the How to proceed
chapter.
The uc480 SimpleLive and uc480 SimpleAcquire C++ programming samples included in the SDK illustrate the
steps described below.
For information on required include files (uc480 API and header) see Programming notes chapter.
The uc480 API provides different modes you can use to display the camera's images on the PC. To
quickly show a live image under Windows, it is easiest to use the Direct3D mode . Under Linux the
OpenGL mode can be used.
This mode has the advantage that no image memory has to be allocated, and that image capture is
handled by the driver. Call is_SetDisplayMode() to select the display mode. You can then
customize the Direct3D mode by using is_DirectRenderer() .
For advanced users:
You can also access the image data directly by selecting the Bitmap (DIB) mode. To use DIB mode,
you first have to allocate one or more memories by using is_AllocImageMem() , add them to a
memory sequence , if required, and then activate a memory with is_SetImageMem() before
each image capture. To show the image on-screen, call the is_RenderBitmap() function after
each completed image capture. From the events or messages you can see when an image is
available for display.
See also:
How to proceed: Display mode selection
Recording live images with the DCxCamera is very simple. Just call the is_CaptureVideo()
function and the camera captures the live images at the default frame rate. To capture single frames,
use the is_FreezeVideo() function. Every DCx camera of course also provides different trigger
modes for image capture. Use is_SetExternalTrigger() to activate the desired mode before
starting the image capture.
See also:
How to proceed: Image capture
Adjust the frame rate, brightness and colors
To change the frame rate, for example, you call is_SetFrameRate() . With is_SetColorMode
() you set the color mode. Image brightness is adjusted through the exposure time set with
is_Exposure() . You can also implement automatic control of image brightness and other
parameters by using is_SetAutoParameter() .
If you are using a color camera, you should activate color correction in order to achieve rich vibrant
colors for on-screen display (is_SetColorCorrection() ). To adapt a color camera to the
ambient light conditions, it is essential to carry out white balancing. This is also done using the
is_SetAutoParameter() function.
See also:
How to proceed: Setting camera parameters
Use the is_ImageFile() function to save the current image as a BMP or JPEG file. To save a
specific image, it is better to use the Snap function (single frame mode) than the Live function
(continuous mode).
See also:
How to proceed: Saving images and videos
When you want to exit your application, close the camera with is_ExitCamera() . The camera
and the allocated memory are automatically released. All previously set camera parameters will be lost,
129
451
21
21
322
198
157
132 337
297
141
133
177
223
327
134
329
319
216 147
303
317
303
144
264
149
213