 |
Face Engine SDK
4.7.0
A face detection, recognition and tracking engine.
|
4 #include <fsdk/Types/Format.h>
5 #include <fsdk/Types/Rect.h>
6 #include <fsdk/Types/Result.h>
7 #include <fsdk/Types/Sizer.h>
8 #include <fsdk/Types/SubImage.h>
306 return map(rect.x, rect.y, rect.width, rect.height);
329 return map(origin.x, origin.y, size.x, size.y);
354 return extract(rect.x, rect.y, rect.width, rect.height);
379 return extract(origin.x, origin.y, size.x, size.y);
439 return convert(dest, origin.x, origin.y, size.x, size.y, format, device);
475 return convert(dest, rect.x, rect.y, rect.width, rect.height, format, device);
523 const Format format)
const noexcept;
552 const Format format)
const noexcept;
577 const Format format) noexcept;
593 const uint32_t sizeInBytes) noexcept;
606 const uint32_t sizeInBytes,
607 const Format format) noexcept;
625 const uint32_t sizeInBytes,
626 const Type type) noexcept;
640 const uint32_t sizeInBytes,
642 const Format format) noexcept;
683 operator bool () const noexcept {
742 return reinterpret_cast<T*
>(
getData());
749 return reinterpret_cast<const T*
>(
getData());
808 return getData() == other.getData();
815 std::swap(
m_data, other.m_data);
816 std::swap(
m_ref, other.m_ref);
817 std::swap(
m_height, other.m_height);
818 std::swap(
m_width, other.m_width);
819 std::swap(
m_format, other.m_format);
820 std::swap(m_residence, other.m_residence);
829 FSDK_API void putPixel(uint32_t x, uint32_t y) noexcept;
877 static const char* toString (
Image::Error error) noexcept {
895 default:
return "Unknown error";
bool ownsData() const noexcept
Definition: Image.h:799
int m_width
image width.
Definition: Image.h:835
int m_height
image height.
Definition: Image.h:834
const void * getData() const noexcept
Definition: Image.h:734
void * getData() noexcept
Definition: Image.h:728
MemoryResidence
Memory residence.
Definition: Image.h:103
Size getSize() const noexcept
Definition: Image.h:784
Format m_format
image format (
Definition: Image.h:837
FSDK_API Result< Error > loadFromMemory(const void *data, const uint32_t sizeInBytes) noexcept
Load image from memory.
@ MemoryCPU
Image in Host device memory.
@ InvalidConversion
Conversion not implemented.
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.
@ IC_BEST_COMPRESSION
maximum compression level (only for png or jpg)
FSDK_API SubImage map(int x, int y, int width, int height) const noexcept
Map image contents to a given area.
@ InvalidDataPtr
Bad input data pointer.
FSDK_API Result< Error > load(const char *path) noexcept
Load image from file.
Result< Image::Error > convert(Image &dest, const Rect &rect, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:474
Result< Image::Error > convert(Image &dest, const Size &size, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:457
@ FailedToInitialize
Error during initialization.
int getHeight() const noexcept
Definition: Image.h:763
void swap(Image &other) noexcept
Swap contents with another image.
Definition: Image.h:814
@ InvalidHeight
Invalid height.
Result< Image::Error > convert(Image &dest, Format format, TargetDevice device=TargetDevice::CPU) const noexcept
Convert image format.
Definition: Image.h:488
@ InvalidMemory
Error at memory opening.
const T * getDataAs() const noexcept
Definition: Image.h:748
bool isNull() const noexcept
Definition: Image.h:666
FSDK_API Result< Error > load(const char *path, const Format format) noexcept
Load image from file and convert it to required format.
SDK namespace.
Definition: IAGSEstimator.h:8
T * getScanLineAs(int y) noexcept
Get image scanline data.
Definition: Image.h:713
FSDK_API Result< Error > set(int width, int height, Format format, const void *data) noexcept
Initializes an image with provided data. If current image is not empty and it's size and format match...
Image & operator=(const Image &other) noexcept
Assign an other image.
Definition: Image.h:647
static FSDK_API void * allocate(int size) noexcept
Allocate memory.
Image extract(const Rect &rect) const noexcept
Extract a sub image of this image. The new image will have it's own reference count.
Definition: Image.h:353
@ InvalidDevice
Target Device is not supported for this system.
@ InvalidPath
Bad path for saving / loading.
@ InvalidResidence
Invalid memory residence.
void * m_data
raw image data.
Definition: Image.h:832
@ InvalidDataSize
Bad input data size.
T * getDataAs() noexcept
Definition: Image.h:741
ImageCompression
Supported compression type is used only for jpg and png types.
Definition: Image.h:66
Image clone() const noexcept
Create a copy of this image. The new image will have it's own reference count.
Definition: Image.h:396
bool isSharedWith(const Image &other) const noexcept
Definition: Image.h:807
Image extract(const Size &size) const noexcept
Extract a sub image of this image. The new image will have it's own reference count.
Definition: Image.h:366
FSDK_API Result< Error > loadFromMemoryOfType(const void *data, const uint32_t sizeInBytes, const Type type) noexcept
Load image from memory of specific type.
@ IC_NO_COMPRESSION
no compression (only for png or jpg image)
int getRowSize() const noexcept
Definition: Image.h:753
#define FSDK_API
Dummy.
Definition: Def.h:27
FSDK_API Result< Error > loadFromMemory(const void *data, const uint32_t sizeInBytes, const Format format) noexcept
Load image from memory and convert it to required format.
FSDK_API Result< Error > save(const char *path, const Format format) const noexcept
Convert and Save image.
FSDK_API int getDataSize() const noexcept
Vector2< int > Size
Definition: Vector2.h:301
int getWidth() const noexcept
Definition: Image.h:758
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.
@ IC_HARD_COMPRESSION
more than medium compression (only for png or jpg)
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's own reference count.
void reset() noexcept
Reset image contents.
Definition: Image.h:825
FSDK_API Result< Error > loadFromMemoryOfType(const void *data, const uint32_t sizeInBytes, const Type type, const Format format) noexcept
Load image from memory of specific type and convert it to required format.
FSDK_API int retain() noexcept
Increase reference count.
FSDK_API int release() noexcept
Decrease reference count.
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:438
@ FailedToSave
Error during image saving.
@ InvalidImage
Invalid image.
SubImage map(const Point2i &origin, const Size &size) const noexcept
Map image contents to a given area.
Definition: Image.h:328
Archive interface.
Definition: IObject.h:37
Vector2< int > Point2i
Definition: Vector2.h:292
Image extract(const Point2i &origin, const Size &size) const noexcept
Extract a sub image of this image. The new image will have it's own reference count.
Definition: Image.h:378
@ InvalidBitmap
Bitmap error occurred.
FSDK_API Result< Error > create(int width, int height, Format format, bool cleanup=true, MemoryResidence residence=MemoryResidence::MemoryCPU) noexcept
Initializes an empty image and preallocates storage buffer of given size.
float getAspectRatio() const noexcept
Definition: Image.h:768
FSDK_API Result< Image::Error > save(const char *path, fsdk::Image::ImageCompression additionalFlag=fsdk::Image::ImageCompression::IC_NO_COMPRESSION) const noexcept
Save image.
FSDK_API Image() noexcept
Initializes an empty image.
Rect getRect() const noexcept
Definition: Image.h:791
A structure that encapsulates an action result enumeration.
Definition: Result.h:30
static FSDK_API void deallocate(void *memory) noexcept
Free memory.
FSDK_API Image rescale(float scale) const noexcept
Rescale image keeping proportions.
static FSDK_API Result< Error > guessTypeFromMemory(const void *data, const uint32_t sizeInBytes, Type &type) noexcept
Guess type of image written into memory.
Format getFormat() const noexcept
Definition: Image.h:775
bool isValid() const noexcept
Definition: Image.h:673
@ MemoryGPU
Image in Cuda device memory.
FSDK_API const void * getScanLine(int y) const noexcept
Get image scanline data.
Image.
Definition: Image.h:38
SubImage map(const Size &size) const noexcept
Map image contents to a given area.
Definition: Image.h:317
FSDK_API void * getScanLine(int y) noexcept
Get image scanline data.
Error
Image error codes.
Definition: Image.h:76
FSDK_API Result< Image::Error > saveToMemory(Image::Type type, IArchive *archive, const Format format) const noexcept
Convert and save image to memory buffer.
@ InvalidType
Unsupported type.
int * m_ref
reference counter. nullptr if image does not own data.
Definition: Image.h:833
Sub Image.
Definition: SubImage.h:11
@ ReleasedInOtherThread
Failed to retain image: it was released in another thread.
FSDK_API int getRefCount() const noexcept
Obtain reference count.
TargetDevice
Target device that fsdk::Image algorithms will be running on.
Definition: Image.h:55
@ InvalidFormat
Unsupported format.
@ IC_SMALL_COMPRESSION
compression with minimal (or without) quality loss (only for png or jpg image)
@ InvalidArchive
Archive error.
const T * getScanLineAs(int y) const noexcept
Get image scanline data.
Definition: Image.h:722
Helper entity to measure size of dynamic objects in memory.
Definition: Sizer.h:10
@ IC_MEDIUM_COMPRESSION
medium compression (only for png or jpg)
Type
Supported image types.
Definition: Image.h:43
@ FailedToLoad
Error during image loading.
@ InvalidWidth
Invalid width.