ofxVimba demo not displaying camera feed

Hi all

Hope you are well.

I have an Alvium camera to test and was hoping to use @moostrik ofxVimba addon with Vimba SDK in OpenFrameworks (v0.12.0) on Windows 10.

I’ve installed the Vimba SDK and tested the camera with the Viewer which works fine.

I’ve followed the readme installation instructions to install ofxVimba and run the project. But the camera doesn’t connect?

vimbaGrabber->isInitialized() is true

grabber.listDevices() shows my camera device, but
vimbaGrabber->isConnected() stays false.

I noticed there is an exception thrown in the startup

Is there anything you can suggest as to why the exception is thrown and why the camera doesn’t connect?

It’s been a long time since I used OF and everything is feeling quite unfamiliar…

Hmm it could be that the API changed a bit in the SDK since the addon was written.

I would maybe try running their sample code in your ofApp::setup and see if that has the same error.
Leave the addon included in your ofApp.h but comment out the usage of it and try their example from this page: CPP API Manual — Vimba Developer Guide 6.1 documentation

CameraPtrVector cameras;
VimbaSystem &system = VimbaSystem :: GetInstance ();

if ( VmbErrorSuccess == system.Startup () )
  if ( VmbErrorSuccess == system.GetCameras( cameras ) )
    for ( CameraPtrVector :: iterator iter = cameras.begin ();
          cameras.end() != iter;
          ++iter )
      if ( VmbErrorSuccess == (*iter)->Open( VmbAccessModeFull ) )
        std::cout << "Camera opened" << std::endl;

If you get a "Camera opened" that means it is getting further in the process than the addon is and maybe something needs to be fixed in the addon API usage.

Oh did you follow this step from the ofxVimba read me / setup guide?

After building your app with ofxVimba copy the dll files from the Vimba Folder in the Program Files VimbaCPP\Bin\Win64* to the bin folder of your app

Thanks Theo, I’m pretty sure I installed correctly, and the Vimba SKD version is 6.0 which matches the addon repo tested version. I tried with an older version of OF 0.11.2 to match the tested addon also and 32 and 64bit builds.

In the process I found the 64bit build works if I start the app/build without the camera connected and once started then connect the camera it is detected and image feed starts up.
Doesn’t work if camera is connected during startup, disconnected and reconnected.

I’m now trying to find in the code what’s causing this issue.

The code runs to line 27 of Discovery::start() in addons\ofxVimba\libs\OosVim\src\Discovery.cpp
with a notice of “Listening for camera to connect”.
If camera is then connected the camera is detected and image feed windows opens.

I’d like it to run without needing to start app with the camera disconnected.
Any ideas would be much appreciated.
I’ve tried a delay before calling grabber.setup(ofGetWindowWidth(), ofGetWindowHeight(), true); in ofApp::setup which didn’t help.

With a slight adjustment the sample code from Vimba SDK docs ran OK in setup as you suggested, so I will also look into further into that.

AVT::VmbAPI::CameraPtrVector cameras;
	AVT::VmbAPI::VimbaSystem& system = AVT::VmbAPI::VimbaSystem::GetInstance();

    if (VmbErrorSuccess == system.Startup())
        if (VmbErrorSuccess == system.GetCameras(cameras))
            for (AVT::VmbAPI::CameraPtrVector::iterator iter = cameras.begin();
                 cameras.end() != iter;
                if (VmbErrorSuccess == (*iter)->Open(VmbAccessModeFull))
                    std::cout << "Camera opened" << std::endl;

Hmm, my guess is that there might be something in the addon wrapper that is creating a race condition between the addon thinking things are ready and the Vimba SDK being ready.

You could mess around with putting some ofSleepMillis(500); calls in between different lines of ofApp.cpp and see if that has any affect?

You could try starting the system manually here:

 bool setup(int w = 0, int h = 0) override {
    //hacky fix?
    VimbaSystem &system = VimbaSystem :: GetInstance ();
    system.Startup ();
   return grabber->isInitialized();
   width = w;
   height = h;
   pixelFormat = grabber->getDesiredPixelFormat();

Also this line is weird - returns the function midway through:

I would definitely reach out to @moostrik here and on the Github too.