44 std::cout <<
"Error Code : " << status.
errorCode
50 std::cout <<
"............................" << std::endl;
51 std::cout <<
"Camera Model Name: " << deviceInfo.
model << std::endl;
52 std::cout <<
"Camera ID: " << deviceInfo.
id << std::endl;
53 std::cout <<
"Camera IP Address: " << deviceInfo.
ipAddress << std::endl;
54 std::cout <<
"Hardware Version: "
56 std::cout <<
"Firmware Version: "
58 std::cout <<
"............................" << std::endl;
59 std::cout << std::endl;
64 std::cout <<
".....Device Temperature....." << std::endl;
65 std::cout <<
"CPU : " << deviceTemperature.
cpuTemperature <<
"°C" << std::endl;
68 std::cout <<
"............................" << std::endl;
70 std::cout << std::endl;
76 if (it <
'0' || it >
'9')
84 std::cout <<
"Color Map size : (width : " << deviceResolution.
colorMapWidth
85 <<
", height : " << deviceResolution.
colorMapHeight <<
")." << std::endl;
86 std::cout <<
"Depth Map size : (width : " << deviceResolution.
depthMapWidth
87 <<
", height : " << deviceResolution.
depthMapHeight <<
")." << std::endl;
92 std::cout << title <<
": " << std::endl
93 <<
" [" << cameraMatrix[0] <<
", " << 0 <<
", " << cameraMatrix[2] <<
"]"
96 <<
" [" << 0 <<
", " << cameraMatrix[1] <<
", " << cameraMatrix[3] <<
"]"
99 <<
" [" << 0 <<
", " << 0 <<
", " << 1 <<
"]" << std::endl;
100 std::cout << std::endl;
105 std::cout << title <<
": " << std::endl
106 <<
" k1: " << distCoeffs[0] <<
", k2: " << distCoeffs[1]
107 <<
", p1: " << distCoeffs[2] <<
", p2: " << distCoeffs[3] <<
", k3: " << distCoeffs[4]
109 std::cout << std::endl;
114 std::cout <<
"Rotation: " << title <<
": " << std::endl;
115 for (
int i = 0; i < 3; i++) {
117 for (
int j = 0; j < 3; j++) {
122 std::cout <<
"]" << std::endl;
124 std::cout << std::endl;
125 std::cout <<
"Translation " << title <<
": " << std::endl;
127 <<
"mm, Z: " << pose.
translation[2] <<
"mm" << std::endl;
128 std::cout << std::endl;
146 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
147 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
150 if (deviceInfoList.empty()) {
151 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
155 for (
int i = 0; i < deviceInfoList.size(); i++) {
156 std::cout <<
"Mech-Eye device index : " << i << std::endl;
160 std::cout <<
"Please enter the device index you want to connect: ";
161 unsigned inputIndex = 0;
166 if (
isNumber(str) && atoi(str.c_str()) < deviceInfoList.size()) {
167 inputIndex = atoi(str.c_str());
170 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
174 status = device.
connect(deviceInfoList[inputIndex]);
176 if (!status.
isOK()) {
181 std::cout <<
"Connect Mech-Eye Industrial 3D Camera Successfully." << std::endl;
187 std::cout <<
"Find Mech-Eye device..." << std::endl;
188 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
191 std::vector<mmind::api::MechEyeDeviceInfo> lnxInfos;
193 for (
const auto& info : deviceInfoList) {
194 if (info.model ==
"Mech-Eye LNX 8030")
195 lnxInfos.emplace_back(info);
198 if (lnxInfos.empty()) {
199 std::cout <<
"No Mech-Eye device found." << std::endl;
203 for (
int i = 0; i < lnxInfos.size(); i++) {
204 std::cout <<
"Mech-Eye LNX device index : " << i << std::endl;
208 std::cout <<
"Please enter the device index you want to connect: ";
209 unsigned inputIndex = 0;
214 if (
isNumber(str) && atoi(str.c_str()) < lnxInfos.size()) {
215 inputIndex = atoi(str.c_str());
218 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
222 status = device.
connect(lnxInfos[inputIndex]);
224 if (!status.
isOK()) {
229 std::cout <<
"Connect Mech-Eye Successfully." << std::endl;
235 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
236 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
239 if (deviceInfoList.empty()) {
240 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
241 return std::make_pair(
nullptr, 0);
244 for (
int i = 0; i < deviceInfoList.size(); i++) {
245 std::cout <<
"Mech-Eye device index : " << i << std::endl;
250 std::set<unsigned> indices;
253 std::cout <<
"Please enter the device index you want to connect: " << std::endl;
254 std::cout <<
"Enter a c to terminate adding devices" << std::endl;
259 if (
isNumber(str) && atoi(str.c_str()) < deviceInfoList.size())
260 indices.emplace(atoi(str.c_str()));
262 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
267 auto it = indices.begin();
268 for (
int i = 0; i < indices.size() && it != indices.end(); ++i, ++it) {
269 showError(devices[i].connect(deviceInfoList[*it]));
272 return std::make_pair(devices,
static_cast<int>(indices.size()));
void printDeviceInfo(const mmind::api::MechEyeDeviceInfo &deviceInfo)
Definition SampleUtil.h:48
void printDeviceResolution(const mmind::api::DeviceResolution &deviceResolution)
Definition SampleUtil.h:82
void printDeviceTemperature(const mmind::api::DeviceTemperature &deviceTemperature)
Definition SampleUtil.h:62
std::pair< mmind::api::MechEyeDevice *, int > findAndConnectMulti()
Definition SampleUtil.h:233
void printCameraDistCoeffs(const std::string &title, const double *distCoeffs)
Definition SampleUtil.h:103
void printCameraMatrix(const std::string &title, const double *cameraMatrix)
Definition SampleUtil.h:90
bool findAndConnect(mmind::api::MechEyeDevice &device)
Definition SampleUtil.h:144
void printTransform(const std::string &title, const mmind::api::Pose &pose)
Definition SampleUtil.h:112
void showError(const mmind::api::ErrorStatus &status)
Definition SampleUtil.h:40
void printCalibParams(const mmind::api::DeviceIntri &deviceIntri)
Definition SampleUtil.h:131
bool isNumber(const std::string &str)
Definition SampleUtil.h:73
Interface that is used to connect the Mech-Eye Industrial 3D Camera and access basic information of t...
Definition MechEyeApi.h:58
static std::vector< MechEyeDeviceInfo > enumerateMechEyeDeviceList()
Enumerates Mech-Eye Industrial 3D Camera by the type of MechEyeDeviceInfo identifying the device.
ErrorStatus connect(const MechEyeDeviceInfo &info, int timeout=10000)
Connects to the device by the MechEyeDeviceInfo identifying a device.
Interface that is used to connect the LNX Mech-Eye device and access basic information of the device.
Definition MechEyeLNXApi.h:60
ErrorStatus connect(const MechEyeDeviceInfo &info, const int timeout=10000)
Connect to the device by the MechEyeDeviceInfo identifying a device.
static std::vector< api::MechEyeDeviceInfo > enumerateMechEyeDeviceList()
Enumerate Mech-Eye devices by the MechEyeDeviceInfo identifying the device.
double cameraMatrix[4]
Camera matrix, which arrange in [fx, fy, cx, cy].
Definition MechEyeDataType.h:113
double distortion[5]
Definition MechEyeDataType.h:111
This struct defines device intrinsic parameters, including texture camera and depth camera.
Definition MechEyeDataType.h:131
CameraIntri depthCameraIntri
The intrinsic parameters of the camera for capturing color map.
Definition MechEyeDataType.h:135
Pose depthToTexture
The intrinsic parameters of the camera for capturing depth map.
Definition MechEyeDataType.h:137
CameraIntri textureCameraIntri
Definition MechEyeDataType.h:133
This struct defines camera map resolution.
Definition MechEyeDataType.h:146
unsigned depthMapHeight
The height of the depth map.
Definition MechEyeDataType.h:150
unsigned colorMapWidth
The width of the color map.
Definition MechEyeDataType.h:147
unsigned colorMapHeight
The height of the color map.
Definition MechEyeDataType.h:148
unsigned depthMapWidth
The width of the depth map.
Definition MechEyeDataType.h:149
This struct describes the device temperature information.
Definition MechEyeDataType.h:101
float projectorModuleTemperature
projector module temperature in degrees Celsius.
Definition MechEyeDataType.h:103
float cpuTemperature
CPU temperature in the device motherboard in degrees Celsius.
Definition MechEyeDataType.h:102
This enumeration defines the types of errors.
Definition MechEyeDataType.h:45
std::string errorDescription
Definition MechEyeDataType.h:80
ErrorCode errorCode
Definition MechEyeDataType.h:75
bool isOK() const
Definition MechEyeDataType.h:70
This struct defines device information.
Definition MechEyeDataType.h:87
std::string model
Device model name, such as Mech-Eye Nano.
Definition MechEyeDataType.h:88
std::string hardwareVersion
The version of the hardware which is pre-determined from the factory.
Definition MechEyeDataType.h:91
std::string firmwareVersion
The version of the firmware which can be upgraded.
Definition MechEyeDataType.h:92
std::string ipAddress
IP address of the device.
Definition MechEyeDataType.h:93
std::string id
Device ID.
Definition MechEyeDataType.h:89
This struct defines rigid body transformations, including rotation matrix and translation vector.
Definition MechEyeDataType.h:121
double translation[3]
3*1 translation vector in [x(mm), y(mm), z(mm)].
Definition MechEyeDataType.h:123
double rotation[3][3]
3*3 rotation matrix.
Definition MechEyeDataType.h:122