IDS peak IPL v1.13.1
Loading...
Searching...
No Matches
peak_ipl_image_transformer.hpp
Go to the documentation of this file.
1
11#pragma once
12
17
21namespace peak
22{
23namespace ipl
24{
25
26class Image;
27
36{
37public:
43 enum class RotationAngle : uint16_t
44 {
47 Degree180 = 180
48 };
49
57
65
78
91
100 ImageTransformer(ImageTransformer&& other) noexcept;
101
111
128 PEAK_IPL_NO_DISCARD Image MirrorUpDown(const Image& inputImage) const;
129
146 PEAK_IPL_NO_DISCARD Image MirrorLeftRight(const Image& inputImage) const;
147
164 PEAK_IPL_NO_DISCARD Image MirrorUpDownLeftRight(const Image& inputImage) const;
165
180 void MirrorUpDownInPlace(Image& image) const;
181
196 void MirrorLeftRightInPlace(Image& image) const;
197
213 void MirrorUpDownLeftRightInPlace(Image& image) const;
214
232 PEAK_IPL_NO_DISCARD Image Rotate(const Image& inputImage, RotationAngle rotationAngle) const;
233
249 void RotateInPlace(Image& image, RotationAngle rotationAngle) const;
250
251private:
252 PEAK_IPL_IMAGE_TRANSFORMER_HANDLE m_backendHandle{};
253};
254
255} /* namespace ipl */
256} /* namespace peak */
257
259
260
261namespace peak
262{
263namespace ipl
264{
265
270
271
273{
274 if (m_backendHandle)
275 {
277 }
278}
279
281{
282 if (other.m_backendHandle)
283 {
285 }
286
287 m_backendHandle = other.m_backendHandle;
288}
289
291{
292 if (this != &other)
293 {
294 if (m_backendHandle)
295 {
297 }
298
299 if (other.m_backendHandle)
300 {
302 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_ImageTransformer_Acquire(other.m_backendHandle); });
303 }
304 }
305
306 m_backendHandle = other.m_backendHandle;
307
308 return *this;
309}
310
312{
313 *this = std::move(other);
314}
315
317{
318 if (this != &other)
319 {
320 if (m_backendHandle != nullptr)
321 {
323 }
324
325 m_backendHandle = other.m_backendHandle;
326 other.m_backendHandle = nullptr;
327 }
328
329 return *this;
330}
331
332inline Image ImageTransformer::MirrorUpDown(const Image& inputImage) const
333{
334 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
337 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
338 });
339
340 return ImageBackendAccessor::CreateImage(outputImageHandle);
341}
342
343inline Image ImageTransformer::MirrorLeftRight(const Image& inputImage) const
344{
345 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
348 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
349 });
350
351 return ImageBackendAccessor::CreateImage(outputImageHandle);
352}
353
355{
356 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
359 m_backendHandle, ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle);
360 });
361
362 return ImageBackendAccessor::CreateImage(outputImageHandle);
363}
364
366{
369 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
370 });
371}
372
374{
377 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
378 });
379}
380
382{
385 m_backendHandle, ImageBackendAccessor::BackendHandle(image));
386 });
387}
388
389inline Image ImageTransformer::Rotate(const Image& inputImage, RotationAngle rotationAngle) const
390{
391 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
394 ImageBackendAccessor::BackendHandle(inputImage), &outputImageHandle,
395 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
396 });
397
398 return ImageBackendAccessor::CreateImage(outputImageHandle);
399}
400
401
402inline void ImageTransformer::RotateInPlace(Image& image, RotationAngle rotationAngle) const
403{
406 ImageBackendAccessor::BackendHandle(image),
407 static_cast<PEAK_IPL_IMAGE_TRANSFORMER_ROTATION_ANGLE_t>(rotationAngle));
408 });
409}
410
411
412} /* namespace ipl */
413} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:40
Performs transformations like mirror and rotate on images.
Definition peak_ipl_image_transformer.hpp:36
void RotateInPlace(Image &image, RotationAngle rotationAngle) const
Rotate the input image with the given rotationAngle.
Definition peak_ipl_image_transformer.hpp:402
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:373
Image MirrorUpDownLeftRight(const Image &inputImage) const
Mirrors the input image in up-down and left-right direction.
Definition peak_ipl_image_transformer.hpp:354
ImageTransformer & operator=(const ImageTransformer &other)
Copy assigment for ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:290
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:365
Image MirrorLeftRight(const Image &inputImage) const
Mirrors the input image in the left-right direction.
Definition peak_ipl_image_transformer.hpp:343
~ImageTransformer()
Destructor for the ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:272
ImageTransformer()
Constructor for a new ImageTransformer instance.
Definition peak_ipl_image_transformer.hpp:266
RotationAngle
Angle parameter for the Rotation algorithm.
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:389
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:381
Image MirrorUpDown(const Image &inputImage) const
Mirrors the input image in up-down direction.
Definition peak_ipl_image_transformer.hpp:332
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:182
The "peak::ipl" namespace contains the whole image processing library.
Definition peak_ipl_binning.hpp:23
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:233
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:369
struct PEAK_IPL_IMAGE_transformer * PEAK_IPL_IMAGE_TRANSFORMER_HANDLE
Definition peak_ipl_backend.h:341
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...
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_backend.h:26
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