IDS peak IPL v1.17.1
Loading...
Searching...
No Matches
peak_ipl_image.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
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
46class Image
47{
48public:
56 Image();
57
70 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height);
71
90 Image(
91 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height);
92
106 Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns);
107
128 Image(const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns);
129
142 explicit Image(peak::common::IImageView& imageView);
143
150 ~Image();
151
163 Image(const Image& other);
164
176 Image& operator=(const Image& other);
177
186 Image(Image&& other) noexcept;
187
196 Image& operator=(Image&& other) noexcept;
197
207 PEAK_IPL_NO_DISCARD size_t Width() const;
208
218 PEAK_IPL_NO_DISCARD size_t Height() const;
219
230
247 PEAK_IPL_NO_DISCARD uint8_t* PixelPointer(size_t xPos, size_t yPos) const;
248
266 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
267 PEAK_IPL_NO_DISCARD T* PixelPointer(size_t xPos, size_t yPos) const
268 {
269 return reinterpret_cast<T*>(PixelPointer(xPos, yPos));
270 }
271
281 PEAK_IPL_NO_DISCARD size_t ByteCount() const;
282
293
306 PEAK_IPL_NO_DISCARD uint8_t* Data() const;
307
322 template<typename T, typename = std::enable_if_t<std::is_arithmetic<T>::value>>
324 {
325 return reinterpret_cast<T*>(Data());
326 }
327
345
366 Image ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
367 size_t outputImageBufferSize,
369
394 double factor, double offset = 0.0, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
395
422 uint8_t* outputImageBuffer, size_t outputImageBufferSize, double factor, double offset = 0.0,
424
444 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, const peak::ipl::Interval<double>& interval,
446
472 inline Image ConvertToFromInterval(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
473 size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode = peak::ipl::ConversionMode::Fast) const;
474
488 template <typename Integer1, typename Integer2,
489 typename std::enable_if_t<std::is_integral<Integer1>::value, int> = 0,
490 typename std::enable_if_t<std::is_integral<Integer2>::value, int> = 0>
492 {
493 return Scale(peak::ipl::Size2D{static_cast<std::size_t>(width), static_cast<std::size_t>(height)}, algorithm);
494 }
495
509
525
541 template<typename FloatingPoint1, typename FloatingPoint2,
542 typename std::enable_if_t<std::is_floating_point<FloatingPoint1>::value, int> = 0,
543 typename std::enable_if_t<std::is_floating_point<FloatingPoint2>::value, int> = 0>
544 PEAK_IPL_NO_DISCARD inline Image Scale(FloatingPoint1 scaleFactorX, FloatingPoint2 scaleFactorY, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const
545 {
546 return Scale(peak::ipl::ScaleFactor{static_cast<double>(scaleFactorX), static_cast<double>(scaleFactorY)}, algorithm);
547 }
548
561 void ScaleInto(const peak::ipl::Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm=InterpolationAlgorithm::linear) const;
562
576
589
600
610 PEAK_IPL_NO_DISCARD bool Empty() const;
611
620 PEAK_IPL_NO_DISCARD uint64_t Timestamp() const;
621
626 PEAK_IPL_NO_DISCARD bool operator==(const Image& img) const;
627
632 PEAK_IPL_NO_DISCARD bool operator!=(const Image& img) const;
633
634private:
635 friend ImageBackendAccessor;
636
637 explicit Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference=false);
638
639 PEAK_IPL_IMAGE_HANDLE m_backendHandle{};
640};
641
642} /* namespace ipl */
643} /* namespace peak */
644
645namespace
646{
647
649class ImageBackendAccessor
650{
651public:
659 PEAK_IPL_NO_DISCARD static PEAK_IPL_IMAGE_HANDLE BackendHandle(const peak::ipl::Image& image)
660 {
661 return image.m_backendHandle;
662 }
663
673 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImage(PEAK_IPL_IMAGE_HANDLE imageHandle)
674 {
675 return peak::ipl::Image(imageHandle, false);
676 }
677
687 PEAK_IPL_NO_DISCARD static peak::ipl::Image CreateImageReference(PEAK_IPL_IMAGE_HANDLE imageHandle)
688 {
689 return peak::ipl::Image(imageHandle, true);
690 }
691};
692
693} /* namespace */
694
695namespace peak
696{
697namespace ipl
698{
700{
703 });
704}
705
706inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height)
707{
710 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), width, height, &m_backendHandle);
711 });
712}
713
715 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height)
716{
719 static_cast<PEAK_IPL_PIXEL_FORMAT>(pixelFormat.PixelFormatName()), buffer, bufferSize, width, height,
720 &m_backendHandle);
721 });
722}
723
724inline Image::Image(const peak::ipl::PixelFormat& pixelFormat, size_t width, size_t height, uint64_t timestamp_ns) :
725 Image::Image(pixelFormat, width, height)
726{
728 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
729 });
730}
731
733 const peak::ipl::PixelFormat& pixelFormat, uint8_t* buffer, size_t bufferSize, size_t width, size_t height, uint64_t timestamp_ns) :
734 Image::Image(pixelFormat, buffer, bufferSize, width, height)
735{
737 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns);
738 });
739}
740
742 : Image(static_cast<peak::ipl::PixelFormatName>(imageView.GetPixelFormat()), imageView.GetData(),
743 imageView.GetSizeInBytes(), imageView.GetWidth(), imageView.GetHeight())
744{
745 const auto metadata = imageView.GetMetadata();
746 if(metadata->HasEntryByKey<peak::common::MetadataKey::DeviceTimestamp>())
747 {
748 const auto timestamp_ns = metadata->GetValueByKey<peak::common::MetadataKey::DeviceTimestamp>();
749 ExecuteAndMapReturnCodes(
750 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_SetTimestamp(m_backendHandle, timestamp_ns); });
751 }
752}
753
754inline Image::Image(PEAK_IPL_IMAGE_HANDLE imageHandle, bool acquireReference)
755 : m_backendHandle(imageHandle)
756{
757 if (acquireReference && m_backendHandle)
758 {
760 }
761}
762
764{
765 if (m_backendHandle)
766 {
767 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
768 }
769}
770
771inline Image::Image(const Image& other)
772{
773 if (other.m_backendHandle)
774 {
775 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
776 }
777
778 m_backendHandle = other.m_backendHandle;
779}
780
781inline Image& Image::operator=(const Image& other)
782{
783 if (this != &other)
784 {
785 if (m_backendHandle)
786 {
787 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
788 }
789
790 if (other.m_backendHandle)
791 {
792 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Acquire(other.m_backendHandle); });
793 }
794 }
795
796 m_backendHandle = other.m_backendHandle;
797
798 return *this;
799}
800
801inline Image::Image(Image&& other) noexcept
802{
803 *this = std::move(other);
804}
805
806inline Image& Image::operator=(Image&& other) noexcept
807{
808 if (this != &other)
809 {
810 if (m_backendHandle != nullptr)
811 {
812 (void)PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Destruct(m_backendHandle);
813 }
814 m_backendHandle = other.m_backendHandle;
815 other.m_backendHandle = nullptr;
816 }
817
818 return *this;
819}
820
821inline size_t Image::Width() const
822{
823 size_t width = 0;
824
825 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetWidth(m_backendHandle, &width); });
826
827 return width;
828}
829
830inline size_t Image::Height() const
831{
832 size_t height = 0;
833
834 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetHeight(m_backendHandle, &height); });
835
836 return height;
837}
838
840{
841 return {Width(), Height()};
842}
843
844inline uint8_t* Image::PixelPointer(size_t xPos, size_t yPos) const
845{
846 uint8_t* pixelPosition = nullptr;
847
849 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetPixelPointer(m_backendHandle, xPos, yPos, &pixelPosition);
850 });
851
852 return pixelPosition;
853}
854
855inline size_t Image::ByteCount() const
856{
857 size_t byteCount = 0;
858
860 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetByteCount(m_backendHandle, &byteCount); });
861
862 return byteCount;
863}
864
866{
868
871 m_backendHandle, reinterpret_cast<PEAK_IPL_PIXEL_FORMAT*>(&pixelFormatName));
872 });
873
874 return peak::ipl::PixelFormat{ pixelFormatName };
875}
876
877inline uint8_t* Image::Data() const
878{
879 uint8_t* data = nullptr;
880
881 ExecuteAndMapReturnCodes([&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetData(m_backendHandle, &data); });
882
883 return data;
884}
885
887 const peak::ipl::PixelFormat& outputPixelFormat, peak::ipl::ConversionMode conversionMode) const
888{
889 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
891 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ConvertTo(m_backendHandle,
892 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()),
893 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
894 });
895
896 return ImageBackendAccessor::CreateImage(outputImageHandle);
897}
898
899inline Image Image::ConvertTo(const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer,
900 size_t outputImageBufferSize, peak::ipl::ConversionMode conversionMode) const
901{
902 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
905 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), outputImageBuffer,
906 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
907 });
908
909 return ImageBackendAccessor::CreateImage(outputImageHandle);
910}
911
913 const peak::ipl::PixelFormat& outputPixelFormat, double factor, double offset, peak::ipl::ConversionMode conversionMode) const
914{
915 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
918 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset,
919 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
920 });
921
922 return ImageBackendAccessor::CreateImage(outputImageHandle);
923}
924
926 const peak::ipl::PixelFormat& outputPixelFormat, uint8_t* outputImageBuffer, size_t outputImageBufferSize,
927 double factor, double offset, peak::ipl::ConversionMode conversionMode) const
928{
929 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
932 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), factor, offset, outputImageBuffer, outputImageBufferSize,
933 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
934 });
935
936 return ImageBackendAccessor::CreateImage(outputImageHandle);
937}
938
940 const peak::ipl::Interval<double>& interval, peak::ipl::ConversionMode conversionMode) const
941{
942 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
945 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(),
946 static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
947 });
948
949 return ImageBackendAccessor::CreateImage(outputImageHandle);
950}
951
953 uint8_t* outputImageBuffer, size_t outputImageBufferSize, const peak::ipl::Interval<double>& interval,
954 peak::ipl::ConversionMode conversionMode) const
955{
956 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
959 static_cast<PEAK_IPL_PIXEL_FORMAT>(outputPixelFormat.PixelFormatName()), interval.Start(), interval.End(), outputImageBuffer,
960 outputImageBufferSize, static_cast<PEAK_IPL_CONVERSION_MODE>(conversionMode), &outputImageHandle);
961 });
962
963 return ImageBackendAccessor::CreateImage(outputImageHandle);
964}
965
966inline Image Image::Scale(const Size2D& size, peak::ipl::InterpolationAlgorithm algorithm) const
967{
968 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
969 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
970
972 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Scale(m_backendHandle, &size_in, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm), &outputImageHandle);
973 });
974
975 return ImageBackendAccessor::CreateImage(outputImageHandle);
976}
977
979{
980 return Scale(Size2D{static_cast<size_t>(static_cast<double>(Width()) * factor.x), static_cast<size_t>(static_cast<double>(Height()) * factor.y)}, algorithm);
981}
982
983inline void Image::ScaleInto(const Size2D& size, uint8_t* buffer, std::size_t bufferSize, peak::ipl::InterpolationAlgorithm algorithm) const
984{
985 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
986
988 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_ScaleInto(m_backendHandle, &size_in, buffer, bufferSize, static_cast<PEAK_IPL_INTERPOLATION_ALGORITHM>(algorithm));
989 });
990}
991
992
993inline Image Image::Crop(const Point2D& pos, const Size2D& size) const
994{
995 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
996 const PEAK_IPL_POINT_2D pos_in{pos.x, pos.y};
997 const PEAK_IPL_SIZE_2D size_in{size.width, size.height};
998
1000 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Crop(m_backendHandle, &pos_in, &size_in, &outputImageHandle);
1001 });
1002
1003 return ImageBackendAccessor::CreateImage(outputImageHandle);
1004}
1005
1006inline Image Image::Crop(const Size2D& size) const
1007{
1008 return Crop({0,0}, size);
1009}
1010
1011inline Image Image::Clone() const
1012{
1013 PEAK_IPL_IMAGE_HANDLE outputImageHandle = nullptr;
1015 [&] { return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_Clone(m_backendHandle, &outputImageHandle); });
1016
1017 return ImageBackendAccessor::CreateImage(outputImageHandle);
1018}
1019
1020inline bool Image::Empty() const
1021{
1022 return (m_backendHandle == nullptr) || (PixelFormat().PixelFormatName() == PixelFormatName::Invalid);
1023}
1024
1025inline uint64_t Image::Timestamp() const
1026{
1027 uint64_t timestamp_ns;
1029 return PEAK_IPL_C_ABI_PREFIX PEAK_IPL_Image_GetTimestamp(m_backendHandle, &timestamp_ns);
1030 });
1031
1032 return timestamp_ns;
1033}
1034
1035inline bool Image::operator==(const peak::ipl::Image& img) const
1036{
1037 if (img.ByteCount() != this->ByteCount())
1038 {
1039 return false;
1040 }
1041 if (img.Width() != this->Width())
1042 {
1043 return false;
1044 }
1045 if (img.Height() != this->Height())
1046 {
1047 return false;
1048 }
1049 if (img.PixelFormat().PixelFormatName() != this->PixelFormat().PixelFormatName())
1050 {
1051 return false;
1052 }
1053 if (img.Timestamp() != this->Timestamp())
1054 {
1055 return false;
1056 }
1057
1058 return memcmp(img.Data(), this->Data(), img.ByteCount()) == 0;
1059}
1060
1061inline bool Image::operator!=(const peak::ipl::Image& img) const
1062{
1063 return !(*this == img);
1064}
1065
1066} /* namespace ipl */
1067} /* namespace peak */
Interface for viewing image pixel data from arbitrary sources.
Definition peak_common_iimageview.hpp:42
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:47
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:267
bool operator!=(const Image &img) const
Checks whether the image is data-wise different.
Definition peak_ipl_image.hpp:1061
Image & operator=(const Image &other)
Copy assigment for Image instance.
Definition peak_ipl_image.hpp:781
size_t Width() const
Returns the width.
Definition peak_ipl_image.hpp:821
bool Empty() const
Checks whether the image is empty.
Definition peak_ipl_image.hpp:1020
peak::ipl::Size2D Size() const
Returns the Size.
Definition peak_ipl_image.hpp:839
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:912
peak::ipl::PixelFormat PixelFormat() const
Returns the pixel format.
Definition peak_ipl_image.hpp:865
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:844
size_t ByteCount() const
Returns the size of the given image in number of bytes.
Definition peak_ipl_image.hpp:855
bool operator==(const Image &img) const
Checks whether the image is data-wise the same.
Definition peak_ipl_image.hpp:1035
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:877
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:983
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:939
size_t Height() const
Returns the height.
Definition peak_ipl_image.hpp:830
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:993
Image Clone() const
Returns a new created image containing the data of the current image as deep copy.
Definition peak_ipl_image.hpp:1011
~Image()
Destructor for the Image instance.
Definition peak_ipl_image.hpp:763
Image()
Creates an empty image. In other words, size is 0x0 and an invalid pixel format.
Definition peak_ipl_image.hpp:699
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:886
uint64_t Timestamp() const
The timestamp in nanoseconds.
Definition peak_ipl_image.hpp:1025
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:491
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:544
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:323
Interval support and convenience class.
Definition peak_ipl_interval.hpp:38
constexpr T End() const
Get the end value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:81
constexpr T Start() const
Get the start value (inclusive) for the interval.
Definition peak_ipl_interval.hpp:69
Represents a pixel format and its specific properties.
Definition peak_ipl_pixel_format.hpp:35
peak::ipl::PixelFormatName PixelFormatName() const
Returns the name of the pixel format as enum value.
Definition peak_ipl_pixel_format.hpp:125
PixelFormatName
Enum holding the possible pixel format names.
Definition peak_ipl_simple_types.hpp:43
@ Invalid
Invalid Pixel Format.
Definition peak_ipl_simple_types.hpp:44
InterpolationAlgorithm
Enum holding the possible interpolation algorithm.
Definition peak_ipl_simple_types.hpp:210
ConversionMode
Enum holding the possible conversion modes.
Definition peak_ipl_simple_types.hpp:32
@ linear
bilinear interpolation
Definition peak_ipl_simple_types.hpp:212
@ Fast
Fast conversion mode.
Definition peak_ipl_simple_types.hpp:33
@ DeviceTimestamp
Device-provided image acquisition timestamp in nanoseconds.
Definition peak_common_metadata_key.hpp:43
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_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:250
size_t x
X position.
Definition peak_ipl_simple_types.hpp:251
size_t y
Y position.
Definition peak_ipl_simple_types.hpp:252
Scale Factors of an image.
Definition peak_ipl_simple_types.hpp:276
double y
Y factor.
Definition peak_ipl_simple_types.hpp:278
double x
X factor.
Definition peak_ipl_simple_types.hpp:277
2D size of an image.
Definition peak_ipl_simple_types.hpp:225
size_t height
Height of size.
Definition peak_ipl_simple_types.hpp:227
size_t width
Width of size.
Definition peak_ipl_simple_types.hpp:226