IDS peak IPL v1.18.0
Loading...
Searching...
No Matches
peak_ipl_image_transformer.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
12
17
18namespace peak
19{
20namespace ipl
21{
22
23class Image;
24
34{
35public:
47
55
63
76
89
98 ImageTransformer(ImageTransformer&& other) noexcept;
99
109
126 PEAK_IPL_NO_DISCARD Image MirrorUpDown(const Image& inputImage) const;
127
144 PEAK_IPL_NO_DISCARD Image MirrorLeftRight(const Image& inputImage) const;
145
162 PEAK_IPL_NO_DISCARD Image MirrorUpDownLeftRight(const Image& inputImage) const;
163
178 void MirrorUpDownInPlace(Image& image) const;
179
194 void MirrorLeftRightInPlace(Image& image) const;
195
211 void MirrorUpDownLeftRightInPlace(Image& image) const;
212
230 PEAK_IPL_NO_DISCARD Image Rotate(const Image& inputImage, RotationAngle rotationAngle) const;
231
247 void RotateInPlace(Image& image, RotationAngle rotationAngle) const;
248
249private:
250 PEAK_IPL_IMAGE_TRANSFORMER_HANDLE m_backendHandle{};
251};
252
253} /* namespace ipl */
254} /* namespace peak */
255
257
258
259namespace peak
260{
261namespace ipl
262{
263
268
269
271{
272 if (m_backendHandle)
273 {
275 }
276}
277
279{
280 if (other.m_backendHandle)
281 {
283 }
284
285 m_backendHandle = other.m_backendHandle;
286}
287
289{
290 if (this != &other)
291 {
292 if (m_backendHandle)
293 {
295 }
296
297 if (other.m_backendHandle)
298 {
300 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_ImageTransformer_Acquire(other.m_backendHandle); });
301 }
302 }
303
304 m_backendHandle = other.m_backendHandle;
305
306 return *this;
307}
308
310{
311 *this = std::move(other);
312}
313
315{
316 if (this != &other)
317 {
318 if (m_backendHandle != nullptr)
319 {
321 }
322
323 m_backendHandle = other.m_backendHandle;
324 other.m_backendHandle = nullptr;
325 }
326
327 return *this;
328}
329
330inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
331{
332 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
335 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
336 });
337
338 return ImageBackendAccessor::CreateImage(outputImageHandle);
339}
340
341inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
342{
343 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
346 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
347 });
348
349 return ImageBackendAccessor::CreateImage(outputImageHandle);
350}
351
353{
354 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
357 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
358 });
359
360 return ImageBackendAccessor::CreateImage(outputImageHandle);
361}
362
364{
367 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
368 });
369}
370
372{
375 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
376 });
377}
378
380{
383 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
384 });
385}
386
387inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
388{
389 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
392 ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
393 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
394 });
395
396 return ImageBackendAccessor::CreateImage(outputImageHandle);
397}
398
399
400inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
401{
404 ImageBackendAccessor::BackendHandle(image),
405 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
406 });
407}
408
409
410} /* namespace ipl */
411} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:42
Performs transformations like mirror and rotate on images.
Definition peak_ipl_image_transformer.hpp:34
void RotateInPlace(Image &image, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:400
void MirrorLeftRightInPlace(Image &image) const
Mirrors the given image in the left-right direction in place i.e. it will change the input image itse...
Definition peak_ipl_image_transformer.hpp:371
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition peak_ipl_image_transformer.hpp:352
ImageTransformer & operator=(const ImageTransformer &other)
Copy assigment for ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:288
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:363
Image MirrorLeftRight(const Image &inputImage) const
Mirrors the input image in the left-right direction.
Definition peak_ipl_image_transformer.hpp:341
~ImageTransformer()
Destructor for the ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:270
ImageTransformer()
Constructor for a new ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:264
RotationAngle
Angle parameter for the Rotation algorithm.
Definition peak_ipl_image_transformer.hpp:42
@ Degree90Counterclockwise
Definition peak_ipl_image_transformer.hpp:43
@ Degree180
Definition peak_ipl_image_transformer.hpp:45
@ Degree90Clockwise
Definition peak_ipl_image_transformer.hpp:44
Image Rotate(const Image &inputImage, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:387
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:379
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition peak_ipl_image_transformer.hpp:330
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:284
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:20
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...
PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t
Definition peak_ipl_backend.h:215
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_90_COUNTERCLOCKWISE
Definition peak_ipl_backend.h:216
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_180
Definition peak_ipl_backend.h:218
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_90_CLOCKWISE
Definition peak_ipl_backend.h:217
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_Destruct(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle)
Destroys the image transformer associated with the given handle.
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.
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition peak_ipl_backend.h:402
struct PEAK_IPL_IMAGE_transformer * PEAK_IPL_IMAGE_TRANSFORMER_HANDLE
Definition peak_ipl_backend.h:374
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...
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Construct(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE *imageTransformerHandle)
Creates an image transformer.
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.
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Acquire(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle)
Increase the reference count of an image transformer object.
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.
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_Rotate(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle, enum PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t rotationAngle)
Creates a new image containing the data of the current image rotated in the supplied direction and va...
PEAK_IPL_C_API PEAK_IPL_ImageTransformer_RotateInPlace(PEAK_IPL_IMAGE_TRANSFORMER_HANDLE imageTransformerHandle, PEAK_IPL_IMAGE_HANDLE imageHandle, enum PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t rotationAngle)
Rotates the image in the direction and value of the rotation angle in place i.e. it will change the i...
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:11