|
Enrollment 28.2.0
|
#include <Image.h>
Classes | |
| class | ImageResampler |
| Image resampler for DPI-change operations, including upsampling and downsampling. More... | |
| class | BicubicImageResampler |
| Image resampler for DPI-change operations, including upsampling and downsampling using bicubic interpolation resampling algorithm. More... | |
| class | AreaImageResampler |
| Image resampler for DPI-change operations, including upsampling and downsampling using area interpolation resampling algorithm. More... | |
| class | NISTImageResampler |
| Image resampler for DPI-change operations, including upsampling and downsampling using NIST-compliant resampling algorithm provided by NFIR library. More... | |
Public Types | |
| enum class | Intersection : uint8_t { PARTIAL , INSIDE , OUTSIDE , NO , SAME } |
| Enum define possible intersection of Image and some Object e.g. Rectangle, Circle. More... | |
Public Member Functions | |
| Intersection | RectangleIntersection (const Rectangle &rectangle) const |
| Check intersection between rectangle and image. | |
| Intersection | CircleIntersection (const Circle &circle) const |
| Check intersection between circle and image. | |
| Intersection | PointIntersection (const Point &point) const |
| Checks intersection between point and image. | |
| ImageDpi | Dpi () const |
| Returns image dpi. | |
| ImageWidth | Width () const |
| Returns image width. | |
| ImageHeight | Height () const |
| Returns image height. | |
| std::shared_ptr< ImageEncoder > | OriginalEncoder () const |
| Provides original encoder to encode image to original format. | |
| RawImage | AsRawImage () const |
| Converts image to RAW format that has been originally used. | |
| RawImage | AsRawGrayscale () const |
| Converts image to raw grayscale format. | |
| RawImage | AsRawBGR () const |
| Converts image to raw BGR format. | |
| std::shared_ptr< Image > | AsBGR () const |
| Converts image to BGR format. | |
| RawImage | AsRawBGRA () const |
| Converts image to raw BGRA format. | |
| std::shared_ptr< Image > | AsBGRA () const |
| Converts image to BGRA format. | |
| std::vector< uint8_t > | EncodeIn (ImageEncoder &encoder) const |
| Encode image in given ImageEncoder. | |
| void | SaveIn (ImageSaver &saver) const |
| Save Image in given ImageSaver. | |
| void | SaveAs (const std::string &path) const |
| Save Image in given path. | |
| bool | operator== (const Image &right) const |
| Images are equal when has same dimensions and same content. | |
| std::shared_ptr< Image > | DrawShape (const ImageShape &shape) const |
| Draws shape to new image. | |
| std::shared_ptr< Image > | CropRectangle (const Rectangle &r) const |
| Crops a rectangle from the image, using a white background for any extra space. | |
| std::shared_ptr< Image > | CropRectangle (const Rectangle &r, const RGBA &background) const |
| Crops a rectangle from the image, using a white background for any extra space. | |
| std::shared_ptr< Image > | CropRectangle (const Rectangle &r, const RGBA &background, const ImageDimensions &dimension) const |
| Crops a rectangle and places it on a canvas of specified dimensions, using a specified background color. | |
| std::shared_ptr< Image > | ChangeDpiTo (const ImageResampler &resampler) const |
| Create image using provided DPI-change configuration. | |
| std::shared_ptr< Image > | ChangeDpiTo (ImageDpi targetDpi) const |
| Create image with given DPI. | |
| std::shared_ptr< Image > | Resize (float factor) const |
| Resize image to new image. | |
| std::shared_ptr< Image > | ResizeToMaxDimension (ImageDimension maxDimension) const |
| Resize image to new image with given max dimension. | |
| std::shared_ptr< Image > | CropAlignedRectangle (const Rectangle &r) const |
| Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image. | |
| std::shared_ptr< Image > | CropAlignedRectangle (const Rectangle &r, const RGBA &background) const |
| Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image. | |
| std::shared_ptr< Image > | CropAlignedRectangle (const Rectangle &r, const RGBA &background, const ImageDimensions &dimension) const |
| Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image. | |
| std::shared_ptr< Image > | CropCircle (const Circle &circle, const RGBA &background=Colors::White) const |
| Copy circle to new image. | |
| std::shared_ptr< Image > | MaskImageBy (const ImageMask &mask) const |
| Applies the specified mask to the image, creating a new masked image. | |
| size_t | Channels () const |
| Returns the number of channels in the image. | |
Static Public Member Functions | |
| static std::shared_ptr< Image > | Decode (const std::vector< uint8_t > &imageData) |
| Creates Image from image data with 500 DPI. | |
| static std::shared_ptr< Image > | Decode (const std::vector< uint8_t > &imageData, unsigned int dpi) |
| Creates Image from image data with given dpi. | |
| static std::shared_ptr< Image > | Decode (const std::vector< uint8_t > &imageData, std::shared_ptr< ImageExecutor > executor) |
| Creates Image from image data with 500 DPI. | |
| static std::shared_ptr< Image > | Decode (const std::vector< uint8_t > &imageData, unsigned int dpi, std::shared_ptr< ImageExecutor > executor) |
| Creates Image from image data with given DPI. | |
| static std::shared_ptr< Image > | DecodeRawImage (const RawImage &raw, std::shared_ptr< ImageEncoder > originalEncoder=nullptr, std::shared_ptr< ImageExecutor > executor=GlobalImageExecutor::Get()) |
| Creates Image from raw data. | |
| static ImageType | DeduceType (const std::vector< uint8_t > &imageData) |
| Deduce image type from image content. | |
Image representation.
|
strong |
Enum define possible intersection of Image and some Object e.g. Rectangle, Circle.
| Enumerator | |
|---|---|
| PARTIAL | The Object and Image has intersection.
Partial intersection |
| INSIDE | Object is fully in Image.
Inside intersection |
| OUTSIDE | Image is fully in Object.
Outside intersection |
| NO | Image and Object has no intersection.
No intersection |
| SAME | Image has same dimensions and vertices coordinates as Object.
Same intersection |
|
inlinenodiscard |
Converts image to BGR format.
| ImageException | when there is an processing error |
References AsRawBGR(), and DecodeRawImage().
|
inlinenodiscard |
Converts image to BGRA format.
| ImageException | when there is an processing error |
References AsRawBGRA(), and DecodeRawImage().
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
Converts image to raw grayscale format.
| ImageException | when there is an processing error |
References Dpi(), RawImage::GRAYSCALE, Height(), and Width().
|
inlinenodiscard |
Converts image to RAW format that has been originally used.
| ImageException | when there is an processing error |
References Dpi(), Height(), and Width().
Referenced by EncodeIn(), operator==(), SaveAs(), and SaveIn().
|
inlinenodiscard |
Create image using provided DPI-change configuration.
It creates new image as result of resizing this image using a customized resizing strategy with factor targetDpi/originalDPI.
| resampler | image resampler |
| ImageException | when there is an processing error |
| EnrollmentInvalidArgumentException | when resize algorithm is NIST and image is not single-channel grayscale |
References Image::ImageResampler::Resample().
Referenced by ChangeDpiTo().
Create image with given DPI.
It creates new image as result of resizing this image with factor newDPI/originalDPI. The function uses Standard resizing algorithm. See BicubicImageResampler.
| targetDpi | DPI of new image. |
| ImageException | when there is an processing error |
| EnrollmentInvalidArgumentException | when targetDpi is 0 |
References ChangeDpiTo().
|
inlinenodiscard |
|
inlinenodiscard |
Check intersection between circle and image.
| circle | Circle |
| ImageException | when there is an processing error |
References Circle::center, Circle::radius, Point::x, and Point::y.
Referenced by CropCircle().
Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image.
For background outside image it will use Color::White. The dimensions of the output image will be equal to those of the rectangle.
See Description with examples.
| r | Rectangle |
| ImageException | when there is an processing error |
References CropAlignedRectangle().
Referenced by CropAlignedRectangle(), and CropAlignedRectangle().
|
inlinenodiscard |
Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image.
The function will utilize the provided color for the background outside the image. The dimensions of the output image will be equal to those of the rectangle.
See Description with examples.
| r | Rectangle |
| background | color of background when rectangle is out of image |
| ImageException | when there is an processing error |
References CropAlignedRectangle().
|
inlinenodiscard |
Crop rectangle and align given top left rectangle point to coordinates [0,0] in new image.
The function will render an image using specified dimensions, incorporating a cropped aligned rectangle within. For areas outside the cropped rectangle, the specified background color will be applied. If the dimensions of the cropped rectangle differ from those of the output image, the function will center the cropped rectangle within the output image. Any additional space in the output image, resulting from a size discrepancy with the cropped rectangle, will be filled with the chosen background color.
See Description with examples.
| r | Rectangle |
| background | color of background when rectangle is out of image |
| dimension | requested dimension of new image. |
| ImageException | when there is an processing error |
References RGB::blue, RGBA::color, Rectangle::GetBottomLeft(), Rectangle::GetBottomRight(), Rectangle::GetHeight(), Rectangle::GetTopLeft(), Rectangle::GetTopRight(), Rectangle::GetWidth(), RGB::green, ImageDimensions::height, RGB::red, RGBA::transparency, ImageDimensions::width, Point::x, and Point::y.
|
inlinenodiscard |
Copy circle to new image.
See Description with examples.
| circle | circle to cut. |
| background | color of background around circle |
| EnrollmentInvalidArgumentException | when given circle and image has no intersection |
| ImageException | when there is an processing error |
References Circle::center, CircleIntersection(), NO, Circle::radius, Point::x, and Point::y.
Crops a rectangle from the image, using a white background for any extra space.
This method crops a rectangle from the image. If the rectangle extends beyond the image boundaries, the additional space is filled with a white background. The size of the resulting image matches the dimensions of the specified rectangle.
See Description with examples.
| r | Rectangle defining the area to crop. |
| EnrollmentInvalidArgumentException | if the rectangle does not intersect with the image. |
| ImageException | when there is an processing error |
References CropRectangle().
Referenced by CropRectangle(), and CropRectangle().
|
inlinenodiscard |
Crops a rectangle from the image, using a white background for any extra space.
This method crops a rectangle from the image. If the rectangle extends beyond the image boundaries, the additional space is filled with a specified background. The size of the resulting image matches the dimensions of the specified rectangle.
See Description with examples.
| r | Rectangle defining the area to crop. |
| background | Color for the background surrounding the rectangle. |
| EnrollmentInvalidArgumentException | if the rectangle does not intersect with the image. |
References CropRectangle().
|
inlinenodiscard |
Crops a rectangle and places it on a canvas of specified dimensions, using a specified background color.
This function crops a rectangle and centers it on a new canvas with the specified dimensions. If the new canvas is larger than the cropped rectangle, the extra space is filled with the specified background color. If the rectangle is larger than the original image, the background color fills the extra space.
See Description with examples.
| r | Rectangle defining the area to crop. |
| background | Color for the background. |
| dimension | Dimensions of the new canvas. If width or height is 0, dimensions are set based on the rectangle. |
| EnrollmentInvalidArgumentException | if the rectangle does not intersect with the image. |
References RGB::blue, RGBA::color, Rectangle::GetBottomLeft(), Rectangle::GetBottomRight(), Rectangle::GetTopLeft(), Rectangle::GetTopRight(), RGB::green, ImageDimensions::height, NO, RectangleIntersection(), RGB::red, RGBA::transparency, ImageDimensions::width, Point::x, and Point::y.
|
inlinestatic |
Creates Image from image data with 500 DPI.
See Description with examples. It uses default dpi (500). It uses GlobalImageExecutor for execution of image functionality.
| imageData | image content |
| ImageException | when type is not supported or image data are corrupted |
| NullArgumentException | when executor is null |
References Decode(), DefaultDpi, and GlobalImageExecutor::Get().
Referenced by Decode(), Decode(), Decode(), FaceCapture::FromIsoImage(), IrisCapture::FromIsoImage(), and Print::FromIsoImage().
|
inlinestatic |
Creates Image from image data with 500 DPI.
See Description with examples. It uses default dpi (500).
| imageData | image content |
| executor | image functionality executor (the execution strategy) |
| ImageException | when type is not supported or image data are corrupted |
| NullArgumentException | when executor is null |
References Decode(), and DefaultDpi.
|
inlinestatic |
Creates Image from image data with given dpi.
See Description with examples. It uses GlobalImageExecutor for execution of image functionality.
| imageData | image content |
| dpi | dpi of image |
| ImageException | when type is not supported or image data are corrupted |
| NullArgumentException | when executor is null |
References Decode(), and GlobalImageExecutor::Get().
|
inlinestatic |
Creates Image from image data with given DPI.
See Description with examples.
| imageData | image content |
| dpi | dpi of image |
| executor | image functionality executor (the execution strategy) |
| ImageException | when type is not supported or image data are corrupted |
| NullArgumentException | when executor is null |
References ImageEncoder::Create(), ImageException::DECODE_IMAGE, and DeduceType().
|
inlinestatic |
Creates Image from raw data.
See Description with examples.
| raw | RawImage |
| originalEncoder | original encoder |
| executor | image functionality executor (the execution strategy) |
| ImageException | when type is not supported or image data are corrupted |
References RawImage::Data(), RawImage::dpi, GlobalImageExecutor::Get(), RawImage::height, RawImage::type, and RawImage::width.
Referenced by AsBGR(), AsBGRA(), CroppedFace::FaceAreaMask(), CroppedFace::FaceAreaSegment(), CroppedFace::FaceAreaSegment(), IrisCapture::FromIsoImage(), Print::FromIsoImage(), and CroppedFace::GetFaceCapture().
|
inlinestatic |
|
inlinenodiscard |
Returns image dpi.
Referenced by AsRawBGR(), AsRawBGRA(), AsRawGrayscale(), and AsRawImage().
|
inlinenodiscard |
Draws shape to new image.
See Description with examples.
| shape | ImageShape |
| ImageException | when there is an processing error |
References ImageShape::DrawIn().
|
inlinenodiscard |
Encode image in given ImageEncoder.
| encoder | specific ImageEncoder |
| ImageException | when ImageEncoder throws |
| ImageException | when it is not possible convert image to raw data |
References AsRawImage(), and ImageEncoder::Encode().
|
inlinenodiscard |
Returns image height.
Referenced by AsRawBGR(), AsRawBGRA(), AsRawGrayscale(), AsRawImage(), and ResizeToMaxDimension().
Applies the specified mask to the image, creating a new masked image.
| mask | The ImageMask to apply to the current image. This mask defines the areas of the image to be modified or preserved according to the mask's specific logic. |
References ImageMask::MaskWith().
|
inline |
Images are equal when has same dimensions and same content.
| right | right image in comparison |
| ImageException | when there is an processing error |
References AsRawImage().
|
inlinenodiscard |
Provides original encoder to encode image to original format.
|
inlinenodiscard |
|
inlinenodiscard |
Check intersection between rectangle and image.
| rectangle | Rectangle |
| ImageException | when there is an processing error |
References Rectangle::GetBottomLeft(), Rectangle::GetBottomRight(), Rectangle::GetTopLeft(), Rectangle::GetTopRight(), Point::x, and Point::y.
Referenced by CropRectangle().
|
inlinenodiscard |
Resize image to new image.
| factor | resize factor. Valid values are positive real number except 0. |
| EnrollmentInvalidArgumentException | when factor is not positive real number except 0. |
| ImageException | when there is an processing error |
Referenced by ResizeToMaxDimension().
|
inlinenodiscard |
Resize image to new image with given max dimension.
When image has smaller dimension than maxDimension, then image is not resized. Otherwise image is resized to maxDimension with keeping aspect ratio.
| maxDimension | max dimension of new image |
| ImageException | when there is an processing error |
References Height(), Resize(), and Width().
|
inline |
Save Image in given path.
The image type is deduced from file extension. The default image encoder parameters are used. If you want to change encoding parameters, then use function EncodeIn with appropriate ImageEncoder.
| path | path and file name where to save image on filesystem |
| ImageException | when ImageEncoder throws |
| ImageException | when it is not possible convert image to raw data |
References AsRawImage().
|
inline |
Save Image in given ImageSaver.
| saver | specific ImageSaver to use to save file |
| ImageException | when ImageSaver throws |
References AsRawImage(), and ImageSaver::Save().
|
inlinenodiscard |
Returns image width.
Referenced by AsRawBGR(), AsRawBGRA(), AsRawGrayscale(), AsRawImage(), and ResizeToMaxDimension().