Example for using the MDCam object for multiple DCams and writing to shared memory , MDcam
- Author
- MIP
#include <iostream>
#include <fstream>
#include <signal.h>
#include <Utils/Param.hh>
#include <VideoSource/VideoShMFeeder.hh>
#include <VideoSource/VideoSource_MDcam.hh>
using namespace BIAS;
using namespace std;
bool NotDone = true;
void termhandler(int )
{
cout <<"caught Ctrl-C, exiting gfracefully"<<endl;
NotDone = false;
}
int main(int argc, char *argv[])
{
int numcams;
int res;
vector<string> ShmNames;
string *camfile;
string *ShmPrefix;
int *scanbus;
vector<VideoShMFeeder *> ShmFeeder;
"Configuration file (default: cameras.conf",
"cameras.conf");
"Prefix to address Shm, Camid is added",
"MDCamShm");
"Only scan the bus number N and write camerafile",-1);
if (res <0) exit(1);
if (*scanbus >=0) {
ofstream ofs(camfile->c_str());
if (!ofs) {
perror(camfile->c_str());
exit(1);
}
ofs.close();
exit(0);
}
cout << "Number of cams: " << numcams << endl;
if (numcams <0) exit(0);
for (int i=0; i<numcams; i++) {
ostringstream oss;
ShmNames.push_back(oss.str());
oss.str("");
cout <<"Using: "<<ShmNames[i]<<endl;
ShmFeeder.push_back(s);
}
signal(3,termhandler);
cout <<"Press Ctrl-\\ to exit"<<endl;
int framecount = 0;
while (NotDone) {
for (int i=0; i<numcams; i++) {
ShmFeeder[i]->ProcessImage(&(GrabImage[i]));
}
cout <<framecount++<<endl;
}
for (unsigned int i=0;i<ShmFeeder.size(); i++)
delete ShmFeeder[i];
return 0;
}