1 Star 0 Fork 0

calculateBallSpin/my

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
getCameraCalibrationData.cpp 4.75 KB
一键复制 编辑 原始数据 按行查看 历史
houkai 提交于 2021-10-11 15:18 . 将单线程移植到多线程工程
//
// 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;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/calculate-ball-spin/my.git
git@gitee.com:calculate-ball-spin/my.git
calculate-ball-spin
my
my
master

搜索帮助