IDS peak IPL  v1.4.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;
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 {
221 }
222 
224 {
225  *this = std::move(other);
226 }
227 
229 {
230  if (this != &other)
231  {
233  m_backendHandle = other.m_backendHandle;
234  other.m_backendHandle = nullptr;
235  }
236 
237  return *this;
238 }
239 
240 inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
241 {
242  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
245  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
246  });
247 
248  return ImageBackendAccessor::CreateImage(outputImageHandle);
249 }
250 
251 inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
252 {
253  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
256  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
257  });
258 
259  return ImageBackendAccessor::CreateImage(outputImageHandle);
260 }
261 
262 inline Image ImageTransformer::MirrorUpDownLeftRight(const Image& inputImage) const
263 {
264  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
267  m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
268  });
269 
270  return ImageBackendAccessor::CreateImage(outputImageHandle);
271 }
272 
274 {
277  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
278  });
279 }
280 
282 {
285  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
286  });
287 }
288 
290 {
293  m_backendHandle, ImageBackendAccessor::BackendHandle(image));
294  });
295 }
296 
297 inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
298 {
299  PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
302  ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
303  static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
304  });
305 
306  return ImageBackendAccessor::CreateImage(outputImageHandle);
307 }
308 
309 
310 inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
311 {
314  ImageBackendAccessor::BackendHandle(image),
315  static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
316  });
317 }
318 
319 
320 } /* namespace ipl */
321 } /* 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:310
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition: peak_ipl_image_transformer.hpp:240
The "peak::ipl" namespace contains the whole image processing library.
Definition: peak_ipl_binning.hpp:16
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:128
Stores the pixel format, width and height of an image and the pointer to the image buffer...
Definition: peak_ipl_image.hpp:37
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:281
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition: peak_ipl_backend.h:238
struct PEAK_IPL_IMAGE_transformer * PEAK_IPL_IMAGE_TRANSFORMER_HANDLE
Definition: peak_ipl_backend.h:214
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition: peak_ipl_image_transformer.hpp:262
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:251
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:297
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:289
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:273
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.