Getting Started with the FlyCapture SDK

I have recently been working on a knotty problem involving control and image acquisition using the Flea®2 camera, using FlyCapture® SDK by Point Grey Research, Inc.

They have an impressive set of code samples to try all manner of things related to image grabbing and setting the camera controls hue, focus, colour etc. After an initial frustrating period of figuring out how to incorporate their APIs into projects of my own, things are much much simpler than I originally thought. When using this SDK, you will probably need to upgrade to Visual Studio 2005 or higher, if you have not yet done so.

FOR 32-BIT WINDOWS PLATFORMS

1. Install the full FlyCapture software package.

For the example you see here I used Flycapture v2.2 in a relatively recent version of Visual Studio, probably VS 2008. At the time this was in a Windows XP (32-bit) platform, so you will probably need to download whichever product is appropriate for your needs:

2. Create your Visual Studio project

For example, a Win32 console application, just to keep things simple for now. You can always play around using more involved project types at a later time.

3. Set the Visual Studio project dependencies

Once you have created the VS C++ project intended to run the set of APIs provided by the FlyCapture SDK, it is case of setting your project dependencies, as follows:

FlyCap1

4. Set the libraries:

FlyCapture3

5. Import the FlyCapture property sheet(s), if necessary:

In View -> Property Manager, right-click the project folder and select “Add Existing Property Sheet”:

Navigate to where the vsprops folder has been installed (usually C:\Program Files\Point Grey Research\FlyCapture2\src\) and select FlyCapture2.vsprops:

FlyCapture4

These version of .vsprops files do not appear to be supported in Visual Studio 2010.

6. Sort out any compiler/linker issues

When attempting to try this for the first time you may encounter error messages similar to this:

1>flycap1.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall FlyCapture2::Camera::~Camera(void)" (__imp_??1Camera@FlyCapture2@@UAE@XZ) referenced in function _wmain
1>flycap1.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall FlyCapture2::Camera::Camera(void)" (__imp_??0Camera@FlyCapture2@@QAE@XZ) referenced in function _wmain
1>C:\Users\andy\Documents\Visual Studio 2010\Projects\flycap1\Debug\flycap1.exe : fatal error LNK1120: 2 unresolved externals

Make sure the compiler knows where to find the .lib files needed, as described in step 4. For example, when running a Win32 console application, then you will probably need the 32-bit version of the SDK to run correctly, not the 64-bit version. If this is the case, download the 32-bit version of the SDK, and set the Additional Library Directories using this installation, as described in step 4.

7. Try it.

You are now free to use the FlyCapture include to access the full set of FlyCapture APIs. Provided the previous steps have been executed correctly, the following simple code with FlyCapture2 dependency should now compile without whinges:

#include "FlyCapture2.h"

using namespace FlyCapture2;

int _tmain(int argc, _TCHAR* argv[])
{
    // Do Flycapture2 related stuff...
    Camera cam; 
    return 0;
}

FOR 64-BIT WINDOWS PLATFORMS

Pretty much the same as for the 32-bit setup, but you will probably need to consider the following steps:

1. Make sure you have downloaded and installed the 64-bit version of the SDK.

2. Configure your Visual Studio Configuration Manager to 64-bit. In Visual Studio select Project > Properties > Configuration Properties and change from Win32 to x64 accordingly.

3. Instead of installing the FlyCapture2.vsprops property sheet as used for the 32-bit setup, you will probably need the FlyCapture2 (x64).vsprops property page:

FlyCapture5