Skip to content

cvw::steps

Namespace containing step factory functions for pipeline composition. More...

Functions

Name
autoresize(int width, int height, int interpolation =cv::INTER_LINEAR)
Creates a resize step with the given dimensions.
autoflip(int axis)
Creates a flip step along the given axis.
autorotate(double angle, bool expand =false)
Creates a rotation step.
autoto_gray()
Creates a BGR-to-Gray conversion step.
autoto_gray_rgb()
Creates an RGB-to-Gray conversion step.
autoto_bgr()
Creates a Gray-to-BGR conversion step.
autoyuyv_to_gray()
Creates a YUYV-to-Gray conversion step.
autogaussian_blur(int kernel_size, double sigma =0.0)
Creates a Gaussian blur step.
template <is_pixel_format F&gt;
auto
median_blur(int kernel_size)
Creates a median blur step for single-channel images.
autocanny(double lo, double hi, int aperture =3)
Creates a Canny edge detection step.
autosobel(int dx, int dy, int kernel_size =3)
Creates a Sobel derivative step.
autothreshold(double thresh, double max_val, int type =cv::THRESH_BINARY)
Creates a global threshold step.
autoadaptive_threshold(int block_size, double C, int method =cv::ADAPTIVE_THRESH_GAUSSIAN_C)
Creates an adaptive threshold step.
autonormalize(float min_val =0.0f, float max_val =1.0f)
Creates a min-max normalization step.
autosave(std::string path)
Creates a save-to-file sink step.

Detailed Description

Namespace containing step factory functions for pipeline composition.

Each factory returns a callable that accepts an Image or Expected and returns an Expected with automatic error propagation.

Functions Documentation

function resize

cpp
inline auto resize(
    int width,
    int height,
    int interpolation =cv::INTER_LINEAR
)

Creates a resize step with the given dimensions.

Parameters:

  • width Target width in pixels. Must be positive.
  • height Target height in pixels. Must be positive.
  • interpolation OpenCV interpolation flag. Default: LINEAR.

Return: A callable step that resizes an image.

Since: 1.0.0

function flip

cpp
inline auto flip(
    int axis
)

Creates a flip step along the given axis.

Parameters:

  • axis Flip axis (0 = vertical, 1 = horizontal, -1 = both).

Return: A callable step that flips an image.

Since: 1.0.0

function rotate

cpp
inline auto rotate(
    double angle,
    bool expand =false
)

Creates a rotation step.

Parameters:

  • angle Rotation angle in degrees. Positive = counter-clockwise.
  • expand Whether to expand the output to hold the full rotated image. Default: false.

Return: A callable step that rotates an image.

Since: 1.0.0

function to_gray

cpp
inline auto to_gray()

Creates a BGR-to-Gray conversion step.

Return: A callable step converting Image<BGR> to Image<Gray>.

Since: 1.0.0

function to_gray_rgb

cpp
inline auto to_gray_rgb()

Creates an RGB-to-Gray conversion step.

Return: A callable step converting Image<RGB> to Image<Gray>.

Since: 1.0.0

function to_bgr

cpp
inline auto to_bgr()

Creates a Gray-to-BGR conversion step.

Return: A callable step converting Image<Gray> to Image<BGR>.

Since: 1.0.0

function yuyv_to_gray

cpp
inline auto yuyv_to_gray()

Creates a YUYV-to-Gray conversion step.

Return: A callable step converting ImageView<YUYV> to Image<Gray>.

Since: 1.0.0

function gaussian_blur

cpp
inline auto gaussian_blur(
    int kernel_size,
    double sigma =0.0
)

Creates a Gaussian blur step.

Parameters:

  • kernel_size Side length of the square kernel. Must be odd and positive. Unit: pixels.
  • sigma Standard deviation. 0.0 means computed from kernel size. Default: 0.0.

Return: A callable step that applies Gaussian blur.

Since: 1.0.0

function median_blur

cpp
template <is_pixel_format F>
inline auto median_blur(
    int kernel_size
)

Creates a median blur step for single-channel images.

Parameters:

  • kernel_size Side length of the square kernel. Must be odd. Unit: pixels.

Template Parameters:

  • F Pixel format with exactly 1 channel.

Return: A callable step that applies median blur.

Since: 1.0.0

function canny

cpp
inline auto canny(
    double lo,
    double hi,
    int aperture =3
)

Creates a Canny edge detection step.

Parameters:

  • lo Lower hysteresis threshold.
  • hi Upper hysteresis threshold.
  • aperture Aperture size for the Sobel operator. Default: 3.

Return: A callable step that applies Canny edge detection.

Since: 1.0.0

function sobel

cpp
inline auto sobel(
    int dx,
    int dy,
    int kernel_size =3
)

Creates a Sobel derivative step.

Parameters:

  • dx Order of the x-derivative.
  • dy Order of the y-derivative.
  • kernel_size Aperture size. Default: 3.

Return: A callable step that computes Sobel derivatives.

Since: 1.0.0

function threshold

cpp
inline auto threshold(
    double thresh,
    double max_val,
    int type =cv::THRESH_BINARY
)

Creates a global threshold step.

Parameters:

  • thresh Threshold value.
  • max_val Maximum value for THRESH_BINARY. Default: 0.
  • type OpenCV threshold type. Default: THRESH_BINARY.

Return: A callable step that applies thresholding.

Since: 1.0.0

function adaptive_threshold

cpp
inline auto adaptive_threshold(
    int block_size,
    double C,
    int method =cv::ADAPTIVE_THRESH_GAUSSIAN_C
)

Creates an adaptive threshold step.

Parameters:

  • block_size Size of the local neighborhood. Must be odd >= 3. Unit: pixels.
  • C Constant subtracted from the mean. May be negative.
  • method Adaptive method. Default: ADAPTIVE_THRESH_GAUSSIAN_C.

Return: A callable step that applies adaptive thresholding.

Since: 1.0.0

function normalize

cpp
inline auto normalize(
    float min_val =0.0f,
    float max_val =1.0f
)

Creates a min-max normalization step.

Parameters:

  • min_val Lower bound of the output range. Default: 0.0f.
  • max_val Upper bound of the output range. Default: 1.0f.

Return: A callable step normalizing Image<Gray> to Image<Float1>.

Since: 1.0.0

function save

cpp
inline auto save(
    std::string path
)

Creates a save-to-file sink step.

Parameters:

  • path Output file path.

Return: A callable step that saves an image and returns expected<void, AlgorithmError>.

Since: 1.0.0


Updated on 2026-05-17 at 13:22:38 +0000

Built with VitePress