CVB++ 15.0
decl_metric_segmentor_range_map.hpp
1#pragma once
2
3namespace Cvb
4{
5 CVB_BEGIN_INLINE_NS
6
7 namespace Foundation
8 {
9 namespace Metric
10 {
12 }
13 } // namespace Foundation
14
15 template <>
16 inline HandleGuard<Foundation::Metric::RangeMapSegmentor>::HandleGuard(void *handle) noexcept
17 : HandleGuard<Foundation::Metric::RangeMapSegmentor>(handle,
18 [](void *handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
19 {
20 }
21
22 namespace Foundation
23 {
24 namespace Metric
25 {
26 enum class CalibrationPiece;
27 enum class SegmentationMethod;
28
34 class RangeMapSegmentor
35 {
36 protected:
37 struct PrivateTag
38 {
39 };
40
41 explicit RangeMapSegmentor(HandleGuard<RangeMapSegmentor> &&guard) noexcept
42 : handle_(std::move(guard))
43 {
44 }
45
46 public:
47 using GuardType = HandleGuard<RangeMapSegmentor>;
48
49 RangeMapSegmentor(const RangeMapSegmentor &other) = delete;
50 RangeMapSegmentor &operator=(const RangeMapSegmentor &other) = delete;
51 RangeMapSegmentor(RangeMapSegmentor &&other) = delete;
52 RangeMapSegmentor &operator=(RangeMapSegmentor &&other) = delete;
53 virtual ~RangeMapSegmentor() = default;
54
56
59 double RangeMapIgnoreValue() const noexcept
60 {
61 return Internal::DoResCallValueOut<double>([&](double &rangeMapIgnoreValue) {
62 return CVB_CALL_CAPI(CVMAQS12SegmentorRangeMapGetIgnoreValue(Handle(), rangeMapIgnoreValue));
63 });
64 }
65
67
70 void SetRangeMapIgnoreValue(double rangeMapIgnoreValue) const noexcept
71 {
72 CVB_CALL_CAPI(CVMAQS12SegmentorRangeMapSetIgnoreValue(Handle(), rangeMapIgnoreValue));
73 }
74
77
83 int WindowSize() const noexcept
84 {
85 return static_cast<int>(Internal::DoResCallValueOut<CExports::cvbdim_t>([&](CExports::cvbdim_t &value) {
86 return CVB_CALL_CAPI(CVMAQS12SegmentorRangeMapGetWindowSize(Handle(), value));
87 }));
88 }
89
92
100 void SetWindowSize(int windowSize) const
101 {
102 CVB_CALL_CAPI_CHECKED(
103 CVMAQS12SegmentorRangeMapSetWindowSize(Handle(), static_cast<CExports::cvbdim_t>(windowSize)));
104 }
105
106 virtual std::unique_ptr<Image> FaceSegmentationFromPiece(const ImagePlane &imagePlane) = 0;
107 virtual std::unique_ptr<Image> FaceSegmentationFromPiece(const ImagePlane &imagePlane, Rect<int> aoi) = 0;
108
109 virtual std::vector<Point3D<double>> ExtractProjectedPointsFromPiece(const ImagePlane &imagePlane) = 0;
110 virtual std::vector<Point3D<double>> ExtractProjectedPointsFromPiece(const ImagePlane &imagePlane,
111 Rect<int> aoi) = 0;
112
114
121 static std::shared_ptr<RangeMapSegmentor> FromHandle(HandleGuard<RangeMapSegmentor> &&guard);
122
123 template <class T>
124 static std::shared_ptr<RangeMapSegmentor> FromHandle(HandleGuard<RangeMapSegmentor> &&guard)
125 {
126 return FromHandle(std::move(guard));
127 }
128
130
133 void *Handle() const noexcept
134 {
135 return handle_.Handle();
136 }
137
138 private:
139 HandleGuard<RangeMapSegmentor> handle_;
140 };
141
142 } // namespace Metric
143 } // namespace Foundation
144
145 CVB_END_INLINE_NS
146} // namespace Cvb
Base class for segmentor object to configure and compute segmentation on range maps.
Definition decl_metric_segmentor_range_map.hpp:35
void SetRangeMapIgnoreValue(double rangeMapIgnoreValue) const noexcept
Sets the range map ignore value of the segmentor.
Definition decl_metric_segmentor_range_map.hpp:70
static std::shared_ptr< RangeMapSegmentor > FromHandle(HandleGuard< RangeMapSegmentor > &&guard)
Creates a segmentor from a classic API handle.
Definition detail_metric_segmentor.hpp:14
double RangeMapIgnoreValue() const noexcept
Returns the range map ignore value of the segmentor.
Definition decl_metric_segmentor_range_map.hpp:59
int WindowSize() const noexcept
Gets window size for calculation of normals (used for the classification of the AQS12 faces).
Definition decl_metric_segmentor_range_map.hpp:83
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_metric_segmentor_range_map.hpp:133
void SetWindowSize(int windowSize) const
Sets window size for the calculation of normals (used for the classification of the AQS12 faces).
Definition decl_metric_segmentor_range_map.hpp:100
Image plane information container.
Definition decl_image_plane.hpp:29
Rectangle object.
Definition rect.hpp:24
cvbbool_t ReleaseObject(OBJ &Object)
T move(T... args)
Namespace for metric calibration.
Definition decl_metric_aqs12_calibration_piece.hpp:13
CalibrationPiece
Defines the calibration piece to use for face segmentation.
Definition metric.hpp:24
SegmentationMethod
Defines the segmentation method for labeling the faces of the calibration piece.
Definition metric.hpp:31
Namespace for the Foundation package.
Definition decl_metric_aqs12_calibration_piece.hpp:11
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17