ClikaRT::processor::ImageProcessorConfig
class
Header: ClikaRT/processor/config.h
Settable configuration for an ImageProcessor (convert-rgb → resize → center-crop → rescale → normalize → pad). Default-constructed to the documented HuggingFace defaults (resize + rescale by 1/255 + normalize on; crop + pad off); tune with the fluent setters, or round-trip a preprocessor_config.json through from_json / to_json. Move-only.
Static member functions
from_json()
static ImageProcessorConfig from_json(std::string_view text)
Parse a config from preprocessor_config.json text (flat, or nesting an "image_processor" block). Malformed text raises ClikaRT::Error.
The accepted schema is ClikaRT's own canonical config: the HuggingFace preprocessing keys plus the ClikaRT extension keys (target_dtype, resize_before_cast). Two semantics to be aware of when feeding it a HuggingFace-authored file:
- A missing key takes ClikaRT's documented default (this class's default-constructed state), NOT the per-processor-class default the HuggingFace
image_processor_typewould imply. Fields a HuggingFace class hardcodes rather than serializes must be set explicitly. - A key outside the accepted schema is ignored for the parse but logged as a warning naming it, so a mis-spelled or unsupported key is a visible diagnostic, never a silently different pipeline.
Declared in ClikaRT/processor/config.h, line 72
Member functions
ImageProcessorConfig()
ImageProcessorConfig()
A default configuration, usable with no config file.
Declared in ClikaRT/processor/config.h, line 50
ImageProcessorConfig(ImageProcessorConfig)
ImageProcessorConfig(ImageProcessorConfig&&) noexcept
move-construct (the source becomes an empty shell)
Declared in ClikaRT/processor/config.h, line 51
operator=(ImageProcessorConfig)
ImageProcessorConfig& operator=(ImageProcessorConfig&&) noexcept
move-assign (the source becomes an empty shell)
Declared in ClikaRT/processor/config.h, line 52
ImageProcessorConfig(ImageProcessorConfig)
ImageProcessorConfig(const ImageProcessorConfig&)
copy-construct: a DEEP copy (independent settings)
Declared in ClikaRT/processor/config.h, line 53
operator=(ImageProcessorConfig)
ImageProcessorConfig& operator=(const ImageProcessorConfig&)
copy-assign: a deep copy
Declared in ClikaRT/processor/config.h, line 54
~ImageProcessorConfig()
~ImageProcessorConfig()
destructor
Declared in ClikaRT/processor/config.h, line 55
to_json()
std::string to_json(int indent = 2) const
Serialize to preprocessor_config.json text (indent < 0 = compact), ClikaRT's canonical form, with every field (defaults included) materialized. Every field round-trips through from_json. Infallible.
Declared in ClikaRT/processor/config.h, line 78
resize_shortest_edge(int64_t)
ImageProcessorConfig& resize_shortest_edge(std::int64_t edge)
Resize the shortest edge to edge, preserving aspect (turns resize on).
Declared in ClikaRT/processor/config.h, line 83
resize_shortest_edge(int64_t, int64_t)
ImageProcessorConfig& resize_shortest_edge(std::int64_t edge, std::int64_t longest_cap)
Resize the shortest edge to edge and cap the longest at longest_cap (the DETR-style aspect-preserving fit; turns resize on).
Declared in ClikaRT/processor/config.h, line 86
resize_to()
ImageProcessorConfig& resize_to(std::int64_t height, std::int64_t width)
Resize to an exact height×width (turns resize on).
Declared in ClikaRT/processor/config.h, line 88
set_do_resize()
ImageProcessorConfig& set_do_resize(bool on)
resize step on/off (the resize_* setters turn it on)
Declared in ClikaRT/processor/config.h, line 89
resample(ImageResample)
ImageProcessorConfig& resample(ImageResample mode)
The resize resampling filter (PIL vocabulary). Default bicubic.
Declared in ClikaRT/processor/config.h, line 91
resample(ImageResample, bool)
ImageProcessorConfig& resample(ImageResample mode, bool antialias)
Filter + antialias in one call (the resize quality pair): mode picks the filter, antialias the smoothing.
Declared in ClikaRT/processor/config.h, line 94
set_antialias()
ImageProcessorConfig& set_antialias(bool on)
Antialiased resize on/off. Default ON, the PIL behavior every HuggingFace image processor exhibits; turn off only to trade fidelity for speed on large downscales.
Declared in ClikaRT/processor/config.h, line 98
center_crop_to()
ImageProcessorConfig& center_crop_to(std::int64_t height, std::int64_t width)
Center-crop to height×width (turns crop on).
Declared in ClikaRT/processor/config.h, line 100
set_do_center_crop()
ImageProcessorConfig& set_do_center_crop(bool on)
center-crop step on/off (center_crop_to turns it on)
Declared in ClikaRT/processor/config.h, line 101
pad_to()
ImageProcessorConfig& pad_to(std::int64_t height, std::int64_t width)
Pad (detection-style) bottom/right with zeros to height×width (turns pad on).
Declared in ClikaRT/processor/config.h, line 104
set_do_pad()
ImageProcessorConfig& set_do_pad(bool on)
pad step on/off (pad_to turns it on)
Declared in ClikaRT/processor/config.h, line 105
rescale_by()
ImageProcessorConfig& rescale_by(double factor)
Scale pixel values by factor (e.g. 1/255). Turns rescale on.
Declared in ClikaRT/processor/config.h, line 107
set_do_rescale()
ImageProcessorConfig& set_do_rescale(bool on)
rescale step on/off (rescale_by turns it on)
Declared in ClikaRT/processor/config.h, line 108
normalize()
ImageProcessorConfig& normalize(ClikaRT::Span<const float> mean, ClikaRT::Span<const float> std)
Per-channel normalization (subtract mean, divide by std). mean/std are length 1 or 3; turns normalize on. The spans are read during the call.
Declared in ClikaRT/processor/config.h, line 111
set_do_normalize()
ImageProcessorConfig& set_do_normalize(bool on)
normalize step on/off (normalize turns it on)
Declared in ClikaRT/processor/config.h, line 112
set_do_convert_rgb()
ImageProcessorConfig& set_do_convert_rgb(bool on)
force 1/4-channel input to RGB before the pipeline (default on)
Declared in ClikaRT/processor/config.h, line 113
set_target_dtype()
ImageProcessorConfig& set_target_dtype(DataType dtype)
The dtype the pipeline produces (and works in for rescale/normalize). The loaded image is cast to it exactly once, or not at all when it already matches. Default Float32.
Declared in ClikaRT/processor/config.h, line 117
set_resize_before_cast()
ImageProcessorConfig& set_resize_before_cast(bool on)
Resize/crop in the LOADED dtype and cast to target_dtype afterward, the HuggingFace/PIL order (default true). Set false to cast to target_dtype FIRST and resize in that dtype: the portable path for a device whose resize kernel does not cover the loaded integer dtype.
Declared in ClikaRT/processor/config.h, line 122
do_resize()
bool do_resize() const
whether the resize step runs (default on)
Declared in ClikaRT/processor/config.h, line 125
resample()
ImageResample resample() const
The resampling filter. A config whose PIL code has no filter here (e.g. LANCZOS) reads back Bicubic, the filter the pipeline actually runs.
Declared in ClikaRT/processor/config.h, line 128
antialias()
bool antialias() const
whether resize antialiases (default on)
Declared in ClikaRT/processor/config.h, line 129
do_center_crop()
bool do_center_crop() const
whether center-crop runs (default off)
Declared in ClikaRT/processor/config.h, line 130
do_rescale()
bool do_rescale() const
whether rescale runs (default on)
Declared in ClikaRT/processor/config.h, line 131
rescale_factor()
double rescale_factor() const
the rescale multiplier (default 1/255)
Declared in ClikaRT/processor/config.h, line 132
do_normalize()
bool do_normalize() const
whether normalize runs (default on)
Declared in ClikaRT/processor/config.h, line 133
do_convert_rgb()
bool do_convert_rgb() const
whether RGB conversion runs (default on)
Declared in ClikaRT/processor/config.h, line 134
do_pad()
bool do_pad() const
whether detection-pad runs (default off)
Declared in ClikaRT/processor/config.h, line 135
target_dtype()
DataType target_dtype() const
the pipeline output/work dtype (default Float32)
Declared in ClikaRT/processor/config.h, line 136
resize_before_cast()
bool resize_before_cast() const
whether geometry runs before the dtype cast (default true)
Declared in ClikaRT/processor/config.h, line 137