IDS peak IPL v1.17.0
Loading...
Searching...
No Matches
peak_ipl_image_transformer.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
17
22
23namespace peak
24{
25namespace ipl
26{
27
28class Image;
29
38{
39public:
51
59
67
80
93
102 ImageTransformer(ImageTransformer&& other) noexcept;
103
113
130 PEAK_IPL_NO_DISCARD Image MirrorUpDown(const Image& inputImage) const;
131
148 PEAK_IPL_NO_DISCARD Image MirrorLeftRight(const Image& inputImage) const;
149
166 PEAK_IPL_NO_DISCARD Image MirrorUpDownLeftRight(const Image& inputImage) const;
167
182 void MirrorUpDownInPlace(Image& image) const;
183
198 void MirrorLeftRightInPlace(Image& image) const;
199
215 void MirrorUpDownLeftRightInPlace(Image& image) const;
216
234 PEAK_IPL_NO_DISCARD Image Rotate(const Image& inputImage, RotationAngle rotationAngle) const;
235
251 void RotateInPlace(Image& image, RotationAngle rotationAngle) const;
252
253private:
254 PEAK_IPL_IMAGE_TRANSFORMER_HANDLE m_backendHandle{};
255};
256
257} /* namespace ipl */
258} /* namespace peak */
259
261
262
263namespace peak
264{
265namespace ipl
266{
267
272
273
275{
276 if (m_backendHandle)
277 {
279 }
280}
281
283{
284 if (other.m_backendHandle)
285 {
287 }
288
289 m_backendHandle = other.m_backendHandle;
290}
291
293{
294 if (this != &other)
295 {
296 if (m_backendHandle)
297 {
299 }
300
301 if (other.m_backendHandle)
302 {
304 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_ImageTransformer_Acquire(other.m_backendHandle); });
305 }
306 }
307
308 m_backendHandle = other.m_backendHandle;
309
310 return *this;
311}
312
314{
315 *this = std::move(other);
316}
317
319{
320 if (this != &other)
321 {
322 if (m_backendHandle != nullptr)
323 {
325 }
326
327 m_backendHandle = other.m_backendHandle;
328 other.m_backendHandle = nullptr;
329 }
330
331 return *this;
332}
333
334inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
335{
336 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
339 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
340 });
341
342 return ImageBackendAccessor::CreateImage(outputImageHandle);
343}
344
345inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
346{
347 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
350 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
351 });
352
353 return ImageBackendAccessor::CreateImage(outputImageHandle);
354}
355
357{
358 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
361 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
362 });
363
364 return ImageBackendAccessor::CreateImage(outputImageHandle);
365}
366
368{
371 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
372 });
373}
374
376{
379 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
380 });
381}
382
384{
387 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
388 });
389}
390
391inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
392{
393 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
396 ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
397 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
398 });
399
400 return ImageBackendAccessor::CreateImage(outputImageHandle);
401}
402
403
404inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
405{
408 ImageBackendAccessor::BackendHandle(image),
409 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
410 });
411}
412
413
414} /* namespace ipl */
415} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:46
Performs transformations like mirror and rotate on images.
Definition peak_ipl_image_transformer.hpp:38
void RotateInPlace(Image &image, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:404
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:375
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition peak_ipl_image_transformer.hpp:356
ImageTransformer & operator=(const ImageTransformer &other)
Copy assigment for ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:292
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:367
Image MirrorLeftRight(const Image &inputImage) const
Mirrors the input image in the left-right direction.
Definition peak_ipl_image_transformer.hpp:345
~ImageTransformer()
Destructor for the ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:274
ImageTransformer()
Constructor for a new ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:268
RotationAngle
Angle parameter for the Rotation algorithm.
Definition peak_ipl_image_transformer.hpp:46
@ Degree90Counterclockwise
Definition peak_ipl_image_transformer.hpp:47
@ Degree180
Definition peak_ipl_image_transformer.hpp:49
@ Degree90Clockwise
Definition peak_ipl_image_transformer.hpp:48
Image Rotate(const Image &inputImage, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:391
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:383
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition peak_ipl_image_transformer.hpp:334
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:271
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:25
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:218
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_90_COUNTERCLOCKWISE
Definition peak_ipl_backend.h:219
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_180
Definition peak_ipl_backend.h:221
@ PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_DEGREE_90_CLOCKWISE
Definition peak_ipl_backend.h:220
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:405
struct PEAK_IPL_IMAGE_transformer * PEAK_IPL_IMAGE_TRANSFORMER_HANDLE
Definition peak_ipl_backend.h:377
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:16