IDS peak ICV v1.0.0
Loading...
Searching...
No Matches
peak_icv_region.hpp
Go to the documentation of this file.
1
11#pragma once
12
18#include <vector>
19
20namespace peak
21{
22namespace icv
23{
24namespace experimental
25{
26
36class Region final
37 : public IDrawable
38 , private detail::IBackendAccessible<Region>
39 , private detail::IBackendExchangeable<Region>
40{
41public:
47 Region();
48
54 explicit Region(const std::vector<peak::common::Point>& points);
55
61 explicit Region(const peak::common::Rectangle& rect);
62
68 ~Region() override;
69
75 Region(const Region& other);
76
82 Region(Region&& other) noexcept;
83
89 Region& operator=(const Region& other);
90
96 Region& operator=(Region&& other) noexcept;
97
103 bool operator==(const Region& rhs) const;
104
110 bool operator!=(const Region& rhs) const;
111
117 PEAK_ICV_NO_DISCARD std::vector<peak::common::Point> GetPoints() const;
118
130 PEAK_ICV_NO_DISCARD std::vector<Region> GetConnectedComponents() const;
131
139 PEAK_ICV_NO_DISCARD size_t GetArea() const;
140
150 PEAK_ICV_NO_DISCARD peak::common::PointF GetCenterOfGravity() const;
151
161 PEAK_ICV_NO_DISCARD Region Intersection(const Region& other) const;
162
172 PEAK_ICV_NO_DISCARD Region Difference(const Region& other) const;
173
183 PEAK_ICV_NO_DISCARD Region Union(const Region& other) const;
184
194 PEAK_ICV_NO_DISCARD Region Dilation(const Region& structuringElement) const;
195
205 PEAK_ICV_NO_DISCARD Region Erosion(const Region& structuringElement) const;
206
232 PEAK_ICV_NO_DISCARD Region Scale(const peak::common::Size& inputSize, const peak::common::Size& outputSize,
233 const Interpolation& interpolation = Interpolation::NearestNeighbor) const;
234
235
236protected:
245 void Draw(Image& image, const detail::DrawingOptions& options) const override;
246
247
248private:
249 friend peak::common::detail::BackendAccessor<Region>;
250
251 explicit Region(peak_icv_region_handle regionHandle) noexcept;
252 PEAK_ICV_NO_DISCARD detail::handle_of_t<Region> GetHandle() const override;
253 PEAK_ICV_NO_DISCARD detail::handle_of_t<Region>* GetHandleAddress() override;
254
255 peak_icv_region_handle m_regionHandle{};
256};
257
258} /* namespace experimental */
259} /* namespace icv */
260} /* namespace peak */
261
A generic rectangle defined by a point and a size.
Represents a two-dimensional size with non-negative width and height.
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
Base class for all drawables.
A region consists of a set of points in the image plane.
Region Dilation(const Region &structuringElement) const
Performs morphological dilation on the input region using the specified structuring element.
peak::common::PointF GetCenterOfGravity() const
Calculates the center of gravity of a region.
std::vector< Region > GetConnectedComponents() const
Calculates the connected components of the region.
bool operator==(const Region &rhs) const
Region Difference(const Region &other) const
Calculates the difference of two regions.
Region Erosion(const Region &structuringElement) const
Performs morphological erosion on the input region using the specified structuring element.
size_t GetArea() const
Calculates the area of a region.
Region Scale(const peak::common::Size &inputSize, const peak::common::Size &outputSize, const Interpolation &interpolation=Interpolation::NearestNeighbor) const
Returns a scaled region.
Region()
Creates an empty Region.
Region Union(const Region &other) const
Calculates the union of two regions.
bool operator!=(const Region &rhs) const
Region Intersection(const Region &other) const
Calculates the intersection of two regions.
Region & operator=(const Region &other)
std::vector< peak::common::Point > GetPoints() const
Returns the points from a region.
Interpolation
Interpolation method for image transformations.
peak::common::detail::c_type_of_t< Type > * handle_of_t