Skip to content

cvw::ImageBuilder

Factory class for loading images from disk in a specific format. More...

#include <image_builder.hpp>

Public Functions

Name
expected< Image<format_type>, LoadError >load(std::string_view path)
Loads an image from the given file path.

Detailed Description

cpp
template <is_pixel_format format_type>
class cvw::ImageBuilder;

Factory class for loading images from disk in a specific format.

Template Parameters:

  • format_type Desired pixel format tag.

Since: 1.0.0

Loads an image file and converts it to the requested pixel format. Returns an expected<Image, LoadError> to avoid exceptions.

cpp
cvw::ImageBuilder<cvw::Gray> builder;
auto result = builder.load("photo.jpg");
if (result) { auto& img = *result; }

Public Functions Documentation

function load

cpp
expected< Image<format_type>, LoadError > load(
    std::string_view path
)

Loads an image from the given file path.

Parameters:

  • path Filesystem path to the image file.

Exceptions:

  • None.

Return: Expected containing the loaded Image or a LoadError.

Since: 1.0.0

Reads the file using OpenCV, converts to the target pixel format, and returns the resulting Image.


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

Built with VitePress