CVB++ 15.0
detail_calibrator_3d.hpp
1#pragma once
2
3#include "../_decl/decl_calibrator_3d.hpp"
4
5#include "../_decl/decl_at_calibrator_3d.hpp"
6#include "../_decl/decl_factors_calibrator_3d.hpp"
7#include "../_decl/decl_laser_plane_homography_calibrator_3d.hpp"
8#include "../_decl/decl_laser_plane_zigzag_calibrator_3d.hpp"
9#include "../_decl/decl_matrix_calibrator_3d.hpp"
10#include "../_decl/decl_pinhole_camera_calibrator_3d.hpp"
11
12namespace Cvb
13{
14
15 CVB_BEGIN_INLINE_NS
16
17 inline Calibrator3DPtr Calibrator3D::FromHandle(HandleGuard<Calibrator3D> &&guard)
18 {
19 if (!guard.Handle())
20 throw std::runtime_error("handle must not be null");
21
22 switch (TypeId(guard.Handle()))
23 {
24 case CalibratorType::LaserPlaneAT:
25 return std::make_shared<AtCalibrator3D>(std::move(guard), ProtectedTag{});
26 case CalibratorType::Factors:
27 return std::make_shared<FactorsCalibrator3D>(std::move(guard), ProtectedTag{});
28 case CalibratorType::MatrixH:
29 return std::make_shared<MatrixCalibrator3D>(std::move(guard), ProtectedTag{});
30 case CalibratorType::Pinhole:
31 return std::make_shared<PinholeCameraCalibrator3D>(std::move(guard), ProtectedTag{});
32 case CalibratorType::LaserPlaneMatrixH:
33 case CalibratorType::LaserPlanePolynom:
35 case CalibratorType::LaserPlaneZigZag:
36 return std::make_shared<LaserPlaneZigZagCalibrator3D>(std::move(guard), ProtectedTag{});
37 default:
38 return std::make_shared<Calibrator3D>(std::move(guard), ProtectedTag{});
39 }
40 }
41
42 template <class T>
44 {
45 return std::dynamic_pointer_cast<T>(Internal::DoResCallShareOut<Calibrator3D>(
46 [&](void *&handle) { return CVB_CALL_CAPI(CVC3DLoadCalibratorTyped(fileName.c_str(), handle)); }));
47 }
48
49 CVB_END_INLINE_NS
50
51} // namespace Cvb
static Calibrator3DPtr FromHandle(HandleGuard< Calibrator3D > &&guard)
Creates a calibrator from a classic API handle.
Definition detail_calibrator_3d.hpp:17
static std::shared_ptr< T > Load(const String &fileName)
Loads a 3D calibration from file.
Definition detail_calibrator_3d.hpp:43
T make_shared(T... args)
T move(T... args)
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
std::shared_ptr< Calibrator3D > Calibrator3DPtr
Convenience shared pointer for Calibrator3D.
Definition core_3d.hpp:52
T dynamic_pointer_cast(T... args)