Image resampler for DPI-change operations, including upsampling and downsampling using NIST-compliant resampling algorithm provided by NFIR library.
More...
#include <Image.h>
Image resampler for DPI-change operations, including upsampling and downsampling using NIST-compliant resampling algorithm provided by NFIR library.
◆ FilterType
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 defines possible types of interpolation methods to apply during image resampling.
| Enumerator |
|---|
| BICUBIC | Apply bicubic interpolation.
|
| BILINEAR | Apply bilinear interpolation.
|
◆ 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
-
| targetDpi | The DPI (dots per inch) of the new image. |
- Exceptions
-
| EnrollmentInvalidArgumentException | when targetDpi is 0 |
References Image::ImageResampler::ImageResampler().
◆ NISTImageResampler() [2/2]
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
-
| targetDpi | The DPI (dots per inch) of the new image. |
| interpolationMethod | The interpolation method to be applied during resampling. |
| filterType | The type of filtering to be applied before resampling. |
- Exceptions
-
| EnrollmentInvalidArgumentException | when targetDpi is 0 |
References BICUBIC, BILINEAR, GAUSSIAN, IDEAL, and Image::ImageResampler::ImageResampler().
◆ GetDpi()
|
|
inlinenodiscardprotectedinherited |
◆ 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
-
- Returns
- image with given DPI
- Exceptions
-
| ImageException | when there is an processing error |
| EnrollmentInvalidArgumentException | when the image is not single-channel grayscale |
Implements Image::ImageResampler.
References Image::ImageResampler::GetDpi().
The documentation for this class was generated from the following file: