| Face Engine SDK 5.34.0 A face detection, recognition and tracking engine.

Image.h
1 #pragma once
2
3 #include <fsdk/Def.h>
4 #include <fsdk/Types/Format.h>
5 #include <fsdk/Types/Rect.h>
6 #include <fsdk/Types/Result.h>
7 #include <fsdk/Types/RotationType.h>
8 #include <fsdk/Types/Sizer.h>
9 #include <fsdk/Types/SubImage.h>
10
11 namespace fsdk {
12
13 struct IArchive;
14
38 struct Image {
39
43 enum class Type : uint8_t {
44 BMP,
45 JPG,
46 PNG,
47 PPM,
48 TIFF,
49 Unknown
50 };
51
55 enum class TargetDevice {
56 CPU,
57 GPU,
58 NPU,
59 };
60
68 enum class ImageCompression {
69 IC_NO_COMPRESSION,
70 IC_SMALL_COMPRESSION,
71 IC_MEDIUM_COMPRESSION,
73 IC_HARD_COMPRESSION,
74 IC_BEST_COMPRESSION,
75 };
79 enum class Error : uint32_t {
80 Ok,
81 InvalidWidth,
82 InvalidHeight,
83 InvalidDataPtr,
84 InvalidDataSize,
85 InvalidImage,
86 InvalidArchive,
87 InvalidPath,
88 InvalidType,
89 InvalidFormat,
90 InvalidBitmap,
91 InvalidMemory,
92 InvalidConversion,
93 InvalidResidence,
94 InvalidDevice,
95 InvalidCudaKernel,
96 FailedToSave,
97 FailedToLoad,
98 FailedToInitialize,
99 InvalidInput,
100 ReleasedInOtherThread
101 };
102
108 enum class MemoryResidence : uint32_t {
109 MemoryCPU,
110 MemoryGPU,
111 MemoryNPU,
112 MemoryNPU_DPP,
113 };
114
117 FSDK_API Image() noexcept;
118
129 FSDK_API Image(
130 int width,
131 int height,
132 Format format,
133 MemoryResidence residence = MemoryResidence::MemoryCPU,
134 int deviceId = 0) noexcept;
135
148 FSDK_API Image(
149 int width,
150 int height,
151 Format format,
152 const void* data,
153 MemoryResidence residence = MemoryResidence::MemoryCPU,
154 int deviceId = 0) noexcept;
155
173 FSDK_API Image(
174 int width,
175 int height,
176 Format format,
177 void* data,
178 bool copy,
179 MemoryResidence residence = MemoryResidence::MemoryCPU,
180 int deviceId = 0) noexcept;
181
186 FSDK_API Image(const Image& other) noexcept;
187
192 FSDK_API Image(Image&& other) noexcept;
193
199 FSDK_API explicit Image(const SubImage& subImage) noexcept;
200
201 FSDK_API ~Image();
202
217 FSDK_API Result<Error> create(
218 int width,
219 int height,
220 Format format,
221 bool cleanup = true,
222 MemoryResidence residence = MemoryResidence::MemoryCPU,
223 int deviceId = 0) noexcept;
224
240 FSDK_API Result<Error> create(
241 int width,
242 int height,
243 Format format,
244 const void* data,
245 MemoryResidence residence = MemoryResidence::MemoryCPU,
246 int deviceId = 0) noexcept;
247
267 FSDK_API Result<Error> create(
268 int width,
269 int height,
270 Format format,
271 void* data,
272 bool copy,
273 MemoryResidence residence = MemoryResidence::MemoryCPU,
274 int deviceId = 0) noexcept;
275
285 FSDK_API Result<Error>
286 create(const fsdk::Image& source, MemoryResidence residence, int deviceId = 0) noexcept;
287
305 FSDK_API Result<Error> set(
306 int width,
307 int height,
308 Format format,
309 const void* data,
310 MemoryResidence residence = MemoryResidence::MemoryCPU,
311 int deviceId = 0) noexcept;
312
334 FSDK_API Result<Error> set(
335 int width,
336 int height,
337 Format format,
338 void* data,
339 bool copy,
340 MemoryResidence residence = MemoryResidence::MemoryCPU,
341 int deviceId = 0) noexcept;
342
348 FSDK_API Result<Error> set(const Image& other) noexcept;
349
355 FSDK_API Result<Error> set(const SubImage& subImage) noexcept;
356
369 FSDK_API SubImage map(int x, int y, int width, int height) const noexcept;
370
378 SubImage map(const Rect& rect) const noexcept {
379 return map(rect.x, rect.y, rect.width, rect.height);
380 }
381
391 SubImage map(const Size& size) const noexcept {
392 return map(Point2i(0, 0), size);
393 }
394
403 SubImage map(const Point2i& origin, const Size& size) const noexcept {
404 return map(origin.x, origin.y, size.x, size.y);
405 }
406
421 FSDK_API Image extract(int x, int y, int width, int height) const noexcept;
422
436 FSDK_API Result<Image::Error> extract(Image& dest, int x, int y, int width, int height) const noexcept;
437
449 FSDK_API Result<Image::Error> extract(Image& dest, const Rect& rect) const noexcept;
450
458 FSDK_API Result<Error> rescale(Image& dest, float scale) const noexcept;
459
469 Image extract(const Rect& rect) const noexcept {
470 return extract(rect.x, rect.y, rect.width, rect.height);
471 }
472
484 Image extract(const Size& size) const noexcept {
485 return extract(Point2i(0, 0), size);
486 }
487
498 Image extract(const Point2i& origin, const Size& size) const noexcept {
499 return extract(origin.x, origin.y, size.x, size.y);
500 }
501
509 FSDK_API static Result<Error>
510 guessTypeFromMemory(const void* data, const uint32_t sizeInBytes, Type& type) noexcept;
511
517 Image clone() const noexcept {
518 return {getWidth(), getHeight(), getFormat(), getData(), getMemoryResidence(), getDeviceId()};
519 }
520
539 FSDK_API Result<Image::Error> convert(
540 Image& dest,
541 int x,
542 int y,
543 int width,
544 int height,
545 Format format,
546 TargetDevice device = TargetDevice::CPU) const noexcept;
547
562 Result<Image::Error> convert(
563 Image& dest,
564 const Point2i& origin,
565 const Size& size,
566 Format format,
567 TargetDevice device = TargetDevice::CPU) const noexcept {
568 return convert(dest, origin.x, origin.y, size.x, size.y, format, device);
569 }
570
586 Result<Image::Error>
587 convert(Image& dest, const Size& size, Format format, TargetDevice device = TargetDevice::CPU)
588 const noexcept {
589 return convert(dest, Point2i(0, 0), size, format, device);
590 }
591
605 Result<Image::Error>
606 convert(Image& dest, const Rect& rect, Format format, TargetDevice device = TargetDevice::CPU)
607 const noexcept {
608 return convert(dest, rect.x, rect.y, rect.width, rect.height, format, device);
609 }
610
621 Result<Image::Error>
622 convert(Image& dest, Format format, TargetDevice device = TargetDevice::CPU) const noexcept {
623 return convert(dest, getRect(), format, device);
624 }
625
631 FSDK_API Image rescale(float scale) const noexcept;
632
643 FSDK_API Result<Image::Error> save(
644 const char* path,
645 fsdk::Image::ImageCompression additionalFlag =
646 fsdk::Image::ImageCompression::IC_NO_COMPRESSION) const noexcept;
647
658 FSDK_API Result<Error> save(const char* path, const Format format) const noexcept;
659
670 FSDK_API Result<Image::Error> saveToMemory(
671 Image::Type type,
672 IArchive* archive,
673 fsdk::Image::ImageCompression additionalFlag =
674 fsdk::Image::ImageCompression::IC_NO_COMPRESSION) const noexcept;
675
687 FSDK_API Result<Image::Error>
688 saveToMemory(Image::Type type, IArchive* archive, const Format format) const noexcept;
689
702 FSDK_API Result<Error> load(const char* path) noexcept;
703
713 FSDK_API Result<Error> load(const char* path, const Format format) noexcept;
714
728 FSDK_API Result<Error> loadFromMemory(const void* data, const uint32_t sizeInBytes) noexcept;
729
739 FSDK_API Result<Error> rotate(Image& dest, RotationType rotationType) const noexcept;
740
752 FSDK_API Result<Error>
753 loadFromMemory(const void* data, const uint32_t sizeInBytes, const Format format) noexcept;
754
770 FSDK_API Result<Error>
771 loadFromMemoryOfType(const void* data, const uint32_t sizeInBytes, const Type type) noexcept;
772
784 FSDK_API Result<Error> loadFromMemoryOfType(
785 const void* data,
786 const uint32_t sizeInBytes,
787 const Type type,
788 const Format format) noexcept;
789
793 Image& operator=(const Image& other) noexcept {
794 set(other);
795
796 return *this;
797 }
798
802 Image& operator=(Image&& other) noexcept {
803 if(this != &other) {
804 release();
805 swap(other);
806 }
807
808 return *this;
809 }
810
812 bool isNull() const noexcept {
813 return getData() == nullptr;
814 }
815
819 bool isValid() const noexcept {
820 return !isNull() && getHeight() > 0 && getWidth() > 0 && getFormat().isValid();
821 }
822
826 operator bool() const noexcept {
827 return isValid();
828 }
829
834 FSDK_API void* getScanLine(int y) noexcept;
835
840 FSDK_API const void* getScanLine(int y) const noexcept;
841
844 FSDK_API int getDataSize() const noexcept;
845
849 FSDK_API void getDataSize(Sizer& sizer) const noexcept;
850
855 template <typename T>
856 T* getScanLineAs(int y) noexcept {
857 return reinterpret_cast<T*>(getScanLine(y));
858 }
859
864 template <typename T>
865 const T* getScanLineAs(int y) const noexcept {
866 return reinterpret_cast<const T*>(getScanLine(y));
867 }
868
871 void* getData() noexcept {
872 return m_data;
873 }
874
877 const void* getData() const noexcept {
878 return m_data;
879 }
880
883 template <typename T>
884 T* getDataAs() noexcept {
885 return reinterpret_cast<T*>(getData());
886 }
887
890 template <typename T>
891 const T* getDataAs() const noexcept {
892 return reinterpret_cast<const T*>(getData());
893 }
894
896 int getRowSize() const noexcept {
897 return getFormat().computePitch(getWidth());
898 }
899
901 int getWidth() const noexcept {
902 return m_width;
903 }
904
906 int getHeight() const noexcept {
907 return m_height;
908 }
909
911 float getAspectRatio() const noexcept {
912 return static_cast<float>(getWidth()) / static_cast<float>(getHeight());
913 }
914
916 Format getFormat() const noexcept {
917 return m_format;
918 }
919
920 MemoryResidence getMemoryResidence() const noexcept {
921 return m_residence;
922 }
923
924 int getDeviceId() const noexcept {
925 return m_deviceId;
926 }
927
929 Size getSize() const noexcept {
930 return Size(getWidth(), getHeight());
931 }
932
936 Rect getRect() const noexcept {
937 return Rect(0, 0, getWidth(), getHeight());
938 }
939
944 bool ownsData() const noexcept {
945 return !!m_ref;
946 }
947
952 bool isSharedWith(const Image& other) const noexcept {
953 return getData() == other.getData();
954 }
955
959 void swap(Image& other) noexcept {
960 std::swap(m_data, other.m_data);
961 std::swap(m_ref, other.m_ref);
962 std::swap(m_height, other.m_height);
963 std::swap(m_width, other.m_width);
964 std::swap(m_format, other.m_format);
965 std::swap(m_residence, other.m_residence);
966 }
967
970 void reset() noexcept {
971 Image().swap(*this);
972 }
973
979 bool equalWeak(const fsdk::Image& other) const noexcept {
980 return m_width == other.getWidth() && m_height == other.getHeight() && m_format == other.getFormat() &&
981 m_residence == other.getMemoryResidence();
982 }
983
989 bool equalStrong(const fsdk::Image& other) const noexcept {
990 return equalWeak(other) && m_data == other.getData();
991 }
992
993 FSDK_API void putPixel(uint32_t x, uint32_t y) noexcept;
994
995 protected:
996 void* m_data;
997 int* m_ref;
998 int m_height;
999 int m_width;
1000 int m_deviceId;
1001 Format m_format;
1002 MemoryResidence m_residence;
1003
1008 FSDK_API static void* allocate(int size) noexcept;
1009
1013 FSDK_API static void deallocate(void* memory) noexcept;
1014
1018 FSDK_API int retain() noexcept;
1019
1023 FSDK_API int release() noexcept;
1024
1028 FSDK_API int getRefCount() const noexcept;
1029 };
1030
1035 const char* toString(Image::MemoryResidence residence);
1036
1040 template <>
1041 struct ErrorTraits<Image::Error> {
1042
1043 static bool isOk(Image::Error error) noexcept {
1044 return error == Image::Error::Ok;
1045 }
1046
1047 static const char* toString(Image::Error error) noexcept {
1048 switch(error) {
1049 case Image::Error::Ok:
1050 return "Ok";
1051 case Image::Error::InvalidType:
1052 return "Unsupported type";
1053 case Image::Error::InvalidPath:
1054 return "Invalid path";
1055 case Image::Error::FailedToSave:
1056 return "Error during image saving";
1057 case Image::Error::FailedToLoad:
1058 return "Error during image loading";
1059 case Image::Error::InvalidImage:
1060 return "Invalid image";
1061 case Image::Error::InvalidWidth:
1062 return "Invalid image width";
1063 case Image::Error::InvalidHeight:
1064 return "Invalid image height";
1065 case Image::Error::InvalidFormat:
1066 return "Unsupported format";
1067 case Image::Error::InvalidMemory:
1068 return "Memory error";
1069 case Image::Error::InvalidBitmap:
1070 return "Bitmap error";
1071 case Image::Error::InvalidArchive:
1072 return "Archive error";
1073 case Image::Error::InvalidDataPtr:
1074 return "Bad input data pointer";
1075 case Image::Error::InvalidDataSize:
1076 return "Bad input data size";
1077 case Image::Error::InvalidConversion:
1078 return "Required conversion not implemented";
1079 case Image::Error::InvalidDevice:
1080 return "Selected Target Device is not supported for this system";
1081 case Image::Error::FailedToInitialize:
1082 return "Error during initialization";
1083 case Image::Error::ReleasedInOtherThread:
1084 return "Failed to retain image: it was released in another thread.";
1085 case Image::Error::InvalidInput:
1086 return "InvalidInput";
1087 default:
1088 return "Unknown error";
1089 }
1090 }
1091 };
1092
1096 using ImageType = Image::Type;
1097 using ImageError = Image::Error;
1098 using TargetDevice = Image::TargetDevice;
1099 using ImageCompression = Image::ImageCompression;
1100
1101 } // namespace fsdk
fsdk::Image::Error::InvalidMemory
Error at memory opening.
fsdk::Image::ImageCompression::IC_MEDIUM_COMPRESSION
medium compression (only for png or jpg)
fsdk::Image::Error::InvalidCudaKernel
Error during apply cuda kernel.
FSDK_API
#define FSDK_API
Dummy.
Definition: Def.h:27
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Image::loadFromMemory
FSDK_API Result< Error > loadFromMemory(const void *data, const uint32_t sizeInBytes) noexcept
Load image from memory.
fsdk::Image::getAspectRatio
float getAspectRatio() const noexcept
Definition: Image.h:911
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
fsdk::Image::reset
void reset() noexcept
Reset image contents.
Definition: Image.h:970
fsdk::Image::deallocate
static FSDK_API void deallocate(void *memory) noexcept
Free memory.
fsdk::Image::equalStrong
bool equalStrong(const fsdk::Image &other) const noexcept
Performs strong comparison of this image with other. Beside weak comparison strong comparison also ch...
Definition: Image.h:989
fsdk::Point2i
Vector2< int > Point2i
Definition: Vector2.h:294
fsdk::Image::getRect
Rect getRect() const noexcept
Definition: Image.h:936
fsdk::Image::MemoryResidence::MemoryNPU_DPP
Image in NPU PreProcessing module memory.
fsdk::Image::m_height
int m_height
image height.
Definition: Image.h:998
fsdk::Image::convert
FSDK_API Result< Image::Error > convert(Image &dest, int x, int y, int width, int height, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
fsdk::Image::ImageCompression::IC_BEST_COMPRESSION
maximum compression level (only for png or jpg)
fsdk::Image::Error::InvalidFormat
Unsupported format.
fsdk::Image::Error::InvalidInput
Invalid input.
fsdk::Format::computePitch
int computePitch(int rowWidth) const noexcept
Compute row size in bytes.
Definition: Format.h:200
fsdk::Format::isValid
bool isValid() const noexcept
Definition: Format.h:253
fsdk::Image::convert
Result< Image::Error > convert(Image &dest, const Point2i &origin, const Size &size, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:562
fsdk::Format
Image format.
Definition: Format.h:11
fsdk::Image::isNull
bool isNull() const noexcept
Definition: Image.h:812
fsdk::Image::Error::InvalidPath
Bad path for saving / loading.
fsdk::Image::load
FSDK_API Result< Error > load(const char *path) noexcept
Load image from file.
fsdk::Image::Error::Ok
Ok.
fsdk::Image::getData
void * getData() noexcept
Definition: Image.h:871
fsdk::Image::getFormat
Format getFormat() const noexcept
Definition: Image.h:916
fsdk::Image::getData
const void * getData() const noexcept
Definition: Image.h:877
fsdk::Image::getDataAs
const T * getDataAs() const noexcept
Definition: Image.h:891
fsdk::Image::saveToMemory
FSDK_API Result< Image::Error > saveToMemory(Image::Type type, IArchive *archive, fsdk::Image::ImageCompression additionalFlag=fsdk::Image::ImageCompression::IC_NO_COMPRESSION) const noexcept
Save image to memory buffer.
fsdk::Image::set
FSDK_API Result< Error > set(int width, int height, Format format, const void *data, MemoryResidence residence=MemoryResidence::MemoryCPU, int deviceId=0) noexcept
Initializes an image with provided data. If current image is not empty and it&#39;s size and format match...
fsdk::Image::getRowSize
int getRowSize() const noexcept
Definition: Image.h:896
fsdk::Image::getScanLineAs
T * getScanLineAs(int y) noexcept
Get image scanline data.
Definition: Image.h:856
fsdk::Image::extract
FSDK_API Image extract(int x, int y, int width, int height) const noexcept
Extract a sub image of this image. The new image will have it&#39;s own reference count.
fsdk::RotationType
RotationType
Image rotation type.
Definition: RotationType.h:10
fsdk::ErrorTraits
Definition: Result.h:8
fsdk::Image::Error::InvalidBitmap
Bitmap error occurred.
fsdk::Image::MemoryResidence
MemoryResidence
Memory residence.
Definition: Image.h:108
fsdk::Image::getHeight
int getHeight() const noexcept
Definition: Image.h:906
fsdk::Image::Error::InvalidConversion
Conversion not implemented.
fsdk::Image::m_format
Format m_format
image format (
Definition: Image.h:1001
Def.h
Common SDK definitions.
fsdk::Image::Error::InvalidResidence
Invalid memory residence.
fsdk::Image::Error::InvalidDataSize
Bad input data size.
fsdk::Image::map
SubImage map(const Size &size) const noexcept
Map image contents to a given area.
Definition: Image.h:391
fsdk::Image::isSharedWith
bool isSharedWith(const Image &other) const noexcept
Definition: Image.h:952
fsdk::Image::m_data
void * m_data
raw image data.
Definition: Image.h:996
fsdk::Image::convert
Result< Image::Error > convert(Image &dest, const Size &size, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:587
fsdk::Image::create
FSDK_API Result< Error > create(int width, int height, Format format, bool cleanup=true, MemoryResidence residence=MemoryResidence::MemoryCPU, int deviceId=0) noexcept
Initializes an empty image and preallocates storage buffer of given size.
fsdk::Image::m_ref
int * m_ref
reference counter. nullptr if image does not own data.
Definition: Image.h:997
fsdk::Image::getScanLineAs
const T * getScanLineAs(int y) const noexcept
Get image scanline data.
Definition: Image.h:865
fsdk::Image::getRefCount
FSDK_API int getRefCount() const noexcept
Obtain reference count.
fsdk::Image::Error::FailedToSave
Error during image saving.
fsdk::Image::m_deviceId
int m_deviceId
id of the device where image memory is allocated
Definition: Image.h:1000
fsdk::Image::map
FSDK_API SubImage map(int x, int y, int width, int height) const noexcept
Map image contents to a given area.
fsdk::Image::extract
Image extract(const Point2i &origin, const Size &size) const noexcept
Extract a sub image of this image. The new image will have it&#39;s own reference count.
Definition: Image.h:498
fsdk::Image::allocate
static FSDK_API void * allocate(int size) noexcept
Allocate memory.
fsdk::Image::Type
Type
Supported image types.
Definition: Image.h:43
fsdk::Image::equalWeak
bool equalWeak(const fsdk::Image &other) const noexcept
Performs weak comparison of this image with other. Weak in this context means only image parameters s...
Definition: Image.h:979
fsdk::Image::swap
void swap(Image &other) noexcept
Swap contents with another image.
Definition: Image.h:959
fsdk::Image::Error::FailedToLoad
Error during image loading.
fsdk::Image::Error::ReleasedInOtherThread
Failed to retain image: it was released in another thread.
fsdk::Image::m_width
int m_width
image width.
Definition: Image.h:999
fsdk::Image::MemoryResidence::MemoryGPU
Image in Cuda device memory.
fsdk::Image::Error::InvalidType
Unsupported type.
fsdk::Image::ImageCompression
ImageCompression
Supported compression type is used only for jpg and png types.
Definition: Image.h:68
fsdk::Image
Image.
Definition: Image.h:38
fsdk::Image::ImageCompression::IC_SMALL_COMPRESSION
image)
fsdk::Image::Error::InvalidArchive
Archive error.
fsdk::Image::getDataAs
T * getDataAs() noexcept
Definition: Image.h:884
fsdk::Image::getDataSize
FSDK_API int getDataSize() const noexcept
fsdk::Image::Error::InvalidDevice
Target Device is not supported for this system.
fsdk::Image::operator=
Image & operator=(const Image &other) noexcept
Assign other image.
Definition: Image.h:793
fsdk::Image::release
FSDK_API int release() noexcept
Decrease reference count.
fsdk::Image::MemoryResidence::MemoryCPU
Image in Host device memory.
fsdk::Image::Error::InvalidImage
Invalid image.
fsdk::Image::ImageCompression::IC_NO_COMPRESSION
no compression (only for png or jpg image)
fsdk::Image::convert
Result< Image::Error > convert(Image &dest, const Rect &rect, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:606
fsdk::IArchive
Archive interface.
Definition: IObject.h:38
fsdk::Image::map
SubImage map(const Point2i &origin, const Size &size) const noexcept
Map image contents to a given area.
Definition: Image.h:403
fsdk::toString
const char * toString(Image::MemoryResidence residence)
Returns a string representation of a MemoryResidence type.
fsdk::BaseRect< int >
fsdk::Image::rotate
FSDK_API Result< Error > rotate(Image &dest, RotationType rotationType) const noexcept
Rotates an image on 90, 180 and 270 degrees. Allocates a new buffer of given size and fills image con...
fsdk::Image::extract
Image extract(const Size &size) const noexcept
Extract a sub image of this image. The new image will have it&#39;s own reference count.
Definition: Image.h:484
fsdk::Image::Error::InvalidDataPtr
Bad input data pointer.
fsdk::Image::loadFromMemoryOfType
FSDK_API Result< Error > loadFromMemoryOfType(const void *data, const uint32_t sizeInBytes, const Type type) noexcept
Load image from memory of specific type.
fsdk::Image::getScanLine
FSDK_API void * getScanLine(int y) noexcept
Get image scanline data.
fsdk::Image::Error
Error
Image error codes.
Definition: Image.h:79
fsdk::Image::ownsData
bool ownsData() const noexcept
Definition: Image.h:944
fsdk::Image::Error::InvalidWidth
Invalid width.
fsdk::SubImage
Sub Image.
Definition: SubImage.h:13
fsdk::Image::convert
Result< Image::Error > convert(Image &dest, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:622
fsdk::Image::Image
FSDK_API Image() noexcept
Initializes an empty image.
fsdk::Image::ImageCompression::IC_HARD_COMPRESSION
more than medium compression (only for png or jpg)
fsdk::Image::Error::FailedToInitialize
Error during initialization.
fsdk::Image::clone
Image clone() const noexcept
Create a copy of this image. The new image will have it&#39;s own reference count.
Definition: Image.h:517
fsdk::Image::save
FSDK_API Result< Image::Error > save(const char *path, fsdk::Image::ImageCompression additionalFlag=fsdk::Image::ImageCompression::IC_NO_COMPRESSION) const noexcept
Save image.
fsdk::Image::Error::InvalidHeight
Invalid height.
fsdk::Image::TargetDevice
TargetDevice
Target device that fsdk::Image algorithms will be running on.
Definition: Image.h:55
fsdk::Image::extract
Image extract(const Rect &rect) const noexcept
Extract a sub image of this image. The new image will have it&#39;s own reference count.
Definition: Image.h:469
fsdk::Sizer
Helper entity to measure size of dynamic objects in memory.
Definition: Sizer.h:9
fsdk::Image::retain
FSDK_API int retain() noexcept
Increase reference count.
fsdk::Size
Vector2< int > Size
Definition: Vector2.h:303
fsdk::Image::getSize
Size getSize() const noexcept
Definition: Image.h:929
fsdk::Image::operator=
Image & operator=(Image &&other) noexcept
Move other image.
Definition: Image.h:802
fsdk::Vector2< int >
fsdk::Image::getWidth
int getWidth() const noexcept
Definition: Image.h:901
fsdk::Image::MemoryResidence::MemoryNPU
Image in NPU device memory.
fsdk::Image::isValid
bool isValid() const noexcept
Definition: Image.h:819
fsdk::Image::rescale
FSDK_API Result< Error > rescale(Image &dest, float scale) const noexcept
Rescale image keeping proportions.
fsdk::Image::guessTypeFromMemory
static FSDK_API Result< Error > guessTypeFromMemory(const void *data, const uint32_t sizeInBytes, Type &type) noexcept
Guess type of image written into memory.