IDS peak ICV v1.3.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{
24
53class Region final
54 : public IDrawable
55 , private detail::IBackendAccessible<Region>
56 , private detail::IBackendExchangeable<Region>
57{
58public:
64 Region();
65
71 explicit Region(const std::vector<peak::common::Point>& points);
72
78 explicit Region(const peak::common::Rectangle& rect);
79
85 ~Region() override;
86
92 Region(const Region& other);
93
99 Region(Region&& other) noexcept;
100
106 Region& operator=(const Region& other);
107
113 Region& operator=(Region&& other) noexcept;
114
120 bool operator==(const Region& rhs) const;
121
127 bool operator!=(const Region& rhs) const;
128
134 PEAK_COMMON_NO_DISCARD std::vector<peak::common::Point> GetPoints() const;
135
147 PEAK_COMMON_NO_DISCARD std::vector<Region> GetConnectedComponents() const;
148
156 PEAK_COMMON_NO_DISCARD size_t GetArea() const;
157
167 PEAK_COMMON_NO_DISCARD peak::common::PointF GetCenterOfGravity() const;
168
178 PEAK_COMMON_NO_DISCARD Region Intersection(const Region& other) const;
179
189 PEAK_COMMON_NO_DISCARD Region Difference(const Region& other) const;
190
200 PEAK_COMMON_NO_DISCARD Region Union(const Region& other) const;
201
211 PEAK_COMMON_NO_DISCARD Region Dilation(const Region& structuringElement) const;
212
222 PEAK_COMMON_NO_DISCARD Region Erosion(const Region& structuringElement) const;
223
249 PEAK_COMMON_NO_DISCARD Region Scale(const peak::common::Size& inputSize, const peak::common::Size& outputSize,
250 const Interpolation& interpolation = Interpolation::NearestNeighbor) const;
251
252protected:
253 void Draw(Image& image, const detail::DrawingOptions& options) const override;
254
255private:
256 friend peak::common::detail::BackendAccessor<Region>;
257
258 explicit Region(peak_icv_region_handle regionHandle) noexcept;
259 PEAK_COMMON_NO_DISCARD detail::handle_of_t<Region> GetHandle() const override;
260 PEAK_COMMON_NO_DISCARD detail::handle_of_t<Region>* GetHandleAddress() override;
261
262 peak_icv_region_handle m_regionHandle{};
263};
264
265} /* namespace icv */
266} /* namespace peak */
267
A generic rectangle defined by a point and a size.
Represents a two-dimensional size with non-negative width and height.
Base class for all drawables.
For detailed information about the use of ids_peak_icv Image refer to the Image Guide.
Represents a region defined by 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. The area is the number of pixels in the 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
Enumeration of interpolation methods used in image transformations.
peak::common::detail::c_type_of_t< Type > * handle_of_t