IDS peak IPL v1.17.0
Loading...
Searching...
No Matches
peak_ipl_image.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
19#include <peak_common/types/peak_common_iimageview.hpp>
20#include <peak_common/types/peak_common_metadata.hpp>
21
22#include <cstddef>
23#include <cstdint>
24#include <utility>
25#include <type_traits>
26
27namespace
28{
29class ImageBackendAccessor;
30}
31
36
37namespace peak
38{
39namespace ipl
40{
41
45class Image
46{
47public:
55 Image();
56
69 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height);
70
89 Image(
90 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height);
91
105 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns);
106
127 Image(const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns);
128
141 explicit Image(peak::common::IImageView& imageView);
142
149 ~Image();
150
162 Image(const Image& other);
163
175 Image& operator=(const Image& other);
176
185 Image(Image&& other) noexcept;
186
195 Image& operator=(Image&& other) noexcept;
196
206 PEAK_IPL_NO_DISCARD size_t Width() const;
207
217 PEAK_IPL_NO_DISCARD size_t Height() const;
218
229
246 PEAK_IPL_NO_DISCARD uint8_t* PixelPointer(size_t xPos, size_t yPos) const;
247
265 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
266 PEAK_IPL_NO_DISCARD T* PixelPointer(size_t xPos, size_t yPos) const
267 {
268 return reinterpret_cast<T*>(PixelPointer(xPos, yPos));
269 }
270
280 PEAK_IPL_NO_DISCARD size_t ByteCount() const;
281
292
305 PEAK_IPL_NO_DISCARD uint8_t* Data() const;
306
321 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
323 {
324 return reinterpret_cast<T*>(Data());
325 }
326
344
365 Image ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
366 size_t outputImageBufferSize,
368
393 double factor, double offset = 0.0, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
394
421 uint8_t* outputImageBuffer, size_t outputImageBufferSize, double factor, double offset = 0.0,
423
443 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, const peak::ipl::Interval<double>& interval,
445
471 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
472 size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
473
487 template <typename Integer1, typename Integer2,
488 typename std::enable_if_t<std::is_integral<Integer1>::value, int> = 0,
489 typename std::enable_if_t<std::is_integral<Integer2>::value, int> = 0>
491 {
492 return Scale(peak::ipl::Size2D{static_cast<std::size_t>(width), static_cast<std::size_t>(height)}, algorithm);
493 }
494
508
524
540 template<typename FloatingPoint1, typename FloatingPoint2,
541 typename std::enable_if_t<std::is_floating_point<FloatingPoint1>::value, int> = 0,
542 typename std::enable_if_t<std::is_floating_point<FloatingPoint2>::value, int> = 0>
543 PEAK_IPL_NO_DISCARD inline Image Scale(FloatingPoint1 scaleFactorX, FloatingPoint2 scaleFactorY, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
544 {
545 return Scale(peak::ipl::ScaleFactor{static_cast<double>(scaleFactorX), static_cast<double>(scaleFactorY)}, algorithm);
546 }
547
560 void ScaleInto(const peak::ipl::Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const;
561
575
588
599
609 PEAK_IPL_NO_DISCARD bool Empty() const;
610
619 PEAK_IPL_NO_DISCARD uint64_t Timestamp() const;
620
625 PEAK_IPL_NO_DISCARD bool operator==(const Image& img) const;
626
631 PEAK_IPL_NO_DISCARD bool operator!=(const Image& img) const;
632
633private:
634 friend ImageBackendAccessor;
635
636 explicit Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference=false);
637
638 PEAK_IPL_IMAGE_HANDLE m_backendHandle{};
639};
640
641} /* namespace ipl */
642} /* namespace peak */
643
644namespace
645{
646
648class ImageBackendAccessor
649{
650public:
658 PEAK_IPL_NO_DISCARD static PEAK_IPL_IMAGE_HANDLE BackendHandle(const peak::ipl::Image& image)
659 {
660 return image.m_backendHandle;
661 }
662
672 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImage(PEAK_IPL_IMAGE_HANDLE imageHandle)
673 {
674 return peak::ipl::Image(imageHandle, false);
675 }
676
686 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImageReference(PEAK_IPL_IMAGE_HANDLE imageHandle)
687 {
688 return peak::ipl::Image(imageHandle, true);
689 }
690};
691
692} /* namespace */
693
694namespace peak
695{
696namespace ipl
697{
699{
702 });
703}
704
705inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height)
706{
709 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), width, height, &m_backendHandle);
710 });
711}
712
714 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height)
715{
718 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), buffer, bufferSize, width, height,
719 &m_backendHandle);
720 });
721}
722
723inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns) :
724 Image::Image(pixelFormat, width, height)
725{
727 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
728 });
729}
730
732 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns) :
733 Image::Image(pixelFormat, buffer, bufferSize, width, height)
734{
736 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
737 });
738}
739
740inline Image::Image(peak::common::IImageView& imageView)
741 : Image(static_cast<peak::ipl::PixelFormatName>(imageView.GetPixelFormat()), imageView.GetData(),
742 imageView.GetSizeInBytes(), imageView.GetWidth(), imageView.GetHeight())
743{
744 const auto metadata = imageView.GetMetadata();
745 if(metadata->HasEntryByKey<peak::common::MetadataKey::DeviceTimestamp>())
746 {
747 const auto timestamp_ns = metadata->GetValueByKey<peak::common::MetadataKey::DeviceTimestamp>();
748 ExecuteAndMapReturnCodes(
749 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns); });
750 }
751}
752
753inline Image::Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference)
754 : m_backendHandle(imageHandle)
755{
756 if (acquireReference && m_backendHandle)
757 {
759 }
760}
761
763{
764 if (m_backendHandle)
765 {
766 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
767 }
768}
769
770inline Image::Image(const Image& other)
771{
772 if (other.m_backendHandle)
773 {
774 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
775 }
776
777 m_backendHandle = other.m_backendHandle;
778}
779
780inline Image& Image::operator=(const Image& other)
781{
782 if (this != &other)
783 {
784 if (m_backendHandle)
785 {
786 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
787 }
788
789 if (other.m_backendHandle)
790 {
791 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
792 }
793 }
794
795 m_backendHandle = other.m_backendHandle;
796
797 return *this;
798}
799
800inline Image::Image(Image&& other) noexcept
801{
802 *this = std::move(other);
803}
804
805inline Image& Image::operator=(Image&& other) noexcept
806{
807 if (this != &other)
808 {
809 if (m_backendHandle != nullptr)
810 {
811 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
812 }
813 m_backendHandle = other.m_backendHandle;
814 other.m_backendHandle = nullptr;
815 }
816
817 return *this;
818}
819
820inline size_t Image::Width() const
821{
822 size_t width = 0;
823
824 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetWidth(m_backendHandle, &width); });
825
826 return width;
827}
828
829inline size_t Image::Height() const
830{
831 size_t height = 0;
832
833 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetHeight(m_backendHandle, &height); });
834
835 return height;
836}
837
839{
840 return {Width(), Height()};
841}
842
843inline uint8_t* Image::PixelPointer(size_t xPos, size_t yPos) const
844{
845 uint8_t* pixelPosition = nullptr;
846
848 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetPixelPointer(m_backendHandle, xPos, yPos, &pixelPosition);
849 });
850
851 return pixelPosition;
852}
853
854inline size_t Image::ByteCount() const
855{
856 size_t byteCount = 0;
857
859 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetByteCount(m_backendHandle, &byteCount); });
860
861 return byteCount;
862}
863
865{
867
870 m_backendHandle, reinterpret_cast<PEAK_IPL_PIXEL_FORMAT*>(&pixelFormatName));
871 });
872
873 return peak::ipl::PixelFormat{ pixelFormatName };
874}
875
876inline uint8_t* Image::Data() const
877{
878 uint8_t* data = nullptr;
879
880 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetData(m_backendHandle, &data); });
881
882 return data;
883}
884
886 const peak::ipl::PixelFormat& outputPixelFormat, peak::ipl::ConversionMode conversionMode) const
887{
888 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
890 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ConvertTo(m_backendHandle,
891 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()),
892 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
893 });
894
895 return ImageBackendAccessor::CreateImage(outputImageHandle);
896}
897
898inline Image Image::ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
899 size_t outputImageBufferSize, peak::ipl::ConversionMode conversionMode) const
900{
901 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
904 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), outputImageBuffer,
905 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
906 });
907
908 return ImageBackendAccessor::CreateImage(outputImageHandle);
909}
910
912 const peak::ipl::PixelFormat& outputPixelFormat, double factor, double offset, peak::ipl::ConversionMode conversionMode) const
913{
914 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
917 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset,
918 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
919 });
920
921 return ImageBackendAccessor::CreateImage(outputImageHandle);
922}
923
925 const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer, size_t outputImageBufferSize,
926 double factor, double offset, peak::ipl::ConversionMode conversionMode) const
927{
928 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
931 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset, outputImageBuffer, outputImageBufferSize,
932 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
933 });
934
935 return ImageBackendAccessor::CreateImage(outputImageHandle);
936}
937
939 const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode) const
940{
941 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
944 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(),
945 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
946 });
947
948 return ImageBackendAccessor::CreateImage(outputImageHandle);
949}
950
952 uint8_t* outputImageBuffer, size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval,
953 peak::ipl::ConversionMode conversionMode) const
954{
955 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
958 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(), outputImageBuffer,
959 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
960 });
961
962 return ImageBackendAccessor::CreateImage(outputImageHandle);
963}
964
965inline Image Image::Scale(const Size2D& size, peak::ipl::InterpolationAlgorithm algorithm) const
966{
967 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
968 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
969
971 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Scale(m_backendHandle, &size_in, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm), &outputImageHandle);
972 });
973
974 return ImageBackendAccessor::CreateImage(outputImageHandle);
975}
976
978{
979 return Scale(Size2D{static_cast<size_t>(static_cast<double>(Width()) * factor.x), static_cast<size_t>(static_cast<double>(Height()) * factor.y)}, algorithm);
980}
981
982inline void Image::ScaleInto(const Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm) const
983{
984 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
985
987 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ScaleInto(m_backendHandle, &size_in, buffer, bufferSize, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm));
988 });
989}
990
991
992inline Image Image::Crop(const Point2D& pos, const Size2D& size) const
993{
994 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
995 const PEAK_IPL_POINT_2D pos_in{pos.x, pos.y};
996 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
997
999 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Crop(m_backendHandle, &pos_in, &size_in, &outputImageHandle);
1000 });
1001
1002 return ImageBackendAccessor::CreateImage(outputImageHandle);
1003}
1004
1005inline Image Image::Crop(const Size2D& size) const
1006{
1007 return Crop({0,0}, size);
1008}
1009
1010inline Image Image::Clone() const
1011{
1012 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
1014 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Clone(m_backendHandle, &outputImageHandle); });
1015
1016 return ImageBackendAccessor::CreateImage(outputImageHandle);
1017}
1018
1019inline bool Image::Empty() const
1020{
1021 return (m_backendHandle == nullptr) || (PixelFormat().PixelFormatName() == PixelFormatName::Invalid);
1022}
1023
1024inline uint64_t Image::Timestamp() const
1025{
1026 uint64_t timestamp_ns;
1028 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetTimestamp(m_backendHandle, &timestamp_ns);
1029 });
1030
1031 return timestamp_ns;
1032}
1033
1034inline bool Image::operator==(const peak::ipl::Image& img) const
1035{
1036 if (img.ByteCount() != this->ByteCount())
1037 {
1038 return false;
1039 }
1040 if (img.Width() != this->Width())
1041 {
1042 return false;
1043 }
1044 if (img.Height() != this->Height())
1045 {
1046 return false;
1047 }
1048 if (img.PixelFormat().PixelFormatName() != this->PixelFormat().PixelFormatName())
1049 {
1050 return false;
1051 }
1052 if (img.Timestamp() != this->Timestamp())
1053 {
1054 return false;
1055 }
1056
1057 return memcmp(img.Data(), this->Data(), img.ByteCount()) == 0;
1058}
1059
1060inline bool Image::operator!=(const peak::ipl::Image& img) const
1061{
1062 return !(*this == img);
1063}
1064
1065} /* namespace ipl */
1066} /* 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
T * PixelPointer(size_t xPos, size_t yPos) const
Returns the pixel pointer to the given pixel position in relation to the size of the pixel format.
Definition peak_ipl_image.hpp:266
bool operator!=(const Image &img) const
Checks whether the image is data-wise different.
Definition peak_ipl_image.hpp:1060
Image & operator=(const Image &other)
Copy assigment for Image instance.
Definition peak_ipl_image.hpp:780
size_t Width() const
Returns the width.
Definition peak_ipl_image.hpp:820
bool Empty() const
Checks whether the image is empty.
Definition peak_ipl_image.hpp:1019
peak::ipl::Size2D Size() const
Returns the Size.
Definition peak_ipl_image.hpp:838
Image ConvertToWithFactor(const peak::ipl::PixelFormat &outputPixelFormat, double factor, double offset=0.0, peak::ipl::ConversionMode conversionMode=peak::ipl::ConversionMode::Fast) const
Converts the image to the specified outputPixelFormat and scales the pixel values by the factor.
Definition peak_ipl_image.hpp:911
peak::ipl::PixelFormat PixelFormat() const
Returns the pixel format.
Definition peak_ipl_image.hpp:864
uint8_t * PixelPointer(size_t xPos, size_t yPos) const
Returns the pixel pointer to the given pixel position in relation to the size of the pixel format.
Definition peak_ipl_image.hpp:843
size_t ByteCount() const
Returns the size of the given image in number of bytes.
Definition peak_ipl_image.hpp:854
bool operator==(const Image &img) const
Checks whether the image is data-wise the same.
Definition peak_ipl_image.hpp:1034
uint8_t * Data() const
Returns the pointer to the first pixel position in dependency on the size of the pixel format.
Definition peak_ipl_image.hpp:876
void ScaleInto(const peak::ipl::Size2D &size, uint8_t *buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
Scale the image to the supplied width and height using the supplied algorithm and save it into the su...
Definition peak_ipl_image.hpp:982
Image ConvertToFromInterval(const peak::ipl::PixelFormat &outputPixelFormat, const peak::ipl::Interval< double > &interval, peak::ipl::ConversionMode conversionMode=peak::ipl::ConversionMode::Fast) const
Converts the image to the specified outputPixelFormat. The pixel values are mapped from interval to t...
Definition peak_ipl_image.hpp:938
size_t Height() const
Returns the height.
Definition peak_ipl_image.hpp:829
Image Crop(const peak::ipl::Point2D &pos, const peak::ipl::Size2D &size) const
Crop the image to the size starting at pos.
Definition peak_ipl_image.hpp:992
Image Clone() const
Returns a new created image containing the data of the current image as deep copy.
Definition peak_ipl_image.hpp:1010
~Image()
Destructor for the Image instance.
Definition peak_ipl_image.hpp:762
Image()
Creates an empty image. In other words, size is 0x0 and an invalid pixel format.
Definition peak_ipl_image.hpp:698
Image ConvertTo(const peak::ipl::PixelFormat &outputPixelFormat, peak::ipl::ConversionMode conversionMode=peak::ipl::ConversionMode::Fast) const
Converts the image to the specified outputPixelFormat.
Definition peak_ipl_image.hpp:885
uint64_t Timestamp() const
The timestamp in nanoseconds.
Definition peak_ipl_image.hpp:1024
Image Scale(Integer1 width, Integer2 height, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
Scale the image to the supplied width and height using the supplied algorithm.
Definition peak_ipl_image.hpp:490
Image Scale(FloatingPoint1 scaleFactorX, FloatingPoint2 scaleFactorY, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
Scale the image to the supplied scale factors scaleFactorX and scaleFactorY using the supplied algori...
Definition peak_ipl_image.hpp:543
T * Data() const
Returns the pointer to the first pixel position in dependency on the size of the pixel format.
Definition peak_ipl_image.hpp:322
Interval support and convenience class.
Definition peak_ipl_interval.hpp:37
constexpr T End() const
Get the end value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:80
constexpr T Start() const
Get the start value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:68
Represents a pixel format and its specific properties.
Definition peak_ipl_pixel_format.hpp:34
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition peak_ipl_pixel_format.hpp:124
The "peak::ipl" namespace contains the whole image processing library.
InterpolationAlgorithm
Enum holding the possible interpolation algorithm.
Definition peak_ipl_simple_types.hpp:204
@ linear
bilinear interpolation
Definition peak_ipl_simple_types.hpp:206
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:41
@ Invalid
Invalid Pixel Format.
Definition peak_ipl_simple_types.hpp:42
ConversionMode
Enum holding the possible conversion modes.
Definition peak_ipl_simple_types.hpp:31
@ Fast
Fast conversion mode.
Definition peak_ipl_simple_types.hpp:32
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_Image_Destruct(PEAK_IPL_IMAGE_HANDLE imageHandle)
Destroys the image associated with the given handle.
PEAK_IPL_C_API PEAK_IPL_Image_ConstructFromBuffer(PEAK_IPL_PIXEL_FORMAT pixelFormat, uint8_t *buffer, uint64_t bufferSize, size_t width, size_t height, PEAK_IPL_IMAGE_HANDLE *imageHandle)
Creates an image from a given buffer.
PEAK_IPL_C_API PEAK_IPL_Image_Construct(PEAK_IPL_PIXEL_FORMAT pixelFormat, size_t width, size_t height, PEAK_IPL_IMAGE_HANDLE *imageHandle)
Creates an image.
PEAK_IPL_C_API PEAK_IPL_Image_ConvertToFromInterval(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, double start, double end, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Converts the given imageHandle to the specified outputPixelFormat. The pixel values are mapped from t...
PEAK_IPL_C_API PEAK_IPL_Image_ConvertToBufferWithFactorAndOffset(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, double factor, double offset, uint8_t *outputImageBuffer, size_t outputImageBufferSize, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Converts the given imageHandle to the specified outputPixelFormat into an existing outputImageBuffer ...
PEAK_IPL_C_API PEAK_IPL_Image_Acquire(PEAK_IPL_IMAGE_HANDLE imageHandle)
Increase the reference count of an image object.
PEAK_IPL_C_API PEAK_IPL_Image_GetWidth(PEAK_IPL_IMAGE_HANDLE imageHandle, size_t *width)
Queries the width of the given image.
int32_t PEAK_IPL_CONVERSION_MODE
Definition peak_ipl_backend.h:55
PEAK_IPL_C_API PEAK_IPL_Image_ConvertToBufferFromInterval(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, double start, double end, uint8_t *outputImageBuffer, size_t outputImageBufferSize, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Converts the given imageHandle to the specified outputPixelFormat into an existing outputImageBuffer....
PEAK_IPL_C_API PEAK_IPL_Image_GetTimestamp(PEAK_IPL_IMAGE_HANDLE imageHandle, uint64_t *timestamp_ns)
Get the timestamp for an image in nanoseconds.
PEAK_IPL_C_API PEAK_IPL_Image_ConvertTo(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image containing the data of the current image converted to the given pixel format.
PEAK_IPL_C_API PEAK_IPL_Image_Clone(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Returns a new created image containing the data of the current image as deep copy.
PEAK_IPL_C_API PEAK_IPL_Image_GetByteCount(PEAK_IPL_IMAGE_HANDLE imageHandle, size_t *byteCount)
Queries the size of the given image in number of bytes.
PEAK_IPL_C_API PEAK_IPL_Image_GetPixelFormat(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT *pixelFormat)
Queries the pixel format of the given image.
struct PEAK_IPL_IMAGE * PEAK_IPL_IMAGE_HANDLE
Definition peak_ipl_backend.h:405
PEAK_IPL_C_API PEAK_IPL_Image_ScaleInto(PEAK_IPL_IMAGE_HANDLE imageHandle, const struct PEAK_IPL_SIZE_2D *size, uint8_t *buffer, size_t bufferSize, PEAK_IPL_INTERPOLATION_ALGORITHM algorithm)
Creates a new image scaled to size using algorithm into the supplied buffer.
PEAK_IPL_C_API PEAK_IPL_Image_Crop(PEAK_IPL_IMAGE_HANDLE imageHandle, const struct PEAK_IPL_POINT_2D *pos, const struct PEAK_IPL_SIZE_2D *size, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image cropped to size starting at position.
@ PEAK_IPL_PIXEL_FORMAT_INVALID
Definition peak_ipl_backend.h:60
PEAK_IPL_C_API PEAK_IPL_Image_Scale(PEAK_IPL_IMAGE_HANDLE imageHandle, const struct PEAK_IPL_SIZE_2D *size, PEAK_IPL_INTERPOLATION_ALGORITHM algorithm, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image scaled to size using algorithm.
PEAK_IPL_C_API PEAK_IPL_Image_GetData(PEAK_IPL_IMAGE_HANDLE imageHandle, uint8_t **data)
Queries the data pointer of the given image.
int32_t PEAK_IPL_INTERPOLATION_ALGORITHM
Definition peak_ipl_backend.h:303
PEAK_IPL_C_API PEAK_IPL_Image_GetHeight(PEAK_IPL_IMAGE_HANDLE imageHandle, size_t *height)
Queries the height of the given image.
int32_t PEAK_IPL_PIXEL_FORMAT
Definition peak_ipl_backend.h:173
PEAK_IPL_C_API PEAK_IPL_Image_GetPixelPointer(PEAK_IPL_IMAGE_HANDLE imageHandle, size_t xPos, size_t yPos, uint8_t **pixelPointer)
Queries the pointer to the given pixel position.
PEAK_IPL_C_API PEAK_IPL_Image_SetTimestamp(PEAK_IPL_IMAGE_HANDLE imageHandle, uint64_t timestamp_ns)
Set the timestamp for an image in nanoseconds.
PEAK_IPL_C_API PEAK_IPL_Image_ConvertToWithFactorAndOffset(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, double factor, double offset, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Creates a new image containing the data of the current image converted to the given pixel format mult...
PEAK_IPL_C_API PEAK_IPL_Image_ConvertToBuffer(PEAK_IPL_IMAGE_HANDLE imageHandle, PEAK_IPL_PIXEL_FORMAT outputPixelFormat, uint8_t *outputImageBuffer, size_t outputImageBufferSize, PEAK_IPL_CONVERSION_MODE conversionMode, PEAK_IPL_IMAGE_HANDLE *outputImageHandle)
Stores the data of the current image converted to the given pixel format into a destination buffer an...
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:16
Definition peak_ipl_backend.h:259
Definition peak_ipl_backend.h:265
2D position in an image.
Definition peak_ipl_simple_types.hpp:242
size_t x
X position.
Definition peak_ipl_simple_types.hpp:243
size_t y
Y position.
Definition peak_ipl_simple_types.hpp:244
Scale Factors of an image.
Definition peak_ipl_simple_types.hpp:267
double y
Y factor.
Definition peak_ipl_simple_types.hpp:269
double x
X factor.
Definition peak_ipl_simple_types.hpp:268
2D size of an image.
Definition peak_ipl_simple_types.hpp:218
size_t height
Height of size.
Definition peak_ipl_simple_types.hpp:220
size_t width
Width of size.
Definition peak_ipl_simple_types.hpp:219