37#include "CameraProperties.h"
38#include "ErrorStatus.h"
39#include "CommonTypes.h"
44 std::cout <<
"............................." << std::endl;
45 std::cout <<
"Camera Model Name: " << cameraInfo.
model << std::endl;
46 std::cout <<
"Camera Serial Number: " << cameraInfo.
serialNumber << std::endl;
47 std::cout <<
"Camera IP Address: " << cameraInfo.
ipAddress << std::endl;
48 std::cout <<
"Camera Subnet Mask: " << cameraInfo.
subnetMask << std::endl;
49 std::cout <<
"Camera IP Assignment Method: "
51 std::cout <<
"Hardware Version: "
53 std::cout <<
"Firmware Version: "
55 std::cout <<
"............................." << std::endl;
56 std::cout << std::endl;
61 std::cout <<
".....Camera Temperature....." << std::endl;
62 std::cout <<
"CPU : " << cameraStatus.temperature.
cpuTemperature <<
"°C"
66 std::cout <<
"............................" << std::endl;
68 std::cout << std::endl;
74 std::cout <<
"Texture Map size : (width : " << cameraResolutions.texture.width
75 <<
", height : " << cameraResolutions.texture.height <<
")." << std::endl;
76 std::cout <<
"Depth Map size : (width : " << cameraResolutions.depth.width
77 <<
", height : " << cameraResolutions.depth.height <<
")." << std::endl;
80inline void printCameraMatrix(
const std::string& title,
83 std::cout << title <<
": " << std::endl
84 <<
" [" << cameraMatrix.
fx <<
", " << 0 <<
", " << cameraMatrix.
cx <<
"]"
87 <<
" [" << 0 <<
", " << cameraMatrix.
fy <<
", " << cameraMatrix.
cy <<
"]"
90 <<
" [" << 0 <<
", " << 0 <<
", " << 1 <<
"]" << std::endl;
91 std::cout << std::endl;
94inline void printCameraDistCoeffs(
const std::string& title,
97 std::cout << title <<
": " << std::endl
98 <<
" k1: " << distCoeffs.
k1 <<
", k2: " << distCoeffs.
k2
99 <<
", p1: " << distCoeffs.
p1 <<
", p2: " << distCoeffs.
p2 <<
", k3: " << distCoeffs.
k3
101 std::cout << std::endl;
106 std::cout <<
"Rotation: " << title <<
": " << std::endl;
107 for (
int i = 0; i < 3; i++) {
109 for (
int j = 0; j < 3; j++) {
110 std::cout << transform.
rotation[i][j];
114 std::cout <<
"]" << std::endl;
116 std::cout << std::endl;
117 std::cout <<
"Translation " << title <<
": " << std::endl;
119 <<
"mm, Z: " << transform.
translation[2] <<
"mm" << std::endl;
120 std::cout << std::endl;
125 printCameraMatrix(
"Texture Camera Matrix", intrinsics.
texture.cameraMatrix);
126 printCameraDistCoeffs(
"Texture Camera Distortion Coefficients",
127 intrinsics.
texture.cameraDistortion);
129 printCameraMatrix(
"Depth Camera Matrix", intrinsics.
depth.cameraMatrix);
130 printCameraDistCoeffs(
"Depth Camera Distortion Coefficients",
131 intrinsics.
depth.cameraDistortion);
133 printTransform(
"from Depth Camera to Texture Camera", intrinsics.
depthToTexture);
138 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
141 if (deviceInfoList.empty()) {
142 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
146 for (
int i = 0; i < deviceInfoList.size(); i++) {
147 std::cout <<
"Mech-Eye device index : " << i << std::endl;
148 printCameraInfo(deviceInfoList[i]);
151 std::cout <<
"Please enter the device index you want to connect: ";
152 unsigned inputIndex = 0;
157 if (std::all_of(str.begin(), str.end(), ::isdigit) &&
158 atoi(str.c_str()) < deviceInfoList.size()) {
159 inputIndex = atoi(str.c_str());
162 std::cout <<
"Input invalid. Please enter the device index you want to connect: ";
166 status = device.
connect(deviceInfoList[inputIndex]);
168 if (!status.
isOK()) {
173 std::cout <<
"Connect Mech-Eye Industrial 3D Camera Successfully." << std::endl;
177inline std::vector<mmind::eye::Camera> findAndConnectMultiCamera()
179 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
182 if (cameraInfoList.empty()) {
183 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
187 for (
int i = 0; i < cameraInfoList.size(); i++) {
188 std::cout <<
"Mech-Eye device index : " << i << std::endl;
189 printCameraInfo(cameraInfoList[i]);
193 std::set<unsigned> indices;
196 std::cout <<
"Please enter the device index you want to connect: " << std::endl;
197 std::cout <<
"Enter the character 'c' to terminate adding devices" << std::endl;
202 if (std::all_of(str.begin(), str.end(), ::isdigit) &&
203 atoi(str.c_str()) < cameraInfoList.size())
204 indices.insert(atoi(str.c_str()));
206 std::cout <<
"Input invalid. Please enter the device index you want to connect: ";
209 std::vector<mmind::eye::Camera> cameraList(indices.size());
211 auto iter = indices.cbegin();
212 for (
int i = 0; i < indices.size(); ++i, ++iter) {
213 showError(cameraList[i].connect(cameraInfoList[*iter]));
219inline bool confirmCapture3D()
221 std::cout <<
"Do you want the camera to capture 3D image ? Please input y/n to confirm: "
224 std::string confirmStr;
225 std::cin >> confirmStr;
226 if (confirmStr ==
"y") {
228 }
else if (confirmStr ==
"n") {
229 std::cout <<
"program ends!" << std::endl;
232 std::cout <<
"Please input y/n again!" << std::endl;
Operates the Mech-Eye Industrial 3D Cameras. Use Camera::connect to connect an available camera,...
static std::vector< CameraInfo > discoverCameras()
Discovers all available cameras, and returns the camera information list for them....
ErrorStatus connect(const CameraInfo &info, unsigned int timeoutMs=5000)
Connects to a camera via CameraInfo.
std::string toString() const
Converts a Version object to a string of Version.
Describes the distortion parameters.
double k1
Radial distortion coefficients.
double k3
Radial distortion coefficients.
double p2
Tangential distortion coefficients.
double k2
Radial distortion coefficients.
double p1
Tangential distortion coefficients.
Defines the camera information.
IpAssignmentMethod ipAssignmentMethod
The IP assignment method of the device.
std::string serialNumber
Device serial number.
Version hardwareVersion
The version of the hardware which is pre-determined from the factory.
std::string model
Device model name, such as Mech-Eye Nano.
Version firmwareVersion
The version of the firmware which can be upgraded.
std::string subnetMask
The IP subnet mask of the device.
std::string ipAddress
The IP address of the device.
Defines the 3D camera intrinsic, including the texture source camera, depth source camera and the tra...
Intrinsics2DCamera texture
The intrinsic parameters of the camera for capturing the texture image.
Intrinsics2DCamera depth
The intrinsic parameters of the camera for capturing the depth map.
Transformation depthToTexture
Describes the camera intrinsic matrix.
double cx
Principal point.
double cy
Principal point.
Defines the camera resolutions information, including texture image resolution and depth map resoluti...
Describes the camera running status.
float projectorTemperature
Projector module temperature in degrees Celsius.
float cpuTemperature
CPU temperature in the device motherboard in degrees Celsius.
Describes the types of errors.
bool isOK() const
Returns true if the operation succeeds.