The example code is meant to show how the PixeLINK 4.0 API can be used to interact with a PixeLINK camera. The applications do not provide a lot of functionality, but the principles from each can be combined to create a more powerful application.


In most cases, there is minimal error handling, so as not to clutter the code. The point of the application is to show how to interact with the PixeLINK API, not tell you how to do your error handling.


Many are written in C, to show the "lowest" common denominator, and some are in C++ to make use of simple memory management (i.e. std::vector) or because they are using Microsoft Foundation Classes (MFC).


If you're unfamiliar with the PixeLINK API, we recommend you visit the following example apps in the following order:

1) initialize

2) getcamerafeature

3) getnextframe

4) preview


After that, feel free to look around the other example apps as your needs dictate. There are many apps, but they can be grouped into a few categories:


Initialization and Camera Information


initialize


A demonstration of a minimal interaction with a camera.


getcamerainfo


This demonstrates retrieval of internal camera information.


getmodelnumber


This demonstrates the recommended method to determine the camera model number.


getcamerafeature


This retrieves information about various camera features.


getcamerafeatures


An example app -- and a great debugging tool -- that retrieves and displays information about all camera features using both PxLGetCameraFeatures and PxLGetFeature in a human-readable form.


errorreport


A demonstration of how to get more information about the most recent error reported by the PixeLINK API.


Camera Configuration and Control


lookuptable


This application shows how to retrieve and manipulate the contents of the camera's lookup table.


gamma


A demonstration of the interplay between gamma and the lookup table that demonstrates how to query and control camera features.


framerate


Demonstrates how to enable and set the frame rate.


flip


Demonstrates how to control the flip feature, as well as some of its quirks.


autoexposure


A simple windows application that provides a preview of the image and allows control of autoexposure.


ffc


Demonstrates how to enable and disable flat-field correction.


Capturing Images and Video


getsnapshot


This retrieves an image from the camera, converts it to a jpeg, and stores it to a file.


getvideo


This captures images from the camera (using PxLGetClip) to a PixeLINK data stream (pds) file, and then converts the pds to an avi file (using PxLFormatClip).

See also the callback clip example app.


avicapture


This is a a small application which demonstrates how to use PxLGetClip and PxLFormatClip to create a 'security' camera application.


getnextframe


A demonstration of a wrapper around (and recommended practice for using) PxLGetNextFrame to make it a little more robust, accounting for intermittent ApiCameraTimeout errors.


dropframe


Shows functionality added in 7.0 which permits a call to PxLGetNextFrame to skip over (drop) a frame without having to actually copy the data from the API to a local buffer.


hbitmap


How to capture an image and use it to generate a Win32 GDI HBITMAP.


pdsreader


Parses through a PixeLINK Data Stream file (.pds) and converts the individual images to bitmap files (.bmp) or comma-separated values.


Previewing


preview


This simple Win32 application demonstrates the basics of the preview window.

See also the callback example app.


previewoverlay


A simple Win32 application which demonstrates how to modify preview data in an CALLBACK_PREVIEW callback function.


previewdraw


A basic Win32 application which provides a simple C++ graphics engine to modify preview data in an CALLBACK_PREVIEW callback function.

The graphics engine provides the ability to draw lines, circles, ellipses, and rectangles.


previewtohwnd


A simple Win32 application which previews the camera within the client area of a window.


MFCPreview


This MFC-based dialog application demonstrates the basics of previewing into a Picture control.


Callbacks


callback


Demonstrates the basics of how to use the 'callback' functionality with CALLBACK_FORMAT_IMAGE and CALLBACK_PREVIEW.


callbackclip


Demonstrates PxLGetClip, PxLFormatClip, and how to use it with the callback for CALLBACK_FORMAT_CLIP.


Descriptors


descriptors


Demonstrates the creation, use and destruction of descriptors.

Note that the camera must support descriptors.


descriptors2


Demonstrates how the creation and removal of descriptors affects feature values.

Note that the camera must support descriptors.


descriptors_and_knees


Demonstrates the creation, use and destruction of descriptors and how to set a feature (extended shutter (also known as 'knees')) for each.

Note that the camera must support descriptors.


Trigging and GPIO


triggering


A simple overview of the three different triggering types: free running, software, and hardware.


aborttrigger


Demonstration of a few ways to abort a thread blocked in PxLGetNextFrame waiting for a hardware trigger.


softwaretrigger


Demonstration of how to use software triggering as a "virtual" hardware trigger using a special way to call PxLGetNextFrame combined with the CALLBACK_FRAME callback.


triggerwithcontrolledlight


Demonstrates the proper way of configuring FEATURE_TRIGGER_WITH_CONTROLLED_LIGHT.


gpio


Demonstration of how to configure the camera's GPOs for 'normal' mode.


multicamerasynchronizedtrigger


Demonstrates how to have multiple cameras simultaneously capture images by synchronizing them all with hardware and software triggering.


IP / Gigabit Ethernet


initializeex


Demonstration of PxLGetNumberCamerasEx, used to query IP (GigE) cameras.


setipaddress


Demonstration of PxLSetCameraIPAddress, used to set a GigE camera's IP address.


gigeheartbeat


Demonstration of how to use PxLPrivateCmd to set the GigE heartbeat timeout value.


Image Processing


motiondetection


A simple app which captures an image to file when motion is detected in the image.


PIXELINK_SDK_ROOT


The SDK installation will set the environment variable PIXELINK_SDK_ROOT for you. Each of the demonstration applications is provided as a separate Microsoft Visual C++ (2008) solution. (*.sln), and each of the solutions makes use of this environment variable to locate the header files and a library provided by the PixeLINK SDK. This allows you to install the PixeLINK SDK anywhere on your computer without having to change any of the example application configurations.


For example, the 'initialize' example application has this configuration: 



The additional include directory is the 'include' directory under the SDK root directory.


In the following example, the PixeLINK SDK was installed to D:\Program Files\PixeLINK, so the environment variable was set to this directory by the SDK installation, as can be verified by going to Start\Settings\Control Panel\System\Advanced\Environment Variables:



Once you've installed the SDK, you should be able to compile, link and run all the C and C++ example applications.