cvw::detail
Internal validation helpers used by algorithm implementations. More...
Functions
| Name | |
|---|---|
| template <is_pixel_format F> auto | check_non_empty(constImage<F> & img) Validates that an Image is not empty. |
| template <is_pixel_format F> auto | check_non_empty(constImageView<F> & view) Validates that an ImageView is not empty. |
| auto | require_odd(int k) Validates that a kernel size is a positive odd integer. |
| auto | require_positive_dim(int w, int h) Validates that width and height are both positive. |
| template <is_pixel_format F> constexprint | imread_flag() Resolves the OpenCV imread flag for a given pixel format. |
| template <typename T > constexprint | cv_depth() Maps a C++ scalar type to the corresponding OpenCV depth flag. |
| template <is_pixel_format F> constexprint | cv_type() Computes the full OpenCV type flag for a pixel format. |
| template <typename Src ,typename Dst > constevalint | cvt_color_code() Resolves the OpenCV color conversion code at compile time. |
| auto | make_pipeline_impl() Base case: returns an identity step wrapping the input. |
| template <typename First ,typename... Rest> auto | make_pipeline_impl(First && first, Rest &&... rest) Recursive case: composes a step with the tail pipeline. |
Detailed Description
Internal validation helpers used by algorithm implementations.
Internal helpers for make_pipeline.
Internal helpers for Image implementation.
Internal helpers for image loading.
Functions Documentation
function check_non_empty
template <is_pixel_format F>
inline auto check_non_empty(
constImage<F> & img
)Validates that an Image is not empty.
Parameters:
- img Image to validate.
Template Parameters:
- F Pixel format tag.
Return: Success if non-empty, otherwise AlgorithmError::EmptyInput.
Since: 1.0.0
function check_non_empty
template <is_pixel_format F>
inline auto check_non_empty(
constImageView<F> & view
)Validates that an ImageView is not empty.
Parameters:
- view View to validate.
Template Parameters:
- F Pixel format tag.
Return: Success if non-empty, otherwise AlgorithmError::EmptyInput.
Since: 1.0.0
function require_odd
inline auto require_odd(
int k
)Validates that a kernel size is a positive odd integer.
Parameters:
- k Kernel size parameter.
Return: Success if valid, otherwise AlgorithmError::InvalidParameter.
Since: 1.0.0
function require_positive_dim
inline auto require_positive_dim(
int w,
int h
)Validates that width and height are both positive.
Parameters:
- w Width to validate. Unit: pixels.
- h Height to validate. Unit: pixels.
Return: Success if both positive, otherwise AlgorithmError::InvalidParameter.
Since: 1.0.0
function imread_flag
template <is_pixel_format F>
constexprint imread_flag()Resolves the OpenCV imread flag for a given pixel format.
Template Parameters:
- F Target pixel format tag.
Return: OpenCV imread flag constant.
Since: 1.0.0
Selects the appropriate loading mode (grayscale, unchanged, color) based on the target format.
function cv_depth
template <typename T>
constexprint cv_depth()Maps a C++ scalar type to the corresponding OpenCV depth flag.
Exceptions:
- Compile-time error for unsupported types.
Template Parameters:
- T Scalar type (uint8_t, uint16_t, float, double).
Return: OpenCV depth constant (CV_8U, CV_16U, CV_32F, CV_64F).
Since: 1.0.0
function cv_type
template <is_pixel_format F>
constexprint cv_type()Computes the full OpenCV type flag for a pixel format.
Template Parameters:
- F Pixel format tag.
Return: OpenCV type constant (e.g., CV_8UC3).
Since: 1.0.0
Combines the depth and channel count into a CV_MAKETYPE value.
function cvt_color_code
template <typename Src ,
typename Dst >
constevalint cvt_color_code()Resolves the OpenCV color conversion code at compile time.
Template Parameters:
- Src Source pixel format.
- Dst Destination pixel format.
Return: Color conversion code.
Since: 1.0.0
Returns -1 when no color conversion is needed (same family), -2 for unsupported conversions, or a valid cv::COLOR_* constant.
function make_pipeline_impl
inline auto make_pipeline_impl()Base case: returns an identity step wrapping the input.
Return: A callable that wraps the input in a successful Expected.
Since: 1.0.0
function make_pipeline_impl
template <typename First ,
typename... Rest>
auto make_pipeline_impl(
First && first,
Rest &&... rest
)Recursive case: composes a step with the tail pipeline.
Parameters:
- first First step callable.
- rest Remaining step callables.
Template Parameters:
- First Type of the first step.
- Rest Types of remaining steps.
Return: A callable that applies all steps sequentially with error propagation.
Since: 1.0.0
Updated on 2026-05-17 at 13:22:38 +0000