代码拉取完成,页面将自动刷新
//
// Created by houkai on 2021/7/13.
//
//-------------------------------------------------------------
/**
\author houkai
\file main.cpp
\brief 实现小球检测,小球商标识别,小球旋转计算,多相机数据融合
\version 1.0.0
\date 2021.07.13
*/
//-------------------------------------------------------------
#include "camera.h"
#include "common.h"
#include <thread>
int main()
{
//Initialize camera libary
projectLibInit();
GX_STATUS emStatus = GX_STATUS_SUCCESS;
uint32_t ui32DeviceNum = 0;
//Get device enumerated number
updateDeviceList(&ui32DeviceNum, 1000);
//If no device found, app exit
if (ui32DeviceNum <= 0)
{
printf("<No device found>\n");
GXCloseLib();
return emStatus;
}
// camera initialize instances
Camera camera1;
Camera camera2;
Camera camera3;
Camera camera4;
GX_DEV_HANDLE hDevice1;
GX_DEV_HANDLE hDevice2;
GX_DEV_HANDLE hDevice3;
GX_DEV_HANDLE hDevice4;
// open device by index, 从1开始计数
camera1.OpenDeviceByIndex(1, hDevice1); // camera name is: [MER-160-227U3C-JJ0200020028] left
camera2.OpenDeviceByIndex(3, hDevice2); // camera name is: [MER-160-227U3C-JJ0200020033] right
camera3.OpenDeviceByIndex(4, hDevice3); // camera name is: [MER-160-227U3C-JJ0200020019] left pan
camera4.OpenDeviceByIndex(2, hDevice4); // camera name is: [MER-160-227U3C-JJ0200020019] right pan
printf("***************Get Device Info*****************\n");
camera1.ShowDeviceInfo();
camera2.ShowDeviceInfo();
camera3.ShowDeviceInfo();
camera4.ShowDeviceInfo();
printf("***********************************************\n");
printf("***************set trigger mode****************\n");
camera1.setTriggerMode(HARDWARE_MODE);
camera2.setTriggerMode(HARDWARE_MODE);
camera3.setTriggerMode(HARDWARE_MODE);
#ifdef USE_FOUR_CAMERA
camera4.setTriggerMode(HARDWARE_MODE);
#endif
printf("***********************************************\n");
printf("***************set data get mode***************\n");
camera1.setDataAcquisitionMode(TRIGGER_SINGLE_FRAME);
camera2.setDataAcquisitionMode(TRIGGER_SINGLE_FRAME);
camera3.setDataAcquisitionMode(TRIGGER_SINGLE_FRAME);
#ifdef USE_FOUR_CAMERA
camera4.setDataAcquisitionMode(TRIGGER_SINGLE_FRAME);
#endif
printf("***********************************************\n");
printf("***************set exposure********************\n");
camera1.setExposure(1000.0);
camera2.setExposure(1000.0);
camera3.setExposure(1000.0);
camera4.setExposure(1000.0);
// camera1.setExposure(2000.0);
// camera2.setExposure(2000.0);
// camera3.setExposure(2000.0);
// camera4.setExposure(2000.0);
printf("***********************************************\n");
printf("***************set roi********************\n");
camera1.setROI(1440, 1080, 0, 0);
camera2.setROI(1440, 1080, 0, 0);
camera3.setROI(1440, 1080, 0, 0);
camera4.setROI(1440, 1080, 0, 0);
//
// camera1.setROI(704, 400, 520, 500); // 8000->124FPS 10000->100FPS left
// camera2.setROI(704, 400, 424, 500); // 8000->124FPS 10000->100FPS right-pan
// camera3.setROI(704, 400, 352, 450); // 8000->124FPS 10000->100FPS right
// camera4.setROI(704, 400, 408, 350); // 8000->124FPS 10000->100FPS left-pan
printf("***********************************************\n");
printf("***************set frame rate******************\n");
camera1.setFramerate(200.0);
camera2.setFramerate(200.0);
camera3.setFramerate(200.0);
#ifdef USE_FOUR_CAMERA
camera4.setFramerate(200.0);
#endif
printf("***********************************************\n");
printf("***************auto set gain*******************\n");
camera1.setGain(15.0, 24.0);
camera2.setGain(15.0, 24.0);
camera3.setGain(15.0, 24.0);
camera4.setGain(15.0, 24.0);
// camera1.setGain(15.0, 23.0);
// camera2.setGain(15.0, 23.0);
// camera3.setGain(15.0, 24.0);
// camera4.setGain(15.0, 23.0);
printf("***********************************************\n");
printf("************auto set balance white*************\n");
camera1.setBalanceWhite();
camera2.setBalanceWhite();
camera3.setBalanceWhite();
#ifdef USE_FOUR_CAMERA
camera4.setBalanceWhite();
#endif
printf("***********************************************\n");
printf("***************get data************************\n");
camera1.run(1);
camera2.run(2);
camera3.run(3);
camera4.run(4);
printf("***********************************************\n");
camera1.getCalibData();
while (true)
{
std::cout << "yes" << std::endl;
sleep(1000);
}
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。