IDS peak IPL v1.18.0
Loading...
Searching...
No Matches
peak_ipl_image.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
13
16
17#include <cstddef>
18#include <cstdint>
19#include <utility>
20#include <type_traits>
21
22namespace
23{
24class ImageBackendAccessor;
25}
26
31
32namespace peak
33{
34namespace ipl
35{
36
41class Image
42{
43public:
51 Image();
52
65 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height);
66
85 Image(
86 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height);
87
101 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns);
102
123 Image(const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns);
124
137 explicit Image(peak::common::IImageView& imageView);
138
145 ~Image();
146
158 Image(const Image& other);
159
171 Image& operator=(const Image& other);
172
181 Image(Image&& other) noexcept;
182
191 Image& operator=(Image&& other) noexcept;
192
202 PEAK_IPL_NO_DISCARD size_t Width() const;
203
213 PEAK_IPL_NO_DISCARD size_t Height() const;
214
225
242 PEAK_IPL_NO_DISCARD uint8_t* PixelPointer(size_t xPos, size_t yPos) const;
243
261 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
262 PEAK_IPL_NO_DISCARD T* PixelPointer(size_t xPos, size_t yPos) const
263 {
264 return reinterpret_cast<T*>(PixelPointer(xPos, yPos));
265 }
266
276 PEAK_IPL_NO_DISCARD size_t ByteCount() const;
277
288
301 PEAK_IPL_NO_DISCARD uint8_t* Data() const;
302
317 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
319 {
320 return reinterpret_cast<T*>(Data());
321 }
322
340
361 Image ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
362 size_t outputImageBufferSize,
364
389 double factor, double offset = 0.0, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
390
417 uint8_t* outputImageBuffer, size_t outputImageBufferSize, double factor, double offset = 0.0,
419
439 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, const peak::ipl::Interval<double>& interval,
441
467 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
468 size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
469
483 template <typename Integer1, typename Integer2,
484 typename std::enable_if_t<std::is_integral<Integer1>::value, int> = 0,
485 typename std::enable_if_t<std::is_integral<Integer2>::value, int> = 0>
487 {
488 return Scale(peak::ipl::Size2D{static_cast<std::size_t>(width), static_cast<std::size_t>(height)}, algorithm);
489 }
490
504
520
536 template<typename FloatingPoint1, typename FloatingPoint2,
537 typename std::enable_if_t<std::is_floating_point<FloatingPoint1>::value, int> = 0,
538 typename std::enable_if_t<std::is_floating_point<FloatingPoint2>::value, int> = 0>
539 PEAK_IPL_NO_DISCARD inline Image Scale(FloatingPoint1 scaleFactorX, FloatingPoint2 scaleFactorY, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
540 {
541 return Scale(peak::ipl::ScaleFactor{static_cast<double>(scaleFactorX), static_cast<double>(scaleFactorY)}, algorithm);
542 }
543
556 void ScaleInto(const peak::ipl::Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const;
557
571
584
595
605 PEAK_IPL_NO_DISCARD bool Empty() const;
606
615 PEAK_IPL_NO_DISCARD uint64_t Timestamp() const;
616
621 PEAK_IPL_NO_DISCARD bool operator==(const Image& img) const;
622
627 PEAK_IPL_NO_DISCARD bool operator!=(const Image& img) const;
628
629private:
630 friend ImageBackendAccessor;
631
632 explicit Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference=false);
633
634 PEAK_IPL_IMAGE_HANDLE m_backendHandle{};
635};
636
637} /* namespace ipl */
638} /* namespace peak */
639
640namespace
641{
642
644class ImageBackendAccessor
645{
646public:
654 PEAK_IPL_NO_DISCARD static PEAK_IPL_IMAGE_HANDLE BackendHandle(const peak::ipl::Image& image)
655 {
656 return image.m_backendHandle;
657 }
658
668 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImage(PEAK_IPL_IMAGE_HANDLE imageHandle)
669 {
670 return peak::ipl::Image(imageHandle, false);
671 }
672
682 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImageReference(PEAK_IPL_IMAGE_HANDLE imageHandle)
683 {
684 return peak::ipl::Image(imageHandle, true);
685 }
686};
687
688} /* namespace */
689
690namespace peak
691{
692namespace ipl
693{
695{
698 });
699}
700
701inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height)
702{
705 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), width, height, &m_backendHandle);
706 });
707}
708
710 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height)
711{
714 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), buffer, bufferSize, width, height,
715 &m_backendHandle);
716 });
717}
718
719inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns) :
720 Image::Image(pixelFormat, width, height)
721{
723 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
724 });
725}
726
728 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns) :
729 Image::Image(pixelFormat, buffer, bufferSize, width, height)
730{
732 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
733 });
734}
735
737 : Image(static_cast<peak::ipl::PixelFormatName>(imageView.GetPixelFormat()), imageView.GetData(),
738 imageView.GetSizeInBytes(), imageView.GetWidth(), imageView.GetHeight())
739{
740 const auto metadata = imageView.GetMetadata();
741 if(metadata->HasEntryByKey<peak::common::MetadataKey::DeviceTimestamp>())
742 {
743 const auto timestamp_ns = metadata->GetValueByKey<peak::common::MetadataKey::DeviceTimestamp>();
744 ExecuteAndMapReturnCodes(
745 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns); });
746 }
747}
748
749inline Image::Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference)
750 : m_backendHandle(imageHandle)
751{
752 if (acquireReference && m_backendHandle)
753 {
755 }
756}
757
759{
760 if (m_backendHandle)
761 {
762 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
763 }
764}
765
766inline Image::Image(const Image& other)
767{
768 if (other.m_backendHandle)
769 {
770 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
771 }
772
773 m_backendHandle = other.m_backendHandle;
774}
775
776inline Image& Image::operator=(const Image& other)
777{
778 if (this != &other)
779 {
780 if (m_backendHandle)
781 {
782 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
783 }
784
785 if (other.m_backendHandle)
786 {
787 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
788 }
789 }
790
791 m_backendHandle = other.m_backendHandle;
792
793 return *this;
794}
795
796inline Image::Image(Image&& other) noexcept
797{
798 *this = std::move(other);
799}
800
801inline Image& Image::operator=(Image&& other) noexcept
802{
803 if (this != &other)
804 {
805 if (m_backendHandle != nullptr)
806 {
807 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
808 }
809 m_backendHandle = other.m_backendHandle;
810 other.m_backendHandle = nullptr;
811 }
812
813 return *this;
814}
815
816inline size_t Image::Width() const
817{
818 size_t width = 0;
819
820 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetWidth(m_backendHandle, &width); });
821
822 return width;
823}
824
825inline size_t Image::Height() const
826{
827 size_t height = 0;
828
829 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetHeight(m_backendHandle, &height); });
830
831 return height;
832}
833
835{
836 return {Width(), Height()};
837}
838
839inline uint8_t* Image::PixelPointer(size_t xPos, size_t yPos) const
840{
841 uint8_t* pixelPosition = nullptr;
842
844 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetPixelPointer(m_backendHandle, xPos, yPos, &pixelPosition);
845 });
846
847 return pixelPosition;
848}
849
850inline size_t Image::ByteCount() const
851{
852 size_t byteCount = 0;
853
855 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetByteCount(m_backendHandle, &byteCount); });
856
857 return byteCount;
858}
859
861{
863
866 m_backendHandle, reinterpret_cast<PEAK_IPL_PIXEL_FORMAT*>(&pixelFormatName));
867 });
868
869 return peak::ipl::PixelFormat{ pixelFormatName };
870}
871
872inline uint8_t* Image::Data() const
873{
874 uint8_t* data = nullptr;
875
876 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetData(m_backendHandle, &data); });
877
878 return data;
879}
880
882 const peak::ipl::PixelFormat& outputPixelFormat, peak::ipl::ConversionMode conversionMode) const
883{
884 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
886 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ConvertTo(m_backendHandle,
887 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()),
888 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
889 });
890
891 return ImageBackendAccessor::CreateImage(outputImageHandle);
892}
893
894inline Image Image::ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
895 size_t outputImageBufferSize, peak::ipl::ConversionMode conversionMode) const
896{
897 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
900 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), outputImageBuffer,
901 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
902 });
903
904 return ImageBackendAccessor::CreateImage(outputImageHandle);
905}
906
908 const peak::ipl::PixelFormat& outputPixelFormat, double factor, double offset, peak::ipl::ConversionMode conversionMode) const
909{
910 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
913 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset,
914 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
915 });
916
917 return ImageBackendAccessor::CreateImage(outputImageHandle);
918}
919
921 const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer, size_t outputImageBufferSize,
922 double factor, double offset, peak::ipl::ConversionMode conversionMode) const
923{
924 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
927 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset, outputImageBuffer, outputImageBufferSize,
928 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
929 });
930
931 return ImageBackendAccessor::CreateImage(outputImageHandle);
932}
933
935 const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode) const
936{
937 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
940 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(),
941 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
942 });
943
944 return ImageBackendAccessor::CreateImage(outputImageHandle);
945}
946
948 uint8_t* outputImageBuffer, size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval,
949 peak::ipl::ConversionMode conversionMode) const
950{
951 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
954 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(), outputImageBuffer,
955 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
956 });
957
958 return ImageBackendAccessor::CreateImage(outputImageHandle);
959}
960
961inline Image Image::Scale(const Size2D& size, peak::ipl::InterpolationAlgorithm algorithm) const
962{
963 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
964 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
965
967 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Scale(m_backendHandle, &size_in, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm), &outputImageHandle);
968 });
969
970 return ImageBackendAccessor::CreateImage(outputImageHandle);
971}
972
974{
975 return Scale(Size2D{static_cast<size_t>(static_cast<double>(Width()) * factor.x), static_cast<size_t>(static_cast<double>(Height()) * factor.y)}, algorithm);
976}
977
978inline void Image::ScaleInto(const Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm) const
979{
980 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
981
983 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ScaleInto(m_backendHandle, &size_in, buffer, bufferSize, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm));
984 });
985}
986
987
988inline Image Image::Crop(const Point2D& pos, const Size2D& size) const
989{
990 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
991 const PEAK_IPL_POINT_2D pos_in{pos.x, pos.y};
992 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
993
995 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Crop(m_backendHandle, &pos_in, &size_in, &outputImageHandle);
996 });
997
998 return ImageBackendAccessor::CreateImage(outputImageHandle);
999}
1000
1001inline Image Image::Crop(const Size2D& size) const
1002{
1003 return Crop({0,0}, size);
1004}
1005
1006inline Image Image::Clone() const
1007{
1008 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
1010 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Clone(m_backendHandle, &outputImageHandle); });
1011
1012 return ImageBackendAccessor::CreateImage(outputImageHandle);
1013}
1014
1015inline bool Image::Empty() const
1016{
1017 return (m_backendHandle == nullptr) || (PixelFormat().PixelFormatName() == PixelFormatName::Invalid);
1018}
1019
1020inline uint64_t Image::Timestamp() const
1021{
1022 uint64_t timestamp_ns;
1024 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetTimestamp(m_backendHandle, &timestamp_ns);
1025 });
1026
1027 return timestamp_ns;
1028}
1029
1030inline bool Image::operator==(const peak::ipl::Image& img) const
1031{
1032 if (img.ByteCount() != this->ByteCount())
1033 {
1034 return false;
1035 }
1036 if (img.Width() != this->Width())
1037 {
1038 return false;
1039 }
1040 if (img.Height() != this->Height())
1041 {
1042 return false;
1043 }
1044 if (img.PixelFormat().PixelFormatName() != this->PixelFormat().PixelFormatName())
1045 {
1046 return false;
1047 }
1048 if (img.Timestamp() != this->Timestamp())
1049 {
1050 return false;
1051 }
1052
1053 return memcmp(img.Data(), this->Data(), img.ByteCount()) == 0;
1054}
1055
1056inline bool Image::operator!=(const peak::ipl::Image& img) const
1057{
1058 return !(*this == img);
1059}
1060
1061} /* namespace ipl */
1062} /* namespace peak */
Interface for viewing image pixel data from arbitrary sources.
Definition peak_common_iimageview.hpp:37
virtual PEAK_COMMON_NO_DISCARD std::shared_ptr< peak::common::Metadata > GetMetadata()=0
Returns the metadata object which can be used to retrieve or set metadata belonging to the image.
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:42
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:262
bool operator!=(const Image &img) const
Checks whether the image is data-wise different.
Definition peak_ipl_image.hpp:1056
Image & operator=(const Image &other)
Copy assigment for Image instance.
Definition peak_ipl_image.hpp:776
size_t Width() const
Returns the width.
Definition peak_ipl_image.hpp:816
bool Empty() const
Checks whether the image is empty.
Definition peak_ipl_image.hpp:1015
peak::ipl::Size2D Size() const
Returns the Size.
Definition peak_ipl_image.hpp:834
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:907
peak::ipl::PixelFormat PixelFormat() const
Returns the pixel format.
Definition peak_ipl_image.hpp:860
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:839
size_t ByteCount() const
Returns the size of the given image in number of bytes.
Definition peak_ipl_image.hpp:850
bool operator==(const Image &img) const
Checks whether the image is data-wise the same.
Definition peak_ipl_image.hpp:1030
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:872
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:978
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:934
size_t Height() const
Returns the height.
Definition peak_ipl_image.hpp:825
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:988
Image Clone() const
Returns a new created image containing the data of the current image as deep copy.
Definition peak_ipl_image.hpp:1006
~Image()
Destructor for the Image instance.
Definition peak_ipl_image.hpp:758
Image()
Creates an empty image. In other words, size is 0x0 and an invalid pixel format.
Definition peak_ipl_image.hpp:694
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:881
uint64_t Timestamp() const
The timestamp in nanoseconds.
Definition peak_ipl_image.hpp:1020
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:486
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:539
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:318
Interval support and convenience class.
Definition peak_ipl_interval.hpp:33
constexpr T End() const
Get the end value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:76
constexpr T Start() const
Get the start value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:64
Represents a pixel format and its specific properties.
Definition peak_ipl_pixel_format.hpp:30
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition peak_ipl_pixel_format.hpp:120
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:38
@ Invalid
Invalid Pixel Format.
Definition peak_ipl_simple_types.hpp:39
InterpolationAlgorithm
Enum holding the possible interpolation algorithm.
Definition peak_ipl_simple_types.hpp:205
ConversionMode
Enum holding the possible conversion modes.
Definition peak_ipl_simple_types.hpp:27
@ linear
bilinear interpolation
Definition peak_ipl_simple_types.hpp:207
@ Fast
Fast conversion mode.
Definition peak_ipl_simple_types.hpp:28
@ DeviceTimestamp
Device-provided image acquisition timestamp in nanoseconds.
Definition peak_common_metadata_key.hpp:38
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_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:52
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:402
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:57
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:300
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:170
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:11
Definition peak_ipl_backend.h:256
Definition peak_ipl_backend.h:262
2D position in an image.
Definition peak_ipl_simple_types.hpp:245
size_t x
X position.
Definition peak_ipl_simple_types.hpp:246
size_t y
Y position.
Definition peak_ipl_simple_types.hpp:247
Scale Factors of an image.
Definition peak_ipl_simple_types.hpp:271
double y
Y factor.
Definition peak_ipl_simple_types.hpp:273
double x
X factor.
Definition peak_ipl_simple_types.hpp:272
2D size of an image.
Definition peak_ipl_simple_types.hpp:220
size_t height
Height of size.
Definition peak_ipl_simple_types.hpp:222
size_t width
Width of size.
Definition peak_ipl_simple_types.hpp:221