Community Question

Has any one had success with setting up a camera stream and saving a snapshot to a file using c++?

This is what I have so far:

Code:


EZ_B::EZB ^ezb;
ezb = gcnew EZ_B::EZB("MyEZB");

EZ_B::Camera ^ezbCam;
ezbCam = gcnew EZ_B::Camera(ezb);

ezbCam->StartCamera(EZ_B::Camera::GetVideoCaptureDevices()[1], 320, 240);
ezbCam->SaveImageAsJPEG("c:\test.jpg");



I can confirm that the camera is on by running:

Code:


BOOL camOK = ezbCam->Camera::IsActive;
cout << "Camera on? " << camOK << "\n";



What am I missing here?

Best,
Lars

February 8 2016
Lars,

Regarding the last post "System.ArgumentException: Path cannot be the empty string or all whitespace."

is correct, i'm familiar with that message...

guessing... the ezb code obtains the path from the file you specified, and then calls the CreateDirectory with an empty path generating the error/exception you got.
February 8 2016
Lars,

To help brainstorm the problem:

1) Describe the Camera device in use.

2) To isolate if the issue: sdk related, form vs console application or cmake/compiler options:

2.1 ) isolate EZ code in a console application, compile, run, debug with Visual Studio,

2.2) if 2.1 still does not work, create a Form application with the same code.
DJ Sures
Synthiam
February 8 2016
yeah - the filename must contain a path because it will create the folder if it doesn't exist, as ptp mentioned.

Try the mono.dll - i think you will have better luck because it has less overhead
February 9 2016
Ptp and Sures, thank you for all your advice and efforts, I appreciate it.
I have for the time being given up using the camera in the current context.

Unfortunately, C# and mono is incompatible with other components in the project. I am working with a group of roboticists on adapting a gaze spotter to be used with a JD-bot. The spotter is originally developed for the iCub robot, but has been adapted to other platforms as well. We should have a working system within a few days, I'll throw up a video once it does :)
March 3 2016
Okay, I'm being reminded that I need to assign credit. The issue was never really resolved, but ptp offered many suggestions so I think credit is due. Of course Sures helped as well!
Question
Avatarby larschrjensen
Published Thursday, February 4, 2016