IDS peak IPL  v1.7.0
peak_ipl_image_transformer.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
17 
21 namespace peak
22 {
23 namespace ipl
24 {
25 
26 class Image;
27 
35 class ImageTransformer final
36 {
37 public:
43  enum class RotationAngle : uint16_t
44  {
46  Degree90Clockwise = 270,
47  Degree180 = 180
48  };
49 
52  ImageTransformer(const ImageTransformer& other) = delete;
53  ImageTransformer& operator=(const ImageTransformer& other) = delete;
54  ImageTransformer(ImageTransformer&& other) noexcept;
55  ImageTransformer& operator=(ImageTransformer&& other) noexcept;
56 
73  Image MirrorUpDown(const Image& inputImage) const;
74 
91  Image MirrorLeftRight(const Image& inputImage) const;
92 
109  Image MirrorUpDownLeftRight(const Image& inputImage) const;
110 
111 
126  void MirrorUpDownInPlace(Image& image) const;
127 
142  void MirrorLeftRightInPlace(Image& image) const;
143 
159  void MirrorUpDownLeftRightInPlace(Image& image) const;
160 
178  Image Rotate(const Image& inputImage, RotationAngle rotationAngle) const;
179 
195  void RotateInPlace(Image& image, RotationAngle rotationAngle) const;
196 
197 private:
198  PEAK_IPL_IMAGE_TRANSFORMER_HANDLE m_backendHandle{};
199 };
200 
201 } /* namespace ipl */
202 } /* namespace peak */
203 
205 
206 
207 namespace peak
208 {
209 namespace ipl
210 {
211 
213 {
215 }
216 
217 
219 {
220  if (m_backendHandle)
221  {
223  }
224 }
225 
227 {
228  *this = std::move(other);
229 }
230 
232 {
233  if (this != &other)
234  {
236  m_backendHandle = other.m_backendHandle;
237  other.m_backendHandle = nullptr;
238  }
239 
240  return *this;
241 }
242 
243 inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
244 {
245  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
248  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
249  });
250 
251  return ImageBackendAccessor::CreateImage(outputImageHandle);
252 }
253 
254 inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
255 {
256  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
259  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
260  });
261 
262  return ImageBackendAccessor::CreateImage(outputImageHandle);
263 }
264 
265 inline Image ImageTransformer::MirrorUpDownLeftRight(const Image& inputImage) const
266 {
267  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
270  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
271  });
272 
273  return ImageBackendAccessor::CreateImage(outputImageHandle);
274 }
275 
277 {
280  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
281  });
282 }
283 
285 {
288  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
289  });
290 }
291 
293 {
296  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
297  });
298 }
299 
300 inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
301 {
302  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
305  ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
306  static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
307  });
308 
309  return ImageBackendAccessor::CreateImage(outputImageHandle);
310 }
311 
312 
313 inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
314 {
317  ImageBackendAccessor::BackendHandle(image),
318  static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
319  });
320 }
321 
322 
323 } /* namespace ipl */
324 } /* namespace peak */
ImageTransformer()
Definition: peak_ipl_image_transformer.hpp:212
~ImageTransformer()
Definition: peak_ipl_image_transformer.hpp:218
#define PEAK_IPL_C_ABI_PREFIX
Definition: peak_ipl_dll_defines.h:16
void RotateInPlace(Image &image, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition: peak_ipl_image_transformer.hpp:313
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition: peak_ipl_image_transformer.hpp:243
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:22
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorLeftRight(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image containing the data of the current image mirrored in left-right direction...
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Destruct(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle)
Destroys the image transformer associated with the given handle.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition: peak_ipl_exception.hpp:182
Stores the pixel format, width and height of an image and the pointer to the image buffer...
Definition: peak_ipl_image.hpp:39
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorUpDownInPlace(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Mirrors the image in up-down direction in place i.e. it will change the input image itself...
void MirrorLeftRightInPlace(Image &image) const
Mirrors the given image in left-right direction in place i.e. it will change the input image itself...
Definition: peak_ipl_image_transformer.hpp:284
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition: peak_ipl_backend.h:326
struct PEAK_IPL_IMAGE_transformer * PEAK_IPL_IMAGE_TRANSFORMER_HANDLE
Definition: peak_ipl_backend.h:298
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition: peak_ipl_image_transformer.hpp:265
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Rotate(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle, PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t rotationAngle)
Creates a new image containing the data of the current image rotated in direction and value of the ro...
Image MirrorLeftRight(const Image &inputImage) const
Mirrors the input image in left-right direction.
Definition: peak_ipl_image_transformer.hpp:254
Performs transformations like mirror and rotate on images.
Definition: peak_ipl_image_transformer.hpp:35
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_RotateInPlace(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t rotationAngle)
Rotates the image in in direction and value of the rotation angle in place i.e. it will change the in...
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorLeftRightInPlace(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Mirrors the image left-right direction in place i.e. it will change the input image itself...
RotationAngle
Angle parameter for the Rotation algorithm.
Definition: peak_ipl_image_transformer.hpp:43
Image Rotate(const Image &inputImage, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition: peak_ipl_image_transformer.hpp:300
ImageTransformer & operator=(const ImageTransformer &other)=delete
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorUpDownLeftRight(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image containing the data of the current image mirrored in up-down and left-right direc...
void MirrorUpDownLeftRightInPlace(Image &image) const
Mirrors the given image in up-down and left-right direction in place i.e. it will change the input im...
Definition: peak_ipl_image_transformer.hpp:292
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorUpDownLeftRightInPlace(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Mirrors the image in up-down and left-right direction in place i.e. it will change the input image it...
void MirrorUpDownInPlace(Image &image) const
Mirrors the given image in up-down direction in place i.e. it will change the input image itself...
Definition: peak_ipl_image_transformer.hpp:276
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_MirrorUpDown(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image containing the data of the current image mirrored in up-down direction.
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Construct(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE *imageTransformerHandle)
Creates an image transformer.