Basler camera SDK with OF on Ubuntu

I am trying to use a Basler ( camera with some openCV stuff on openframeworks. I have previously used Point Grey cameras (with their “FlyCapture2” SDK) without too much trouble. Basler has something called Pylon SDK which works for Windows, Linux and Mac OS.

I can compile Pylon’s own examples without any issue, but when I #include <pylon/PylonIncludes.h> then I immediately get compiler issues. I have modified the config.make file for my project appropriately (I think), so the compiler definitely finds the header files, but I keep getting errors relating to something much deeper in the Pylon library, specifically:

In file included from /usr/include/X11/Xlib.h:44:0,
                 from /usr/include/GL/glx.h:30,
                 from /home/stephen/of_v0.9.8_linux64_release/libs/openFrameworks/utils/ofConstants.h:184,
                 from /home/stephen/of_v0.9.8_linux64_release/libs/openFrameworks/ofMain.h:5,
                 from /home/stephen/of_v0.9.8_linux64_release/apps/myApps/canPointerOsc/src/main.cpp:1:
/opt/pylon5/include/GenApi/Types.h:130:9: error: expected identifier before numeric constant
         None,            //!< name resides in custom namespace

It seems that “None” is getting defined (into a numeric constant?) somewhere else. Curiously, this never happens when compiling their own samples. Is there something about the openFrameworks compiling process (options passed to G++?) that might break this part of their own code:

  //! Defines from which standard namespace a node name comes from
    //! \ingroup GenApi_PublicUtilities
    typedef enum _EStandardNameSpace
        None,            //!< name resides in custom namespace
        GEV,             //!< name resides in GigE Vision namespace
        IIDC,            //!< name resides in 1394 IIDC namespace
        CL,              //!< name resides in camera link namespace
        USB,             //!< name resides in USB namespace
        _UndefinedStandardNameSpace  //!< Object is not yet initialized
    } EStandardNameSpace;

Any thoughts?

Hmm, I might have solved my own problem.

Looks like there were conflicting definitions via the preprocessor, possibly buried somewhere in openFrameworks itself or one of its included dependencies. Adding the following lines before including the Pylon Header file solved the issue:

#undef None
#undef Status

Goddam you, preprocessors!

@anselan did you ever get a baller cam working on OS X?
I’m super interested in using their cameras. I like OS X and find it said that I can’t use the new FLIR cameras (point grey).

if you have a moment please share your experience. which camera did you use, did you get a good frame rate, etc ?
thank you very much,

Hey, sorry I just noticed this message now.

Yes, I did get the Basler cameras working just fine in openFrameworks, but I did not use OS X. I was running on a Linux (Ubuntu 16.04) system.

I typically avoid using OS X for these and Point Frey (FLIR) cameras precisely because there is no support for that platform. And I refuse to do Windows!

Hi, Anselan
Would you mid sharing your project? I am about to try integrating a Basler Blaze Tof Camera, and maybe you code could be a good starting point / inspiration.
Do you have it on github?
Kind regards

I have successfully used a couple of different USB Basler cameras with macOS lately.

Here a sample app that displays and records the Basler camera.