Realm

oa::image::cvt_color

Convert an FP32 image between color spaces following cvtColor. The conversion code owns the color-space contract, matching OpenCV’s COLOR_* pairs: channel-ordered inputs admit the Rgb/Bgr sources and Gray admits the gray sources. The output carries Gray for luminance results, Rgb for gray-to-color results, and the input format otherwise; the color-space interpretation of three-channel results follows the conversion code exactly as it does for cv::Mat. HSV keeps OpenCV’s F32 ranges (H [0, 360], S/V [0, 1]); Lab uses the D65 XYZ intermediate (L [0, 100], a/b signed); YCrCb applies the F32 0.5 chroma offset. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and the source channel count matches the conversion.

FnRust public API

Function Documentation

pub fn cvt_color( input: &Image, conversion: ColorConversion ) -> Result<Image>
Convert an FP32 image between color spaces following cvtColor. The conversion code owns the color-space contract, matching OpenCV’s COLOR_* pairs: channel-ordered inputs admit the Rgb/Bgr sources and Gray admits the gray sources. The output carries Gray for luminance results, Rgb for gray-to-color results, and the input format otherwise; the color-space interpretation of three-channel results follows the conversion code exactly as it does for cv::Mat. HSV keeps OpenCV’s F32 ranges (H [0, 360], S/V [0, 1]); Lab uses the D65 XYZ intermediate (L [0, 100], a/b signed); YCrCb applies the F32 0.5 chroma offset. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and the source channel count matches the conversion.