IDS peak ICV v1.0.0
Loading...
Searching...
No Matches
Image Class Reference

#include <peak_icv/types/peak_icv_image.hpp>

Inheritance diagram for Image:
Collaboration diagram for Image:

Public Member Functions

 Image (const peak::common::IImageView &imageView)
 Constructs an Image from an IImageView Instance. This can be a buffer or a possibility to convert other libraries Images into this Image type.
 
 Image (const std::string &path)
 Constructs an Image from a file path.
 
 Image (const std::string &path, peak::common::PixelFormat name)
 Constructs an Image from a file path with forced pixel format.
 
 Image (peak::common::PixelFormat pixelFormat, uint8_t *buffer, size_t bufferSize, const peak::common::Size &imageSize)
 Constructs an Image from a buffer.
 
 Image (peak::common::PixelFormat pixelFormat, const peak::common::Size &imageSize)
 Constructs an Image with a given size and pixel format.
 
 Image (const Image &other)
 
 Image (Image &&other) noexcept
 
Image & operator= (const Image &other)
 
Image & operator= (Image &&other) noexcept
 
 ~Image () override
 
bool operator== (const Image &rhs) const
 
Image Copy () const
 Creates a deep copy of the current Image.
 
peak::common::Size GetSize () const
 Provides the size of the image.
 
uint8_t * GetData () const
 Provides a pointer to the image data buffer.
 
size_t GetSizeInBytes () const
 Provides the size of the image data in bytes.
 
size_t GetBytesPerLine () const
 Computes the number of bytes required to store one line of pixel data (no padding).
 
peak::common::PixelFormat GetPixelFormat () const
 Provides the pixel format of the image.
 
experimental::Region GetRegion () const
 Provides the region of the image.
 
void SetRegion (const experimental::Region &region) const
 Updates the region on the image.
 
void ResetRegion () const
 Resets the region on the image to the complete image.
 
template<typename DataType >
DataType * At (size_t x, size_t y) const
 Provides a pointer to the data at the specified coordinates.
 
peak::icv::Image ConvertPixelFormat (peak::common::PixelFormat pixelFormat) const
 Converts the image to a different pixel format.
 
void SetMetadata (const peak::common::Metadata &metadata)
 Updates the CaptureInformation of an image which is used to store and manage capture settings.
 
peak::common::Metadata GetMetadata () const
 Returns the CaptureInformation of an image which contains information about the image capture settings.
 
Image Subtract (const Image &subtrahend) const
 Subtracts the specified subtrahend image pixelwise from the current image and returns the resulting image.
 
Image operator- (const Image &subtrahend) const
 Subtracts the specified subtrahend image pixelwise from the current image and returns the resulting image.
 
Image Crop (const peak::common::Rectangle &rect) const
 Crops the image to the given rectangle.
 
Image Scale (const peak::common::Size &targetImageSize, const Interpolation &interpolation=Interpolation::NearestNeighbor) const
 Returns an image scaled to the given image size.
 

Detailed Description

For detailed information about the use of ids_peak_icv Image refer to the Image Guide.

Since
1.0

Definition at line 45 of file peak_icv_image.hpp.

Constructor & Destructor Documentation

◆ Image() [1/7]

Image ( const peak::common::IImageView & imageView)
inlineexplicit

Constructs an Image from an IImageView Instance. This can be a buffer or a possibility to convert other libraries Images into this Image type.

Parameters
imageViewAbstract Image source
Since
1.0

Definition at line 110 of file peak_icv_image.ipp.

◆ Image() [2/7]

Image ( const std::string & path)
inlineexplicit

Constructs an Image from a file path.

The following image formats are supported:

  • Portable Network Graphics (PNG)
  • Bitmap (BMP)
  • Joint Photographic Experts Group (JPEG)
  • Raw Binary Format (RAW)

Supported image and pixel formats

BMP (Bitmap)

 Not all pixel formats can be read from a Bitmap file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGBa8
 - BGR8
 - BGRa8

JPEG (Joint Photographic Experts Group)

 Not all pixel formats can be read from a JPEG file. Supported pixel formats are:

 - Mono8
 - RGB8

PNG (Portable Network Graphics)

 Not all pixel formats can be read from a PNG file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGB8
 - RGBa8

RAW (Raw Binary Format)

 Not all pixel formats can be read from a RAW file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGB8
 - RGBa8
 - BGR8
 - BGRa8
Parameters
pathThe file path to the image.
Since
1.0

Definition at line 117 of file peak_icv_image.ipp.

◆ Image() [3/7]

Image ( const std::string & path,
peak::common::PixelFormat name )
inlineexplicit

Constructs an Image from a file path with forced pixel format.

