IDS peak IPL v1.17.1
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
39{
40public:
52
60
68
81
94
103 ImageTransformer(ImageTransformer&& other) noexcept;
104
114
131 PEAK_IPL_NO_DISCARD Image MirrorUpDown(const Image& inputImage) const;
132
149 PEAK_IPL_NO_DISCARD Image MirrorLeftRight(const Image& inputImage) const;
150
167 PEAK_IPL_NO_DISCARD Image MirrorUpDownLeftRight(const Image& inputImage) const;
168
183 void MirrorUpDownInPlace(Image& image) const;
184
199 void MirrorLeftRightInPlace(Image& image) const;
200
216 void MirrorUpDownLeftRightInPlace(Image& image) const;
217
235 PEAK_IPL_NO_DISCARD Image Rotate(const Image& inputImage, RotationAngle rotationAngle) const;
236
252 void RotateInPlace(Image& image, RotationAngle rotationAngle) const;
253
254private:
255 PEAK_IPL_IMAGE_TRANSFORMER_HANDLE m_backendHandle{};
256};
257
258} /* namespace ipl */
259} /* namespace peak */
260
262
263
264namespace peak
265{
266namespace ipl
267{
268
273
274
276{
277 if (m_backendHandle)
278 {
280 }
281}
282
284{
285 if (other.m_backendHandle)
286 {
288 }
289
290 m_backendHandle = other.m_backendHandle;
291}
292
294{
295 if (this != &other)
296 {
297 if (m_backendHandle)
298 {
300 }
301
302 if (other.m_backendHandle)
303 {
305 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_ImageTransformer_Acquire(other.m_backendHandle); });
306 }
307 }
308
309 m_backendHandle = other.m_backendHandle;
310
311 return *this;
312}
313
315{
316 *this = std::move(other);
317}
318
320{
321 if (this != &other)
322 {
323 if (m_backendHandle != nullptr)
324 {
326 }
327
328 m_backendHandle = other.m_backendHandle;
329 other.m_backendHandle = nullptr;
330 }
331
332 return *this;
333}
334
335inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
336{
337 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
340 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
341 });
342
343 return ImageBackendAccessor::CreateImage(outputImageHandle);
344}
345
346inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
347{
348 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
351 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
352 });
353
354 return ImageBackendAccessor::CreateImage(outputImageHandle);
355}
356
358{
359 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
362 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
363 });
364
365 return ImageBackendAccessor::CreateImage(outputImageHandle);
366}
367
369{
372 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
373 });
374}
375
377{
380 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
381 });
382}
383
385{
388 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
389 });
390}
391
392inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
393{
394 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
397 ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
398 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
399 });
400
401 return ImageBackendAccessor::CreateImage(outputImageHandle);
402}
403
404
405inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
406{
409 ImageBackendAccessor::BackendHandle(image),
410 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
411 });
412}
413
414
415} /* namespace ipl */
416} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:47
Performs transformations like mirror and rotate on images.
Definition peak_ipl_image_transformer.hpp:39
void RotateInPlace(Image &image, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:405
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:376
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition peak_ipl_image_transformer.hpp:357
ImageTransformer & operator=(const ImageTransformer &other)
Copy assigment for ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:293
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:368
Image MirrorLeftRight(const Image &inputImage) const
Mirrors the input image in the left-right direction.
Definition peak_ipl_image_transformer.hpp:346
~ImageTransformer()
Destructor for the ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:275
ImageTransformer()
Constructor for a new ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:269
RotationAngle
Angle parameter for the Rotation algorithm.
Definition peak_ipl_image_transformer.hpp:47
@ Degree90Counterclockwise
Definition peak_ipl_image_transformer.hpp:48
@ Degree180
Definition peak_ipl_image_transformer.hpp:50
@ Degree90Clockwise
Definition peak_ipl_image_transformer.hpp:49
Image Rotate(const Image &inputImage, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:392
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:384
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition peak_ipl_image_transformer.hpp:335
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:289
#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