Mech-Eye API 2.5.2
API reference documentation for Mech-Eye 3D Laser Profiler
Loading...
Searching...
No Matches
ProfilerCalibrationInterfaces.h
1/*******************************************************************************
2 * BSD 3-Clause License
3 *
4 * Copyright (c) 2016-2025, Mech-Mind Robotics Technologies Co., Ltd.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * Info: https://www.mech-mind.com/
33 *
34 ******************************************************************************/
35
36#pragma once
37#include <memory>
38#include <optional>
39#include <opencv2/core/mat.hpp>
40#include "api_global.h"
41#include "profiler/ProfileData.h"
42#include "profiler/calibration/MultiProfilerErrorStatus.h"
43#include "profiler/calibration/ProfilerCalibrationTypes.h"
44
45namespace mmind {
46namespace eye {
47class MultiProfilerCalibration;
48class MMIND_API_EXPORT ProfilerCalibrationInterfaces
49{
50public:
55 enum class CloudStitchOption {
56 RefineStitchParameters = 1,
57 OverlapRegionUniformSampling =
58 2,
59 };
60
66 RefineT = 1,
67 };
68
69public:
72
79 bool setCalibCameraModel(const std::string& cameraModel);
80
86 void setMajorDeviceInfo(const DeviceInfo& deviceInfo);
87
93 void setMinorDeviceInfos(const std::vector<DeviceInfo>& deviceInfos);
94
100 void setCalibTargetSize(const TargetSize& targetSize);
101
107 void setCalibTargetPoses(const std::vector<TargetPose>& targetPoses);
108
119 const std::vector<cv::Mat>& minorDepths,
120 std::vector<CalibResult>& calibResults);
121
132 bool saveCalibFiles(bool needSaveAll = true, const std::string& saveFolderName = "") const;
133
149 const ProfilerImage& majorImage, const std::vector<ProfilerImage>& minorImages,
150 const std::vector<CalibResult>& calibResults, MultiStitchResult& stitchResults,
151 const std::optional<MultiStitchParams>& stitchParams = std::nullopt);
152
168 const ProfilerImage& majorImage, const std::vector<ProfilerImage>& minorImages,
169 const std::vector<CalibResult>& calibResults, MultiStitchResultZParallel& stitchResults,
170 const std::optional<MultiStitchParams>& stitchParams = std::nullopt);
171
191 const ProfilerImage& majorImage, const std::vector<ProfilerImage>& minorImages,
192 int cloudStitchOption, int paramRefineOption, const std::vector<CalibResult>& calibResults,
193 bool correctRingError = true, int normalEstimationKnn = -1,
194 const std::optional<MultiStitchParams>& stitchParams = std::nullopt);
195
202 ProfileBatch::UntexturedPointCloud& pointCloud) const;
203
211 ProfileBatch::TexturedPointCloud& texturedPointCloud) const;
212
224 const std::vector<bool>& fusionFlag = {});
225
243 const ProfilerImage& majorStitchImage,
244 const std::vector<MinorStitchResultZParallel>& minorStitchResults,
245 const cv::Point2i& majorBias, FusionResult& fusionResult,
246 const std::vector<bool>& fusionFlag = {});
247
254 bool saveStitchFiles(const std::string& saveFolderName = "") const;
255
263 bool saveStitchFilesForZParallel(const std::string& saveFolderName = "") const;
264
275 MultiProfilerErrorStatus loadCalibProperties(const std::string& loadFolderName = "",
276 bool needLoadAll = false);
281 std::vector<CalibResult> getCurrentCalibResults() const;
282
290
297
303 std::string getCameraModel() const;
304
310 std::vector<DeviceInfo> getMinorDeviceInfos() const;
311
318 std::vector<TargetPose> getTargetPoses() const;
319
333 ProfilerCalibrationInterfaces(const std::string& cameraModel, const DeviceInfo& majorDeviceInfo,
334 const std::vector<DeviceInfo>& minorDeviceInfos,
335 const TargetSize& targetSize,
336 const std::vector<TargetPose>& targetPoses);
337
338private:
339 friend class InternalInterfaces;
340 std::unique_ptr<MultiProfilerCalibration> calibrationInstance;
341};
342
343} // namespace eye
344
345} // namespace mmind
Represents the data struct of the profile data.
Definition BatchArray.h:16
void setMinorDeviceInfos(const std::vector< DeviceInfo > &deviceInfos)
Initializes the configuration for the secondary laser profiler(s).
CloudStitchOption
Cloud stitching options. This enum defines the options available for stitching point clouds.
bool saveCalibFiles(bool needSaveAll=true, const std::string &saveFolderName="") const
Saves the calibration data to files in the specified path.
bool setCalibCameraModel(const std::string &cameraModel)
Sets the model of the laser profilers used in the calibration, in the form of a string such as "Mech-...
ProfilerCalibrationInterfaces(const std::string &cameraModel, const DeviceInfo &majorDeviceInfo, const std::vector< DeviceInfo > &minorDeviceInfos, const TargetSize &targetSize, const std::vector< TargetPose > &targetPoses)
Constructs a new ProfilerCalibrationInterfaces object with specified parameters. This constructor ini...
MultiProfilerErrorStatus stitchPointCloud(const ProfilerImage &majorImage, const std::vector< ProfilerImage > &minorImages, int cloudStitchOption, int paramRefineOption, const std::vector< CalibResult > &calibResults, bool correctRingError=true, int normalEstimationKnn=-1, const std::optional< MultiStitchParams > &stitchParams=std::nullopt)
Calculates the stitching results for point clouds.
bool saveStitchFiles(const std::string &saveFolderName="") const
Saves the stitching results to files in the specified path.
std::vector< TargetPose > getTargetPoses() const
Gets the calibration target poses. This function retrieves the spatial positions and orientations of ...
MultiProfilerErrorStatus stitchImages(const ProfilerImage &majorImage, const std::vector< ProfilerImage > &minorImages, const std::vector< CalibResult > &calibResults, MultiStitchResult &stitchResults, const std::optional< MultiStitchParams > &stitchParams=std::nullopt)
Calculates the stitching results when the laser profilers are arranged in the Angle mode (i....
void setCalibTargetSize(const TargetSize &targetSize)
Sets the dimensions of the frustums of the calibration target.
std::vector< CalibResult > getCurrentCalibResults() const
Gets the current calibration results, which can be used for stitching.
StitchParamRefineOption
Stitching parameter refinement options. This enum defines the options available for stitching paramet...
MultiProfilerErrorStatus imageFusionForZParallel(FusionResult &fusionResult, const std::vector< bool > &fusionFlag={})
Performs fusion based on the stitching results when the laser profilers are arranged in the Wide mode...
MultiProfilerErrorStatus getStitchedPointCloud(ProfileBatch::UntexturedPointCloud &pointCloud) const
Retrieves the stitched point cloud based on the stitching results.
DeviceInfo getMajorDeviceInfo() const
Gets the major device information. This function retrieves the information of the primary device used...
MultiProfilerErrorStatus stitchImagesForZParallel(const ProfilerImage &majorImage, const std::vector< ProfilerImage > &minorImages, const std::vector< CalibResult > &calibResults, MultiStitchResultZParallel &stitchResults, const std::optional< MultiStitchParams > &stitchParams=std::nullopt)
Calculates the stitching results when the laser profilers are arranged in the Wide mode (i....
TargetSize getTargetSize() const
Gets the target size. This function retrieves the size of the calibration target.
std::vector< DeviceInfo > getMinorDeviceInfos() const
Gets the minor devices' information. This function retrieves a list of information for all minor devi...
void setCalibTargetPoses(const std::vector< TargetPose > &targetPoses)
Defines the relative position of the frustums of the calibration target.
void setMajorDeviceInfo(const DeviceInfo &deviceInfo)
Initializes the configuration for the primary laser profiler.
std::string getCameraModel() const
Gets the camera model identifier. This function retrieves the model name of the profiler.
MultiProfilerErrorStatus imageFusionForZParallel(const ProfilerImage &majorStitchImage, const std::vector< MinorStitchResultZParallel > &minorStitchResults, const cv::Point2i &majorBias, FusionResult &fusionResult, const std::vector< bool > &fusionFlag={})
Performs fusion based on the stitching results when the laser profilers are arranged in the Wide mode...
MultiProfilerErrorStatus calculateCalibration(const cv::Mat &majorDepth, const std::vector< cv::Mat > &minorDepths, std::vector< CalibResult > &calibResults)
Calculates the calibration results based on the depth maps acquired by the primary and secondary lase...
MultiProfilerErrorStatus getStitchedPointCloud(ProfileBatch::TexturedPointCloud &texturedPointCloud) const
Retrieves the stitched point cloud based on the stitching results, including texture information.
MultiProfilerErrorStatus loadCalibProperties(const std::string &loadFolderName="", bool needLoadAll=false)
Loads the calibration data from the files in the specified path, typically used before stitching star...
bool saveStitchFilesForZParallel(const std::string &saveFolderName="") const
Saves the stitching results to files in the specified path when the laser profilers are arranged in t...
Defines the configuration for each laser profiler.
Stores the stitching results.
The stitching results when the laser profilers are arranged in the Wide mode (i.e....
Stores the intensity image and depth map acquired by the laser profiler.
Defines the dimensions of the frustums of the calibration target.