The pixel format to use is specified manually here. The function tries to interpret the file with the given format. If this isn't possible, an exception is thrown. Explicit conversion of image formats must be done manually.

The following image formats are supported:

  • Portable Network Graphics (PNG)
  • Bitmap (BMP)
  • Joint Photographic Experts Group (JPEG)
  • Tag Image File Format (TIFF)
  • Raw Binary Format (RAW)

Supported image and pixel formats

BMP (Bitmap)

 Not all pixel formats can be read from a Bitmap file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGBa8
 - BGR8
 - BGRa8

JPEG (Joint Photographic Experts Group)

 Not all pixel formats can be read from a JPEG file. Supported pixel formats are:

 - Mono8
 - RGB8

PNG (Portable Network Graphics)

 Not all pixel formats can be read from a PNG file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGB8
 - RGBa8

RAW (Raw Binary Format)

 Not all pixel formats can be read from a RAW file. Supported pixel formats are:

 - Mono8
 - Mono10
 - Mono12
 - RGB8
 - RGBa8
 - BGR8
 - BGRa8

TIFF (Tag Image File Format)

 Not all pixel formats can be read from a TIFF file. Supported pixel formats are:

 - Mono8
 - RGB8
 - Coord3D_C32f

Definition at line 121 of file peak_icv_image.ipp.

◆ Image() [4/7]

Image ( peak::common::PixelFormat pixelFormat,
uint8_t * buffer,
size_t bufferSize,
const peak::common::Size & imageSize )
inline

Constructs an Image from a buffer.

Parameters
pixelFormatThe pixel format of the image.
bufferThe buffer containing image data.
bufferSizeThe size of the buffer.
imageSizeThe size of the image.
Since
1.0

Definition at line 125 of file peak_icv_image.ipp.

◆ Image() [5/7]

Image ( peak::common::PixelFormat pixelFormat,
const peak::common::Size & imageSize )
inline

Constructs an Image with a given size and pixel format.

Parameters
pixelFormatThe pixel format of the image.
imageSizeThe size of the image.
Since
1.0

Definition at line 130 of file peak_icv_image.ipp.

◆ Image() [6/7]

Image ( const Image & other)
inline
Since
1.0

Definition at line 138 of file peak_icv_image.ipp.

◆ Image() [7/7]

Image ( Image && other)
inlinenoexcept
Since
1.0

Definition at line 149 of file peak_icv_image.ipp.

◆ ~Image()

~Image ( )
inlineoverride
Since
1.0

Definition at line 208 of file peak_icv_image.ipp.

Member Function Documentation

◆ At()

template<typename DataType >
DataType * At ( size_t x,
size_t y ) const
inline

Provides a pointer to the data at the specified coordinates.

Template Parameters
DataTypeThe type of the data to retrieve.
Parameters
xThe x-coordinate.
yThe y-coordinate.
Returns
A pointer to the data at the specified coordinates.
Since
1.0

Definition at line 358 of file peak_icv_image.hpp.

◆ ConvertPixelFormat()

Image ConvertPixelFormat ( peak::common::PixelFormat pixelFormat) const
inline

Converts the image to a different pixel format.

If the input image has the same pixel format as the specified pixel format parameter, the image will be copied.

Restrictions:

  • Conversion to Bayer formats is only supported from a bayer format with the same pattern, e.g. from BayerRG10p to BayerRG10 or BayerRG8.
  • Conversion to packed formats is not supported.
  • Conversions from RGB or BGR formats to RGBa or BGRa formats is not supported.
  • RGBa and BGRa formats support only conversions into different bit depths of the same channel layout or to Mono formats.
  • Confidence and Coord3D formats can only be converted to other bit depths of the same format type.
Note
For a full list of supported conversions see Supported Pixel Format Conversions
Parameters
pixelFormatThe target pixel format.
Returns
A new Image with the target pixel format.
Since
1.0

Definition at line 327 of file peak_icv_image.ipp.

◆ Copy()

Image Copy ( ) const
inline

Creates a deep copy of the current Image.

Returns
The copied image.
Since
1.0

Definition at line 242 of file peak_icv_image.ipp.

◆ Crop()

Image Crop ( const peak::common::Rectangle & rect) const
inline

Crops the image to the given rectangle.

Returns
The cropped image.
Exceptions
OutOfRangeExceptionThe given rectangle is (partly) outside the image.
Since
1.0

Definition at line 389 of file peak_icv_image.ipp.

◆ GetBytesPerLine()

size_t GetBytesPerLine ( ) const
inline

Computes the number of bytes required to store one line of pixel data (no padding).

This returns the exact number of bytes used for one scanline of pixel data based on the image's width, number of channels, and bits per pixel.

Returns
Number of bytes per line of pixel data.
Since
1.0

Definition at line 268 of file peak_icv_image.ipp.

