Enrollment 28.2.0
Loading...
Searching...
No Matches

Image resampler for DPI-change operations, including upsampling and downsampling using NIST-compliant resampling algorithm provided by NFIR library. More...

#include <Image.h>

Collaboration diagram for Image::NISTImageResampler:

Public Types

enum class  InterpolationMethod : uint8_t { BICUBIC , BILINEAR }
 Enum defines possible types of interpolation methods to apply during image resampling. More...
enum class  FilterType : uint8_t { GAUSSIAN , IDEAL }
 Enum defines possible types of filtering methods to apply before image resampling. More...

Public Member Functions

 NISTImageResampler (ImageDpi targetDpi)
 Constructs a NIST-compliant image resampler for a target DPI.
 NISTImageResampler (ImageDpi targetDpi, InterpolationMethod interpolationMethod, FilterType filterType)
 Constructs a NIST-compliant image resampler for a target DPI using a custom interpolation method and filter.
std::shared_ptr< Image > Resample (const inno::Image &image) const final
 Resample image to a target DPI using NIST resamling algorithm.

Protected Member Functions

ImageDpi GetDpi () const
 Retrieves target DPI of the resampler.

Detailed Description

Image resampler for DPI-change operations, including upsampling and downsampling using NIST-compliant resampling algorithm provided by NFIR library.

Member Enumeration Documentation

◆ FilterType

enum class FilterType : uint8_t
strong

Enum defines possible types of filtering methods to apply before image resampling.

Enumerator
GAUSSIAN 

Apply a Gaussian filter for smoothing.

IDEAL 

Apply an ideal filter for sharpness.

◆ InterpolationMethod

enum class InterpolationMethod : uint8_t
strong

Enum defines possible types of interpolation methods to apply during image resampling.

Enumerator
BICUBIC 

Apply bicubic interpolation.

BILINEAR 

Apply bilinear interpolation.

Constructor & Destructor Documentation

◆ NISTImageResampler() [1/2]

NISTImageResampler ( ImageDpi targetDpi)
inlineexplicit

Constructs a NIST-compliant image resampler for a target DPI.

This constructor initializes the image resampler to resample an image to the specified DPI using a NIST-compliant resampling algorithm with default interpolation and filtering settings.

Note
It is recommended to explicitly specify the interpolation method and filter type by using the constructor NISTImageResampler(ImageDpi targetDpi, InterpolationMethod interpolationMethod, FilterType filterType) rather than relying on the default settings. The best settings for your use case are likely to be determined through trial and error.
Parameters
targetDpiThe DPI (dots per inch) of the new image.
Exceptions
EnrollmentInvalidArgumentExceptionwhen targetDpi is 0

References Image::ImageResampler::ImageResampler().

Here is the call graph for this function:

◆ NISTImageResampler() [2/2]

NISTImageResampler ( ImageDpi targetDpi,
InterpolationMethod interpolationMethod,
FilterType filterType )
inline

Constructs a NIST-compliant image resampler for a target DPI using a custom interpolation method and filter.

This constructor initializes the image resampler to resample an image to the specified DPI using a NIST-compliant resampling algorithm and the provided interpolation and filtering methods.

Depending on the resize factor, the optimal configuration of the filter type and interpolation method for achieving the best extraction accuracy was experimentally determined, as shown in the table below:

Source DPI Interpolation Method Filter Type
600 Bicubic Ideal
1000 Bilinear Ideal
1200 Bilinear Gaussian
Other Bicubic Ideal

This is also the default behavior of a resampler constructed using NISTImageResampler(ImageDpi targetDpi).

Note
It is recommended to explicitly specify the interpolation method and downsampling filter mask rather than relying on the default settings. The best settings for your use case are likely to be determined through trial and error.
Parameters
targetDpiThe DPI (dots per inch) of the new image.
interpolationMethodThe interpolation method to be applied during resampling.
filterTypeThe type of filtering to be applied before resampling.
Exceptions
EnrollmentInvalidArgumentExceptionwhen targetDpi is 0

References BICUBIC, BILINEAR, GAUSSIAN, IDEAL, and Image::ImageResampler::ImageResampler().

Here is the call graph for this function:

Member Function Documentation

◆ GetDpi()

ImageDpi GetDpi ( ) const
inlinenodiscardprotectedinherited

Retrieves target DPI of the resampler.

Returns
The target DPI (dots per inch) of the resampler

Referenced by Image::AreaImageResampler::Resample(), Image::BicubicImageResampler::Resample(), and Image::NISTImageResampler::Resample().

Here is the caller graph for this function:

◆ Resample()

std::shared_ptr< Image > Resample ( const inno::Image & image) const
inlinenodiscardfinalvirtual

Resample image to a target DPI using NIST resamling algorithm.

It creates new image as result of resampling with factor target DPI/original DPI.

Parameters
imageImage to resize.
Returns
image with given DPI
Exceptions
ImageExceptionwhen there is an processing error
EnrollmentInvalidArgumentExceptionwhen the image is not single-channel grayscale

Implements Image::ImageResampler.

References Image::ImageResampler::GetDpi().

Here is the call graph for this function:

The documentation for this class was generated from the following file: