Example for using the multiple DCams without MDcam.
#include <Base/Debug/TimeMeasure.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Image/ImageIO.hh>
#include <Image/Camera.hh>
#include <VideoSource/VideoSource_DCAM.hh>
#include <string>
#include <vector>
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
unsigned int num = argc > 1 ? max(1, atoi(argv[1])) : 2;
std::vector< VideoSource_DCAM > cam(num);
std::vector< Camera<unsigned char> > grabimg(num);
cout << "Initializing " << num << " cameras..." << endl;
for (unsigned int i = 0; i < num; i++) {
cam[i].SetDebugLevel(D_DCAM |D_DCAM_F7);
cam[i].SetFirewireB(false);
if (cam[i].OpenDevice(i) < 0) {
cerr << "Failed to open camera at bus " << i << "!" << endl;
exit(1);
}
cam[i].PreGrab();
cam[i].SetDebugLevel(0);
cam[i].InitImage(grabimg[i]);
}
for (unsigned int i = 0; i < num; i++)
cam[i].GrabSingle(grabimg[i]);
char filename[64];
for (unsigned int i = 0; i < num; i++) {
sprintf(filename, "camera-%d.mip", i);
cout << "Saved camera image " << i << " to " << filename << "." << endl;
}
cout << "Closing cameras..." << endl;
for (unsigned int i = 0; i < num; i++) {
cam[i].SetDebugLevel(D_DCAM);
cam[i].PostGrab();
cam[i].CloseDevice();
}
return 0;
}