◆ GetData()

uint8_t * GetData ( ) const
inline

Provides a pointer to the image data buffer.

Returns
A pointer to the image data buffer.
Since
1.0

Definition at line 258 of file peak_icv_image.ipp.

◆ GetMetadata()

peak::common::Metadata GetMetadata ( ) const
inline

Returns the CaptureInformation of an image which contains information about the image capture settings.

Returns
The CaptureInformation of the image
Warning
This function is still in development and not released.

Definition at line 349 of file peak_icv_image.ipp.

◆ GetPixelFormat()

peak::common::PixelFormat GetPixelFormat ( ) const
inline

Provides the pixel format of the image.

Returns
The pixel format of the image.
Since
1.0

Definition at line 278 of file peak_icv_image.ipp.

◆ GetRegion()

experimental::Region GetRegion ( ) const
inline

Provides the region of the image.

Returns
The region of the image.
Warning
This function is still in development and not released.

Definition at line 301 of file peak_icv_image.ipp.

◆ GetSize()

peak::common::Size GetSize ( ) const
inline

Provides the size of the image.

Returns
The size of the image.
Since
1.0

Definition at line 253 of file peak_icv_image.ipp.

◆ GetSizeInBytes()

size_t GetSizeInBytes ( ) const
inline

Provides the size of the image data in bytes.

Returns
The size of the image data in bytes.
Since
1.0

Definition at line 263 of file peak_icv_image.ipp.

◆ operator-()

Image operator- ( const Image & subtrahend) const
inline

Subtracts the specified subtrahend image pixelwise from the current image and returns the resulting image.

This function performs a pixelwise subtraction of the given subtrahend image from the current image. The resulting image is returned as a new Image object. The operation requires that both images have the same pixel format and dimensions.

Parameters
subtrahendThe image to subtract from the current image.
Returns
The resulting image after pixelwise subtraction.
Warning
This function is still in development and not released.

Definition at line 384 of file peak_icv_image.ipp.

◆ operator=() [1/2]

Image & operator= ( const Image & other)
inline
Since
1.0

Definition at line 159 of file peak_icv_image.ipp.

◆ operator=() [2/2]

Image & operator= ( Image && other)
inlinenoexcept
Since
1.0

Definition at line 185 of file peak_icv_image.ipp.

◆ operator==()

bool operator== ( const Image & rhs) const
inline
Since
1.0

Definition at line 216 of file peak_icv_image.ipp.

◆ ResetRegion()

void ResetRegion ( ) const
inline

Resets the region on the image to the complete image.

Warning
This function is still in development and not released.

Definition at line 320 of file peak_icv_image.ipp.

◆ Scale()

Image Scale ( const peak::common::Size & targetImageSize,
const Interpolation & interpolation = Interpolation::NearestNeighbor ) const
inline

Returns an image scaled to the given image size.

Internally the scale factors are computed as follows:

  • Horizontal scale factor (X-axis) = Image width / Size width
  • Vertical scale factor (Y-axis) = Image height / Size height

These factors determine how the input image is resized to match the desired output dimensions.

Parameters
targetImageSizeThe image size to which the original image is scaled.
interpolationThe interpolation method used to scale the image.
Returns
The scaled image.
Exceptions
NotPossibleExceptionThe given targetImageSize is empty (i.e. width × height == 0).
NotSupportedExceptionThe interpolation method is not supported.
Since
1.0

Definition at line 400 of file peak_icv_image.ipp.

◆ SetMetadata()

void SetMetadata ( const peak::common::Metadata & metadata)
inline

Updates the CaptureInformation of an image which is used to store and manage capture settings.

Parameters
metadataCaptureInformation to be updated
Warning
This function is still in development and not released.

Definition at line 338 of file peak_icv_image.ipp.

◆ SetRegion()

void SetRegion ( const experimental::Region & region) const
inline

Updates the region on the image.

Sets a region of interest (ROI) for the specified image handle, which defines a sub-area of the image where operations or analyses are focused. Any points in the region that fall outside the bounds of the image are automatically discarded (clipped).

Parameters
regionRegion to update
Warning
This function is still in development and not released.

Definition at line 311 of file peak_icv_image.ipp.

◆ Subtract()

Image Subtract ( const Image & subtrahend) const
inline

Subtracts the specified subtrahend image pixelwise from the current image and returns the resulting image.

This function performs a pixelwise subtraction of the given subtrahend image from the current image. The resulting image is returned as a new Image object. The operation requires that both images have the same pixel format and dimensions.

Parameters
subtrahendThe image to subtract from the current image.
Returns
The resulting image after pixelwise subtraction.
Warning
This function is still in development and not released.

Definition at line 372 of file peak_icv_image.ipp.