|
@@ -68,6 +68,8 @@ void * gThreadComp[CAM_MAX];
|
|
|
|
|
|
std::string gstrmempic[CAM_MAX];
|
|
std::string gstrmempic[CAM_MAX];
|
|
|
|
|
|
|
|
+std::string gstrdevname;
|
|
|
|
+
|
|
void * gpapic[CAM_MAX];
|
|
void * gpapic[CAM_MAX];
|
|
|
|
|
|
int gcompress = 1;
|
|
int gcompress = 1;
|
|
@@ -105,9 +107,6 @@ void ThreadCompress(const int n)
|
|
gbUpdate[n] = false;
|
|
gbUpdate[n] = false;
|
|
gMutex[n].unlock();
|
|
gMutex[n].unlock();
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
iv::vision::rawpic pic;
|
|
iv::vision::rawpic pic;
|
|
|
|
|
|
// qint64 time = QDateTime::currentMSecsSinceEpoch();
|
|
// qint64 time = QDateTime::currentMSecsSinceEpoch();
|
|
@@ -188,21 +187,48 @@ int main(int argc, char *argv[])
|
|
{
|
|
{
|
|
QCoreApplication a(argc, argv);
|
|
QCoreApplication a(argc, argv);
|
|
|
|
|
|
|
|
+ QString strpath = QCoreApplication::applicationDirPath();
|
|
|
|
+// QString apppath = strpath;
|
|
|
|
+ if(argc < 2)
|
|
|
|
+ strpath = strpath + "/driver_camera_miivii.xml";
|
|
|
|
+ else
|
|
|
|
+ strpath = argv[1];
|
|
|
|
+ std::cout<<strpath.toStdString()<<std::endl;
|
|
|
|
+ iv::xmlparam::Xmlparam xp(strpath.toStdString());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ std::string strcamcount = xp.GetParam("CamNum","2"); //Camera Number
|
|
|
|
+ std::string strcompress = xp.GetParam("bcompress","1"); //if 1,compress to jpg, suggest compress.
|
|
|
|
+ std::string strcompquality = xp.GetParam("compquality","95"); //Compress quality
|
|
|
|
+ gcompquality = atoi(strcompquality.data());
|
|
|
|
+
|
|
|
|
+ gstrdevname = xp.GetParam("devname","/dev/video0"); //devicename /dev/video0 /dev/video1
|
|
|
|
+
|
|
|
|
+ gcompress = atoi(strcompress.data());
|
|
|
|
+
|
|
|
|
+ int ncamcount = atoi(strcamcount.data());
|
|
|
|
+
|
|
|
|
+ std::string strshowpic = xp.GetParam("ShowPic","0"); //if 1, show pic
|
|
|
|
+
|
|
|
|
+ int nshowpic = atoi(strshowpic.data());
|
|
|
|
+
|
|
unsigned int i;
|
|
unsigned int i;
|
|
- for(i=0;i<CAM_MAX;i++)
|
|
|
|
|
|
+ for(i=0;i<ncamcount;i++)
|
|
{
|
|
{
|
|
gbUpdate[i] = false;
|
|
gbUpdate[i] = false;
|
|
- gstrmempic[i] = "image0"+ QString::number(i).toStdString();
|
|
|
|
|
|
+ QString strmsgparam = "msgname";
|
|
|
|
+ strmsgparam = strmsgparam + QString::number(i);
|
|
|
|
+ gstrmempic[i] = xp.GetParam(strmsgparam.toStdString(),"image0"+ QString::number(i).toStdString()); //Message Name
|
|
gpapic[i] = iv::modulecomm::RegisterSend(gstrmempic[i].data(),10000000,1);
|
|
gpapic[i] = iv::modulecomm::RegisterSend(gstrmempic[i].data(),10000000,1);
|
|
gThreadComp[i] = new std::thread(ThreadCompress,i);
|
|
gThreadComp[i] = new std::thread(ThreadCompress,i);
|
|
}
|
|
}
|
|
|
|
|
|
sample_context_t ctx;
|
|
sample_context_t ctx;
|
|
ctx.cam_fmt = " ";
|
|
ctx.cam_fmt = " ";
|
|
- ctx.cam_devname = "/dev/video0";
|
|
|
|
|
|
+ ctx.cam_devname = gstrdevname;
|
|
ctx.cam_h = 720;
|
|
ctx.cam_h = 720;
|
|
ctx.cam_w = 1280;
|
|
ctx.cam_w = 1280;
|
|
- ctx.window_num = 2;
|
|
|
|
|
|
+ ctx.window_num = ncamcount;
|
|
ctx.fps = 25;
|
|
ctx.fps = 25;
|
|
|
|
|
|
// if (!parse_cmdline(&ctx, argc, argv)) {
|
|
// if (!parse_cmdline(&ctx, argc, argv)) {
|
|
@@ -221,14 +247,17 @@ int main(int argc, char *argv[])
|
|
std::cout << "Camera type in group B is " << mvcam.GetCameraType(group_b_key) << std::endl;
|
|
std::cout << "Camera type in group B is " << mvcam.GetCameraType(group_b_key) << std::endl;
|
|
|
|
|
|
std::string windowName("DisplayCamera ");
|
|
std::string windowName("DisplayCamera ");
|
|
- for (uint32_t i = 0; i < ctx.window_num; i++) {
|
|
|
|
- cv::namedWindow(windowName + std::to_string(i), cv::WindowFlags::WINDOW_AUTOSIZE);
|
|
|
|
- cv::moveWindow(windowName + std::to_string(i), 200 * i, 200 * i);
|
|
|
|
|
|
+ if(nshowpic == 1)
|
|
|
|
+ {
|
|
|
|
+ for (uint32_t i = 0; i < ctx.window_num; i++) {
|
|
|
|
+ cv::namedWindow(windowName + std::to_string(i), cv::WindowFlags::WINDOW_AUTOSIZE);
|
|
|
|
+ cv::moveWindow(windowName + std::to_string(i), 200 * i, 200 * i);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
cv::Mat outMat[ctx.window_num];
|
|
cv::Mat outMat[ctx.window_num];
|
|
- uint8_t *outbuf[ctx.window_num];
|
|
|
|
- cv::Mat imgbuf[ctx.window_num];
|
|
|
|
- cv::Mat omat;
|
|
|
|
|
|
+// uint8_t *outbuf[ctx.window_num];
|
|
|
|
+// cv::Mat imgbuf[ctx.window_num];
|
|
|
|
+// cv::Mat omat;
|
|
signal(SIGINT, &handler);
|
|
signal(SIGINT, &handler);
|
|
bool quit = false;
|
|
bool quit = false;
|
|
uint64_t timestamp{};
|
|
uint64_t timestamp{};
|
|
@@ -251,7 +280,10 @@ int main(int argc, char *argv[])
|
|
} else if (imgFmt == "ABGR32") {
|
|
} else if (imgFmt == "ABGR32") {
|
|
qint64 nPicTime = QDateTime::currentMSecsSinceEpoch();
|
|
qint64 nPicTime = QDateTime::currentMSecsSinceEpoch();
|
|
cv::cvtColor(outMat[i], outMat[i], cv::COLOR_RGBA2BGR);
|
|
cv::cvtColor(outMat[i], outMat[i], cv::COLOR_RGBA2BGR);
|
|
- cv::imshow(windowName + std::to_string(i), outMat[i]);
|
|
|
|
|
|
+ if(nshowpic == 1)
|
|
|
|
+ {
|
|
|
|
+ cv::imshow(windowName + std::to_string(i), outMat[i]);
|
|
|
|
+ }
|
|
|
|
|
|
std::cout<<" pic time is : "<<QDateTime::currentMSecsSinceEpoch()<<std::endl;
|
|
std::cout<<" pic time is : "<<QDateTime::currentMSecsSinceEpoch()<<std::endl;
|
|
|
|
|