image.commerce

    MoonBit commerce scene entry: crop, color, enhance, watermark, barcode, quality.

    Download zip
    Author
    Version
    0.1.32
    License
    MIT
    Last updated
    14 minutes ago
    Downloads
    17

    #walkzzz/image.commerce

    电商场景入口(S16):商品主图/详情页常见的裁切、调色、增强、水印、码图与画质评估,一次 import 全拿到。

    moon add walkzzz/image.commerce

    import "walkzzz/image.commerce"
    // 之后直接写 @commerce.<符号>;符号清单见本包 pkg.generated.mbti

    #再导出了什么

    原子包提供
    walkzzz/image.process/transform缩略图裁切、缩放、旋转、拼接
    walkzzz/image.process/color白平衡、饱和度、曲线等调色
    walkzzz/image.process/enhance锐化、降噪、去雾等增强
    walkzzz/image.codec/barcode商品码/二维码与条码生成、识别
    walkzzz/image.domain/watermark可见/半透明水印叠加与检测
    walkzzz/image.photography/quality画质评估(清晰度/曝光/噪点打分)

    #约定

    • 本包只有 pub using 再导出,没有实现;moon.pkg 与 commerce_scene.mbt 由 scripts/gen_scenes.mjs 生成,请勿手改。
    • 归属真值在仓库的 docs/scenes.json。
    • 批量化(几百张主图)建议走 image.media 的流水线编排,单图处理用本入口即可。

    #文档

    • 场景总览:https://github.com/walkzzz/image.mbt/blob/main/docs/scenes.md
    • 使用说明:https://github.com/walkzzz/image.mbt/blob/main/docs/notes.md
    • 完整签名以本包 pkg.generated.mbti 为准。

    AffineMatrix

    2×3 仿射变换矩阵 (a, b, c, d, e, f) 正向仿射变换 x' = ax + by + c 正向仿射变换 y' = dx + ey + f

    BarcodeConfig

    条形码识别配置

    BarcodeResult

    条形码识别结果

    BarcodeType

    条形码类型 #non_exhaustive 表示未来可能添加新构造器

    Code128Charset

    Code128 字符集类型

    Colormap

    色彩映射预设 #non_exhaustive 表示未来可能添加新构造器

    DehazeConfig

    去雾配置

    DenoiseAlgorithm

    降噪算法类型 #non_exhaustive 表示未来可能添加新构造器

    DenoiseConfig

    降噪配置

    DenoiseResult

    降噪结果

    EnhancementAlgorithm

    增强算法类型 #non_exhaustive 表示未来可能添加新构造器

    EnhancementResult

    增强结果

    InpaintConfig

    图像修复配置

    NlmConfig

    非局部均值去噪配置

    NoiseType

    噪声类型 #non_exhaustive 表示未来可能添加新构造器

    PerspectiveMatrix

    3×3 透视变换矩阵 (m00, m01, m02, m10, m11, m12, m20, m21, m22)

    QrDecodeResult

    QR Code 解码结果

    QrFinderPattern

    QR Code 定位图案(Finder Pattern)

    QualityMetrics

    图像质量评估结果

    WatermarkConfig

    水印配置

    adaptive_threshold_gaussian

    fn adaptive_threshold_gaussian(img :
    core
    /types.Image, block_size : Int, c : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    自适应阈值(高斯加权法)。以每个像素周围 block_size×block_size 区域的高斯加权均值减去 C 作为局部阈值。

    adaptive_threshold_gaussian_16

    fn adaptive_threshold_gaussian_16(img :
    core
    /types.Image16, block_size : Int, c : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 自适应阈值(高斯加权法)。 @see adaptive_threshold_gaussian 8-bit 版本,本函数为 Image16 变体

    adaptive_threshold_gaussian_f

    fn adaptive_threshold_gaussian_f(img :
    core
    /types.ImageF, block_size : Int, c : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 自适应阈值(高斯加权法)。 @see adaptive_threshold_gaussian 8-bit 版本,本函数为 ImageF 变体

    adaptive_threshold_mean

    fn adaptive_threshold_mean(img :
    core
    /types.Image, block_size : Int, c : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    自适应阈值(均值法)。以每个像素周围 block_size×block_size 区域的均值减去 C 作为局部阈值。 仅处理灰度图(channels=1)或 RGB 图(channels=3/4),alpha 通道不变。

    adaptive_threshold_mean_16

    fn adaptive_threshold_mean_16(img :
    core
    /types.Image16, block_size : Int, c : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 自适应阈值(均值法)。block_size 必须为 >=3 的奇数。 输出二值图像(0 或 65535),alpha 通道不变。 @see adaptive_threshold_mean 8-bit 版本,本函数为 Image16 变体

    adaptive_threshold_mean_f

    fn adaptive_threshold_mean_f(img :
    core
    /types.ImageF, block_size : Int, c : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 自适应阈值(均值法)。c 为浮点偏移量。 输出二值图像(0.0 或 1.0),alpha 通道不变。 @see adaptive_threshold_mean 8-bit 版本,本函数为 ImageF 变体

    adjust_brightness

    fn adjust_brightness(img :
    core
    /types.Image, delta : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    亮度调整。delta ∈ [-255, 255],正值变亮,负值变暗。 仅影响颜色通道(前 min(channels,3) 个),alpha 通道不变。 亮度调整。delta ∈ [-255, 255],正值增亮,负值减暗。 Brightness adjustment. delta ∈ [-255, 255], positive=brighter, negative=darker. 仅影响颜色通道(前 min(channels,3) 个),alpha 通道不变。 Only affects color channels (first min(channels,3)), alpha channel unchanged.

    test "doc_adjust_brightness" {
    try {
    let data = Bytes::from_array([b'\x80', b'\x80', b'\x80'])
    let img = @types.Image::{ width: 1, height: 1, channels: 3, data, }
    let brightened = @color.adjust_brightness(img, 50)
    assert_eq(brightened.width, 1)
    assert_eq(brightened.channels, 3)
    } catch {
    _ => assert_true(false)
    }
    }

    adjust_brightness_16

    fn adjust_brightness_16(img :
    core
    /types.Image16, delta : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 亮度调整。delta ∈ [-65535, 65535] @see adjust_brightness 8-bit 版本,本函数为 Image16 变体

    adjust_brightness_f

    fn adjust_brightness_f(img :
    core
    /types.ImageF, delta : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 亮度调整。delta 为浮点偏移量 @see adjust_brightness 8-bit 版本,本函数为 ImageF 变体

    adjust_contrast

    fn adjust_contrast(img :
    core
    /types.Image, factor : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    对比度调整。factor=1.0 为原图,>1 增加对比度,<1 降低。 以 128 为中心缩放。仅影响颜色通道,alpha 不变。 优化:直接处理所有像素,避免内层循环

    adjust_contrast_16

    fn adjust_contrast_16(img :
    core
    /types.Image16, factor : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 对比度调整。factor=1.0 为原图,以 32768 为中心 @see adjust_contrast 8-bit 版本,本函数为 Image16 变体

    adjust_contrast_f

    fn adjust_contrast_f(img :
    core
    /types.ImageF, factor : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 对比度调整。factor=1.0 为原图,以 0.5 为中心 @see adjust_contrast 8-bit 版本,本函数为 ImageF 变体

    adjust_gamma

    fn adjust_gamma(img :
    core
    /types.Image, gamma : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Gamma 校正。gamma=1.0 为原图,>1 变暗,<1 变亮。 使用查找表加速。仅影响颜色通道,alpha 不变。

    adjust_gamma_16

    fn adjust_gamma_16(img :
    core
    /types.Image16, gamma : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit Gamma 校正。gamma=1.0 为原图,>1 变暗,<1 变亮。 以 65535 为满量程。仅影响颜色通道,alpha 不变。 @see adjust_gamma 8-bit 版本,本函数为 Image16 变体

    adjust_gamma_f

    fn adjust_gamma_f(img :
    core
    /types.ImageF, gamma : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float Gamma 校正。gamma=1.0 为原图,>1 变暗,<1 变亮。 以 1.0 为满量程。仅影响颜色通道,alpha 不变。 @see adjust_gamma 8-bit 版本,本函数为 ImageF 变体

    adjust_hue

    fn adjust_hue(img :
    core
    /types.Image, delta : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    色相调整。delta: 色相偏移量(度,0-360)

    adjust_saturation

    fn adjust_saturation(img :
    core
    /types.Image, factor : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    饱和度调整。factor: 0.0 = 灰度, 1.0 = 原始, >1.0 = 增强饱和度

    apply_colormap

    fn apply_colormap(img :
    core
    /types.Image, map :
    process
    /color.Colormap) ->
    core
    /types.Image raise
    core
    /types.LoadError

    伪彩色映射。将灰度图或彩色图(先转灰度)映射为 RGB 伪彩色图像。

    barcode_default_config

    fn barcode_default_config() ->
    codec
    /barcode.BarcodeConfig

    创建默认条形码识别配置

    batch_embed_watermark

    fn batch_embed_watermark(images : Array[
    core
    /types.Image], watermark :
    core
    /types.Image, key? : Int) -> Array[
    core
    /types.Image]

    批量水印嵌入(对多张图像嵌入相同水印)

    bilateral_filter_denoise

    fn bilateral_filter_denoise(img :
    core
    /types.Image, kernel_size : Int, sigma_color : Double, sigma_space : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    双边滤波(保边降噪)

    build_gaussian_pyramid

    fn build_gaussian_pyramid(img :
    core
    /types.Image, levels : Int) -> Array[
    core
    /types.Image] raise
    core
    /types.LoadError

    构建高斯金字塔。返回各级图像(从原图到最小级),levels 为最大层数(0=自动到 1x1)。

    build_gaussian_pyramid_16

    fn build_gaussian_pyramid_16(img :
    core
    /types.Image16, levels : Int) -> Array[
    core
    /types.Image16] raise
    core
    /types.LoadError

    构建高斯金字塔 16-bit 版本。 @see build_gaussian_pyramid 8-bit 版本,本函数为 Image16 变体

    build_gaussian_pyramid_f

    fn build_gaussian_pyramid_f(img :
    core
    /types.ImageF, levels : Int) -> Array[
    core
    /types.ImageF] raise
    core
    /types.LoadError

    构建高斯金字塔 float 版本。 @see build_gaussian_pyramid 8-bit 版本,本函数为 ImageF 变体

    build_laplacian_pyramid

    fn build_laplacian_pyramid(img :
    core
    /types.Image, levels : Int) -> Array[
    core
    /types.Image] raise
    core
    /types.LoadError

    构建拉普拉斯金字塔。返回各级拉普拉斯图像(高斯金字塔相邻层之差)。 最后一层为高斯金字塔的最小级(不加差)。

    build_laplacian_pyramid_16

    fn build_laplacian_pyramid_16(img :
    core
    /types.Image16, levels : Int) -> Array[
    core
    /types.Image16] raise
    core
    /types.LoadError

    构建拉普拉斯金字塔 16-bit 版本。 @see build_laplacian_pyramid 8-bit 版本,本函数为 Image16 变体

    build_laplacian_pyramid_float

    fn build_laplacian_pyramid_float(img :
    core
    /types.ImageF, levels : Int) -> Array[
    core
    /types.ImageF] raise
    core
    /types.LoadError

    构建拉普拉斯金字塔 float 版本。

    calculate_brightness

    fn calculate_brightness(img :
    core
    /types.Image) -> Double raise
    core
    /types.LoadError

    计算图像亮度

    calculate_contrast

    fn calculate_contrast(img :
    core
    /types.Image) -> Double raise
    core
    /types.LoadError

    计算图像对比度

    calculate_noise_level

    fn calculate_noise_level(img :
    core
    /types.Image) -> Double raise
    core
    /types.LoadError

    计算噪声水平

    calculate_sharpness

    fn calculate_sharpness(img :
    core
    /types.Image) -> Double raise
    core
    /types.LoadError

    计算图像锐度

    clahe

    fn clahe(img :
    core
    /types.Image, tile_size : Int, clip_limit : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    CLAHE(Contrast Limited Adaptive Histogram Equalization)。 将图像分成 tile_size × tile_size 的块,每块做直方图均衡,用双线性插值平滑拼接。 clip_limit 控制对比度增强强度,值越大增强越强(典型值 2.0~4.0)。 仅处理灰度图(channels=1)或 RGB 图(channels=3/4),alpha 通道不变。

    cmyk_to_rgb

    fn cmyk_to_rgb(c : Int, m : Int, y : Int, k : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    CMYK → RGB。输入范围 0-255。

    cmyk_to_rgb_16

    fn cmyk_to_rgb_16(c : Int, m : Int, y : Int, k : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit CMYK → RGB。输入范围 0-65535。 @see cmyk_to_rgb 8-bit 版本,本函数为 Image16 变体

    cmyk_to_rgb_f

    fn cmyk_to_rgb_f(c : Float, m : Float, y : Float, k : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float CMYK → RGB。输入范围 0.0-1.0。 @see cmyk_to_rgb 8-bit 版本,本函数为 ImageF 变体

    compute_diff_image

    fn compute_diff_image(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) ->
    core
    /types.Image

    计算图像差异图

    compute_energy

    fn compute_energy(img :
    core
    /types.Image) -> Array[Double]

    计算图像能量图(Sobel 梯度幅值 |Gx| + |Gy|)

    compute_energy_16

    fn compute_energy_16(img :
    core
    /types.Image16) -> Array[Double]

    计算图像能量图 16-bit 版本 @see compute_energy 8-bit 版本,本函数为 Image16 变体

    compute_energy_f

    fn compute_energy_f(img :
    core
    /types.ImageF) -> Array[Double]

    计算图像能量图 float 版本 @see compute_energy 8-bit 版本,本函数为 ImageF 变体

    compute_mae

    fn compute_mae(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) -> Double

    计算平均绝对误差(MAE)

    compute_mse

    fn compute_mse(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) -> Double

    计算均方误差(MSE)

    compute_psnr

    fn compute_psnr(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) -> Double

    计算峰值信噪比(PSNR)

    compute_quality_metrics

    fn compute_quality_metrics(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) ->
    photography
    /quality.QualityMetrics

    计算完整的图像质量评估指标

    compute_ssim

    fn compute_ssim(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) -> Double

    计算结构相似性(SSIM,简化版) 使用全局统计量,不使用滑动窗口

    create_default_denoise_config

    fn create_default_denoise_config() ->
    process
    /enhance.DenoiseConfig

    创建默认降噪配置

    create_rect_mask

    fn create_rect_mask(width : Int, height : Int, x : Int, y : Int, rect_w : Int, rect_h : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    创建矩形修复掩码

    crop

    fn crop(img :
    core
    /types.Image, x : Int, y : Int, w : Int, h : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    裁剪 8-bit Image 的指定区域

    crop_16

    fn crop_16(img :
    core
    /types.Image16, x : Int, y : Int, w : Int, h : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    裁剪 16-bit Image16 @see crop 8-bit 版本,本函数为 Image16 变体

    crop_f

    fn crop_f(img :
    core
    /types.ImageF, x : Int, y : Int, w : Int, h : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    裁剪 float ImageF @see crop 8-bit 版本,本函数为 ImageF 变体

    crop_region

    fn crop_region(img :
    core
    /types.Image, region :
    core
    /types.Region) ->
    core
    /types.Image

    按 Region 裁剪,越界部分自动裁掉(不报错)。空区域返回 0×0 图。 内部走零复制的 ImageRegion 视图,只为目标像素分配一次内存。

    dark_channel

    fn dark_channel(img :
    core
    /types.Image, patch_size? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    计算暗通道 暗通道:在局部 patch 内,取每个像素 RGB 三通道的最小值,再取 patch 内最小值

    decode_barcode

    fn decode_barcode(img :
    core
    /types.Image, config? :
    codec
    /barcode.BarcodeConfig) -> Array[
    codec
    /barcode.BarcodeResult] raise
    core
    /types.LoadError

    通用条形码识别(自动尝试所有启用的类型)

    decode_code128

    fn decode_code128(img :
    core
    /types.Image) ->
    codec
    /barcode.BarcodeResult? raise
    core
    /types.LoadError

    识别 Code128 条形码

    decode_code39

    fn decode_code39(img :
    core
    /types.Image) ->
    codec
    /barcode.BarcodeResult? raise
    core
    /types.LoadError

    识别 Code39 条形码

    decode_ean13

    fn decode_ean13(img :
    core
    /types.Image, config? :
    codec
    /barcode.BarcodeConfig) ->
    codec
    /barcode.BarcodeResult? raise
    core
    /types.LoadError

    识别 EAN-13 条形码

    decode_linear_barcode

    fn decode_linear_barcode(img :
    core
    /types.Image) -> Array[
    codec
    /barcode.BarcodeResult] raise
    core
    /types.LoadError

    通用一维码识别(自动尝试所有类型)

    decode_qrcode

    fn decode_qrcode(img :
    core
    /types.Image, config? :
    codec
    /barcode.BarcodeConfig) ->
    codec
    /barcode.BarcodeResult? raise
    core
    /types.LoadError

    识别 QR Code(基础版:检测定位图案并估算版本)

    decode_qrcode_full

    fn decode_qrcode_full(img :
    core
    /types.Image) ->
    codec
    /barcode.QrDecodeResult? raise
    core
    /types.LoadError

    解码 QR Code(完整版本)

    decode_upca

    fn decode_upca(img :
    core
    /types.Image) ->
    codec
    /barcode.BarcodeResult? raise
    core
    /types.LoadError

    识别 UPC-A 条形码

    dehaze

    fn dehaze(img :
    core
    /types.Image, patch_size? : Int, omega? : Float, t0? : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    暗通道先验去雾(Dark Channel Prior Dehaze)。 基于 He et al. (2009) 的暗通道先验方法。 适用于 RGB/RGBA 图像(channels=3/4)。 patch_size 为暗通道计算窗口半径(默认 7),omega 为去雾强度(默认 0.95), t0 为透射率下限(默认 0.1)。

    dehaze_16

    fn dehaze_16(img :
    core
    /types.Image16, patch_size? : Int, omega? : Float, t0? : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 图像去雾。 @see dehaze 8-bit 版本,本函数为 Image16 变体

    dehaze_advanced

    fn dehaze_advanced(img :
    core
    /types.Image, config? :
    process
    /enhance.DehazeConfig) ->
    core
    /types.Image raise
    core
    /types.LoadError

    完整去雾流水线

    dehaze_default_config

    fn dehaze_default_config() ->
    process
    /enhance.DehazeConfig

    创建默认去雾配置

    dehaze_f

    fn dehaze_f(img :
    core
    /types.ImageF, patch_size? : Int, omega? : Float, t0? : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 图像去雾。 @see dehaze 8-bit 版本,本函数为 ImageF 变体

    dehaze_recover

    fn dehaze_recover(img :
    core
    /types.Image, transmission :
    core
    /types.Image, atmospheric : Array[Int], t_min? : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    去雾复原 去雾复原 J(x) = (I(x) - A) / max(t(x), t0) + A

    denoise

    fn denoise(img :
    core
    /types.Image, method_type : String) ->
    core
    /types.Image raise
    core
    /types.LoadError

    通用去噪接口

    denoise_algorithm_to_string

    fn denoise_algorithm_to_string(algorithm :
    process
    /enhance.DenoiseAlgorithm) -> String

    获取降噪算法名称

    denoise_bilateral

    fn denoise_bilateral(img :
    core
    /types.Image, diameter? : Int, sigma_color? : Double, sigma_space? : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    双边滤波增强版 同时考虑空间距离和像素值差异

    denoise_image

    fn denoise_image(img :
    core
    /types.Image, config :
    process
    /enhance.DenoiseConfig) ->
    process
    /enhance.DenoiseResult raise
    core
    /types.LoadError

    图像降噪

    denoise_median

    fn denoise_median(img :
    core
    /types.Image, kernel_size? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    中值滤波增强版(支持任意核大小)

    denoise_nlm

    fn denoise_nlm(img :
    core
    /types.Image, config? :
    process
    /enhance.NlmConfig) ->
    core
    /types.Image raise
    core
    /types.LoadError

    非局部均值去噪(简化版) 基于图像块相似度的加权平均去噪

    denoise_report_to_string

    fn denoise_report_to_string(result :
    process
    /enhance.DenoiseResult) -> String

    生成降噪报告

    detect_qr_finder_patterns

    fn detect_qr_finder_patterns(img :
    core
    /types.Image) -> Array[
    codec
    /barcode.QrFinderPattern] raise
    core
    /types.LoadError

    检测 QR Code 定位图案

    draw_circle

    fn draw_circle(img :
    core
    /types.Image, cx : Int, cy : Int, r : Int, color : Array[Byte], thickness? : Int, fill? : Bool) ->
    core
    /types.Image

    画圆(中点画圆算法)。color 为颜色数组。thickness 为线宽(默认 1)。fill 为是否填充(默认 false)。

    draw_circle_16

    fn draw_circle_16(img :
    core
    /types.Image16, cx : Int, cy : Int, r : Int, color : Array[Int], thickness? : Int, fill? : Bool) ->
    core
    /types.Image16

    16-bit 绘制圆形。 @see draw_circle 8-bit 版本,本函数为 Image16 变体

    draw_circle_f

    fn draw_circle_f(img :
    core
    /types.ImageF, cx : Int, cy : Int, r : Int, color : Array[Float], thickness? : Int, fill? : Bool) ->
    core
    /types.ImageF

    float 绘制圆形。 @see draw_circle 8-bit 版本,本函数为 ImageF 变体

    draw_copy

    fn draw_copy(dst :
    core
    /types.Image, src :
    core
    /types.Image, x : Int, y : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    将 src 图像直接拷贝到 dst 的 (x, y) 位置 返回新的 Image,不修改原图。要求 dst 和 src channels 相同。

    draw_line

    fn draw_line(img :
    core
    /types.Image, x1 : Int, y1 : Int, x2 : Int, y2 : Int, color : Array[Byte], thickness? : Int) ->
    core
    /types.Image

    画线段(Bresenham 算法)。color 为颜色数组(如 [R,G,B])。thickness 为线宽(默认 1)。

    draw_line_16

    fn draw_line_16(img :
    core
    /types.Image16, x1 : Int, y1 : Int, x2 : Int, y2 : Int, color : Array[Int], thickness? : Int) ->
    core
    /types.Image16

    16-bit 绘制直线。 @see draw_line 8-bit 版本,本函数为 Image16 变体

    draw_line_f

    fn draw_line_f(img :
    core
    /types.ImageF, x1 : Int, y1 : Int, x2 : Int, y2 : Int, color : Array[Float], thickness? : Int) ->
    core
    /types.ImageF

    float 绘制直线。 @see draw_line 8-bit 版本,本函数为 ImageF 变体

    draw_over

    fn draw_over(dst :
    core
    /types.Image, src :
    core
    /types.Image, x : Int, y : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Alpha 混合合成(source over destination) 将 src 图像合成到 dst 的 (x, y) 位置 要求 dst 和 src 均为 RGBA (channels=4) 公式: result = src * src_a + dst * (1 - src_a)

    draw_polygon

    fn draw_polygon(img :
    core
    /types.Image, points : Array[(Int, Int)], color : Array[Byte], thickness? : Int, fill? : Bool) ->
    core
    /types.Image

    画多边形。points 为顶点数组 [(x1,y1), (x2,y2), ...]。color 为颜色数组。thickness 为线宽(默认 1)。fill 为是否填充(默认 false)。

    draw_polygon_16

    fn draw_polygon_16(img :
    core
    /types.Image16, points : Array[(Int, Int)], color : Array[Int], thickness? : Int) ->
    core
    /types.Image16

    16-bit 绘制多边形。 @see draw_polygon 8-bit 版本,本函数为 Image16 变体

    draw_polygon_f

    fn draw_polygon_f(img :
    core
    /types.ImageF, points : Array[(Int, Int)], color : Array[Float], thickness? : Int) ->
    core
    /types.ImageF

    float 绘制多边形。 @see draw_polygon 8-bit 版本,本函数为 ImageF 变体

    draw_rectangle

    fn draw_rectangle(img :
    core
    /types.Image, x : Int, y : Int, rw : Int, rh : Int, color : Array[Byte], thickness? : Int, fill? : Bool) ->
    core
    /types.Image

    画矩形。color 为颜色数组。thickness 为线宽(默认 1)。fill 为是否填充(默认 false)。

    draw_rectangle_16

    fn draw_rectangle_16(img :
    core
    /types.Image16, x : Int, y : Int, rw : Int, rh : Int, color : Array[Int], thickness? : Int, fill? : Bool) ->
    core
    /types.Image16

    16-bit 绘制矩形。 @see draw_rectangle 8-bit 版本,本函数为 Image16 变体

    draw_rectangle_f

    fn draw_rectangle_f(img :
    core
    /types.ImageF, x : Int, y : Int, rw : Int, rh : Int, color : Array[Float], thickness? : Int, fill? : Bool) ->
    core
    /types.ImageF

    float 绘制矩形。 @see draw_rectangle 8-bit 版本,本函数为 ImageF 变体

    embed_text_watermark

    fn embed_text_watermark(cover :
    core
    /types.Image, text : String, key? : Int) ->
    core
    /types.Image

    文本水印嵌入(将文本转换为二进制嵌入到图像)

    embed_watermark_lsb

    fn embed_watermark_lsb(cover :
    core
    /types.Image, watermark :
    core
    /types.Image, key? : Int) ->
    core
    /types.Image

    LSB 水印嵌入(最低有效位) 将水印图像嵌入到载体图像的最低有效位

    enhance_image_advanced

    fn enhance_image_advanced(img :
    core
    /types.Image, algorithm :
    process
    /enhance.EnhancementAlgorithm) ->
    process
    /enhance.EnhancementResult raise
    core
    /types.LoadError

    图像增强

    estimate_atmospheric_light

    fn estimate_atmospheric_light(img :
    core
    /types.Image, dark :
    core
    /types.Image, top_percent? : Int) -> Array[Int] raise
    core
    /types.LoadError

    估计大气光 取暗通道中最亮的 0.1% 像素,在原图中取这些像素的最大值作为大气光

    estimate_transmission

    fn estimate_transmission(img :
    core
    /types.Image, atmospheric : Array[Int], omega? : Double, patch_size? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    计算透射率 透射率 t(x) = 1 - omega * dark_channel(I/A)

    extract_text_watermark

    fn extract_text_watermark(stego :
    core
    /types.Image, length : Int, key? : Int) -> String

    文本水印提取

    extract_watermark_lsb

    fn extract_watermark_lsb(stego :
    core
    /types.Image) ->
    core
    /types.Image

    LSB 水印提取 从载体图像的最低有效位提取水印

    find_horizontal_seam

    fn find_horizontal_seam(energy : Array[Double], w : Int, h : Int) -> Array[Int]

    找水平最小能量 seam(返回每列的行索引,长度为 w)

    find_vertical_seam

    fn find_vertical_seam(energy : Array[Double], w : Int, h : Int) -> Array[Int]

    找垂直最小能量 seam(返回每行的列索引,长度为 h)

    flip_horizontal

    fn flip_horizontal(img :
    core
    /types.Image) ->
    core
    /types.Image

    水平翻转(左右镜像)

    flip_horizontal_16

    fn flip_horizontal_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    @see flip_horizontal 8-bit 版本,本函数为 Image16 变体

    flip_horizontal_f

    fn flip_horizontal_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    @see flip_horizontal 8-bit 版本,本函数为 ImageF 变体

    flip_vertical

    fn flip_vertical(img :
    core
    /types.Image) ->
    core
    /types.Image

    垂直翻转(上下镜像)

    flip_vertical_16

    fn flip_vertical_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    16-bit 垂直翻转。上下镜像。 @see flip_vertical 8-bit 版本,本函数为 Image16 变体

    flip_vertical_f

    fn flip_vertical_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    float 垂直翻转。上下镜像。 @see flip_vertical 8-bit 版本,本函数为 ImageF 变体

    floyd_steinberg

    fn floyd_steinberg(img :
    core
    /types.Image, levels : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Floyd-Steinberg 误差扩散抖动量化。 levels 为每通道量化级别数(如 levels=2 → 0/255,levels=4 → 0/85/170/255)。 仅处理颜色通道,alpha 不变。

    floyd_steinberg_16

    fn floyd_steinberg_16(img :
    core
    /types.Image16, levels : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    Floyd-Steinberg 误差扩散抖动量化 16-bit 版本。 @see floyd_steinberg 8-bit 版本,本函数为 Image16 变体

    floyd_steinberg_f

    fn floyd_steinberg_f(img :
    core
    /types.ImageF, levels : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    Floyd-Steinberg 误差扩散抖动量化 float 版本。 @see floyd_steinberg 8-bit 版本,本函数为 ImageF 变体

    gamma_correction_enhance

    fn gamma_correction_enhance(img :
    core
    /types.Image, gamma : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Gamma 校正

    gamma_tonemap

    fn gamma_tonemap(imgf :
    core
    /types.ImageF, gamma : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Gamma 色调映射。 先归一化到 [0,1],再应用 gamma 校正:L_out = L^(1/gamma)。 gamma > 1 提亮暗部,gamma < 1 压暗。

    gamma_tonemap_16

    fn gamma_tonemap_16(imgf :
    core
    /types.ImageF, gamma : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    Gamma 色调映射(16-bit 输出)。 输入 ImageF,输出 Image16(0-65535)。 @see gamma_tonemap 基础版本,本函数为 Image16 变体

    gamma_tonemap_f

    fn gamma_tonemap_f(imgf :
    core
    /types.ImageF, gamma : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    Gamma 色调映射(float 输出)。 先归一化到 [0,1],再应用 gamma 校正:L_out = L^(1/gamma)。 gamma > 1 提亮暗部,gamma < 1 压暗。 @see gamma_tonemap 基础版本,本函数为 ImageF 变体

    gaussian_filter_denoise

    fn gaussian_filter_denoise(img :
    core
    /types.Image, kernel_size : Int, sigma : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    高斯滤波

    get_affine_transform

    fn get_affine_transform(src : Array[(Float, Float)], dst : Array[(Float, Float)]) ->
    process
    /transform.AffineMatrix?

    从 3 对源点→目标点计算 2×3 仿射变换矩阵。

    get_perspective_transform

    fn get_perspective_transform(src : Array[(Float, Float)], dst : Array[(Float, Float)]) ->
    process
    /transform.PerspectiveMatrix?

    从 4 对源点→目标点计算 3×3 透视变换矩阵。 src 和 dst 均为 4 个 (Float, Float) 点。

    get_rotation_matrix_2d

    fn get_rotation_matrix_2d(center : (Float, Float), angle : Float, scale : Float) ->
    process
    /transform.AffineMatrix

    从中心点、角度和缩放计算 2×3 旋转矩阵。 angle 为弧度,scale 为缩放因子。

    guided_filter

    fn guided_filter(img :
    core
    /types.Image, input : Array[Float], radius? : Int, eps? : Float) -> Array[Float] raise
    core
    /types.LoadError

    引导滤波(Guided Filter)用于优化透射率。 适用于灰度图(channels=1)作为引导图。

    guided_filter_16

    fn guided_filter_16(img :
    core
    /types.Image16, input : Array[Float], radius? : Int, eps? : Float) -> Array[Float] raise
    core
    /types.LoadError

    16-bit 引导滤波。 @see guided_filter 8-bit 版本,本函数为 Image16 变体

    guided_filter_f

    fn guided_filter_f(img :
    core
    /types.ImageF, input : Array[Float], radius? : Int, eps? : Float) -> Array[Float] raise
    core
    /types.LoadError

    float 引导滤波。 @see guided_filter 8-bit 版本,本函数为 ImageF 变体

    guided_filter_image

    fn guided_filter_image(input :
    core
    /types.Image, guide :
    core
    /types.Image, radius? : Int, eps? : Double) ->
    core
    /types.Image raise
    core
    /types.LoadError

    引导滤波(用于透射率优化) 简化版:使用均值滤波近似引导滤波

    histogram_equalization_enhance

    fn histogram_equalization_enhance(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    直方图均衡化

    hsl_to_rgb

    fn hsl_to_rgb(h : Float, s : Float, l : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    HSL → RGB 色彩空间转换。 输入 h ∈ [0,360), s ∈ [0,1], l ∈ [0,1],输出 r,g,b ∈ [0,255]

    hsl_to_rgb_16

    fn hsl_to_rgb_16(h : Float, s : Float, l : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit HSL → RGB。输入 h ∈ [0,360), s,l ∈ [0,1],输出 r,g,b ∈ [0,65535] @see hsl_to_rgb 8-bit 版本,本函数为 Image16 变体

    hsl_to_rgb_f

    fn hsl_to_rgb_f(h : Float, s : Float, l : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float HSL → RGB。输入 h ∈ [0,360), s,l ∈ [0,1],输出 r,g,b ∈ [0,1] @see hsl_to_rgb 8-bit 版本,本函数为 ImageF 变体

    hsv_to_rgb

    fn hsv_to_rgb(h : Float, s : Float, v : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    HSV → RGB 色彩空间转换。 输入 h ∈ [0,360), s ∈ [0,1], v ∈ [0,1],输出 r,g,b ∈ [0,255]

    hsv_to_rgb_16

    fn hsv_to_rgb_16(h : Float, s : Float, v : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit HSV → RGB。输入 h ∈ [0,360), s,v ∈ [0,1],输出 r,g,b ∈ [0,65535] @see hsv_to_rgb 8-bit 版本,本函数为 Image16 变体

    hsv_to_rgb_f

    fn hsv_to_rgb_f(h : Float, s : Float, v : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float HSV → RGB。输入 h ∈ [0,360), s,v ∈ [0,1],输出 r,g,b ∈ [0,1] @see hsv_to_rgb 8-bit 版本,本函数为 ImageF 变体

    images_equal

    fn images_equal(img1 :
    core
    /types.Image, img2 :
    core
    /types.Image) -> Bool

    比较两张图像是否相同(像素级)

    inpaint_advanced

    fn inpaint_advanced(img :
    core
    /types.Image, mask :
    core
    /types.Image, radius? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    图像修复(Telea 算法,简化版) 基于快速行进法,从边界向内部逐步修复

    inpaint_default_config

    fn inpaint_default_config() ->
    process
    /enhance.InpaintConfig

    创建默认图像修复配置

    invert

    fn invert(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    反色(负片)。new = 255 - old。仅影响颜色通道,alpha 不变。

    invert_16

    fn invert_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 反色(负片)。new = 65535 - old。仅影响颜色通道,alpha 不变。 @see invert 8-bit 版本,本函数为 Image16 变体

    invert_f

    fn invert_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 反色(负片)。new = 1.0 - old。仅影响颜色通道,alpha 不变。 @see invert 8-bit 版本,本函数为 ImageF 变体

    kmeans_quantize

    fn kmeans_quantize(img :
    core
    /types.Image, k : Int, max_iters : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    K-means 色彩量化。将图像颜色聚为 k 类,每类用聚类中心替代。 适用于 RGB/RGBA 图像(channels=3/4),alpha 通道不变。 max_iters 控制最大迭代次数(默认 20)。

    kmeans_quantize_16

    fn kmeans_quantize_16(img :
    core
    /types.Image16, k : Int, max_iters : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    K-means 色彩量化 16-bit 版本。 @see kmeans_quantize 8-bit 版本,本函数为 Image16 变体

    kmeans_quantize_f

    fn kmeans_quantize_f(img :
    core
    /types.ImageF, k : Int, max_iters : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    K-means 色彩量化 float 版本。 @see kmeans_quantize 8-bit 版本,本函数为 ImageF 变体

    lab_to_rgb

    fn lab_to_rgb(l : Float, a : Float, b : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    Lab → RGB(CIELAB, D65 白点)。输入 L 范围 0-100,a/b 范围 -128-127。

    lab_to_rgb_16

    fn lab_to_rgb_16(l : Float, a : Float, b : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit LAB → RGB。输入 L ∈ [0,100], a,b ∈ [-128,127],输出 r,g,b ∈ [0,65535] @see lab_to_rgb 8-bit 版本,本函数为 Image16 变体

    lab_to_rgb_f

    fn lab_to_rgb_f(l : Float, a : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float LAB → RGB。输入 L ∈ [0,100], a,b ∈ [-128,127],输出 r,g,b ∈ [0,1] @see lab_to_rgb 8-bit 版本,本函数为 ImageF 变体

    mean_filter_denoise

    fn mean_filter_denoise(img :
    core
    /types.Image, kernel_size : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    均值滤波

    median_cut

    fn median_cut(img :
    core
    /types.Image, num_colors : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Median Cut 色彩量化。将图像量化为最多 num_colors 种颜色。 返回量化后的 RGB 图像(channels=3)。 算法:递归地沿最大方差通道在中位数处分割颜色空间。

    median_cut_16

    fn median_cut_16(img :
    core
    /types.Image16, num_colors : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    Median Cut 色彩量化 16-bit 版本。 @see median_cut 8-bit 版本,本函数为 Image16 变体

    median_cut_f

    fn median_cut_f(img :
    core
    /types.ImageF, num_colors : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    Median Cut 色彩量化 float 版本。 @see median_cut 8-bit 版本,本函数为 ImageF 变体

    median_filter_denoise

    fn median_filter_denoise(img :
    core
    /types.Image, kernel_size : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    中值滤波

    msr

    fn msr(img :
    core
    /types.Image, sigmas? : Array[Float], gain? : Float, offset? : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    多尺度 Retinex(MSR)。 对多个不同 sigma 的 SSR 结果取平均。 适用于灰度图(channels=1)或 RGB/RGBA 图(channels=3/4)。 sigmas 为高斯标准差数组(默认 [15, 80, 250])。 gain 为增益,offset 为偏移。

    msr_16

    fn msr_16(img :
    core
    /types.Image16, sigmas? : Array[Float], gain? : Float, offset? : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    多尺度 Retinex(MSR)16-bit 版本。 @see msr 8-bit 版本,本函数为 Image16 变体

    msr_f

    fn msr_f(img :
    core
    /types.ImageF, sigmas? : Array[Float], gain? : Float, offset? : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    多尺度 Retinex(MSR)float 版本。 @see msr 8-bit 版本,本函数为 ImageF 变体

    msrcr

    fn msrcr(img :
    core
    /types.Image, sigmas? : Array[Float], gain? : Float, offset? : Float, alpha? : Float, beta? : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    带颜色恢复的多尺度 Retinex(MSRCR)。 在 MSR 基础上恢复颜色信息。 适用于 RGB/RGBA 图(channels=3/4)。

    msrcr_16

    fn msrcr_16(img :
    core
    /types.Image16, sigmas? : Array[Float], gain? : Float, offset? : Float, alpha? : Float, beta? : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    带颜色恢复的多尺度 Retinex(MSRCR)16-bit 版本。 @see msrcr 8-bit 版本,本函数为 Image16 变体

    msrcr_f

    fn msrcr_f(img :
    core
    /types.ImageF, sigmas? : Array[Float], gain? : Float, offset? : Float, alpha? : Float, beta? : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    带颜色恢复的多尺度 Retinex(MSRCR)float 版本。 @see msrcr 8-bit 版本,本函数为 ImageF 变体

    multi_band_blend

    fn multi_band_blend(img_a :
    core
    /types.Image, img_b :
    core
    /types.Image, mask :
    core
    /types.Image, num_bands? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    多频带融合(Laplacian pyramid blend)。 img_a 和 img_b 尺寸需相同,mask 为灰度图(非零区域取 img_a,零区域取 img_b)。 num_bands 为金字塔层数(默认 5)。

    multi_band_blend_16

    fn multi_band_blend_16(img_a :
    core
    /types.Image16, img_b :
    core
    /types.Image16, mask :
    core
    /types.Image16, num_bands? : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    多频带融合 16-bit 版本。 @see multi_band_blend 8-bit 版本,本函数为 Image16 变体

    multi_band_blend_f

    fn multi_band_blend_f(img_a :
    core
    /types.ImageF, img_b :
    core
    /types.ImageF, mask :
    core
    /types.ImageF, num_bands? : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    多频带融合 float 版本。 @see multi_band_blend 8-bit 版本,本函数为 ImageF 变体

    nlm_default_config

    fn nlm_default_config() ->
    process
    /enhance.NlmConfig

    创建默认 NLM 配置

    premultiply_alpha

    fn premultiply_alpha(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    预乘 alpha(RGBA → RGBA premultiplied) 要求 channels=4

    premultiply_alpha_16

    fn premultiply_alpha_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 预乘 alpha(RGBA → RGBA premultiplied)。要求 channels=4。 @see premultiply_alpha 8-bit 版本,本函数为 Image16 变体

    premultiply_alpha_f

    fn premultiply_alpha_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 预乘 alpha(RGBA → RGBA premultiplied)。要求 channels=4。 @see premultiply_alpha 8-bit 版本,本函数为 ImageF 变体

    pyr_down

    fn pyr_down(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    高斯金字塔下采样。将图像尺寸减半(宽高各 /2),使用 2x2 均值滤波。

    pyr_down_16

    fn pyr_down_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    高斯金字塔下采样 16-bit 版本。 @see pyr_down 8-bit 版本,本函数为 Image16 变体

    pyr_down_f

    fn pyr_down_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    高斯金字塔下采样 float 版本。 @see pyr_down 8-bit 版本,本函数为 ImageF 变体

    pyr_up

    fn pyr_up(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    拉普拉斯金字塔上采样。将图像尺寸加倍(宽高各 *2),使用双线性插值。

    pyr_up_16

    fn pyr_up_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    拉普拉斯金字塔上采样 16-bit 版本。 @see pyr_up 8-bit 版本,本函数为 Image16 变体

    pyr_up_f

    fn pyr_up_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    拉普拉斯金字塔上采样 float 版本。 @see pyr_up 8-bit 版本,本函数为 ImageF 变体

    reed_solomon_decode

    fn reed_solomon_decode(data : Array[Int], ec_bytes : Int) -> (Array[Int], Int)

    Reed-Solomon 纠错(简化版 GF(256))

    reinhard_tonemap

    fn reinhard_tonemap(imgf :
    core
    /types.ImageF, key? : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Reinhard 全局色调映射。 key 控制整体亮度(默认 0.18),值越大越亮。 公式:L_out = L_scaled / (1 + L_scaled),其中 L_scaled = key * L / L_avg。

    reinhard_tonemap_16

    fn reinhard_tonemap_16(imgf :
    core
    /types.ImageF, key? : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    Reinhard 全局色调映射(16-bit 输出)。 输入 ImageF,输出 Image16(0-65535)。 @see reinhard_tonemap 基础版本,本函数为 Image16 变体

    reinhard_tonemap_f

    fn reinhard_tonemap_f(imgf :
    core
    /types.ImageF, key? : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    Reinhard 全局色调映射(float 输出)。 key 控制整体亮度(默认 0.18),值越大越亮。 公式:L_out = L_scaled / (1 + L_scaled),其中 L_scaled = key * L / L_avg。 @see reinhard_tonemap 基础版本,本函数为 ImageF 变体

    remove_horizontal_seam

    fn remove_horizontal_seam(img :
    core
    /types.Image, seam : Array[Int]) ->
    core
    /types.Image

    移除水平 seam,高度减 1

    remove_horizontal_seam_16

    fn remove_horizontal_seam_16(img :
    core
    /types.Image16, seam : Array[Int]) ->
    core
    /types.Image16

    移除水平 seam 16-bit 版本 @see remove_horizontal_seam 8-bit 版本,本函数为 Image16 变体

    remove_horizontal_seam_f

    fn remove_horizontal_seam_f(img :
    core
    /types.ImageF, seam : Array[Int]) ->
    core
    /types.ImageF

    移除水平 seam float 版本 @see remove_horizontal_seam 8-bit 版本,本函数为 ImageF 变体

    remove_small_objects

    fn remove_small_objects(img :
    core
    /types.Image, max_size? : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    去除图像中的小物体(基于连通域分析)

    remove_vertical_seam

    fn remove_vertical_seam(img :
    core
    /types.Image, seam : Array[Int]) ->
    core
    /types.Image

    移除垂直 seam,宽度减 1

    remove_vertical_seam_16

    fn remove_vertical_seam_16(img :
    core
    /types.Image16, seam : Array[Int]) ->
    core
    /types.Image16

    移除垂直 seam 16-bit 版本 @see remove_vertical_seam 8-bit 版本,本函数为 Image16 变体

    remove_vertical_seam_f

    fn remove_vertical_seam_f(img :
    core
    /types.ImageF, seam : Array[Int]) ->
    core
    /types.ImageF

    移除垂直 seam float 版本 @see remove_vertical_seam 8-bit 版本,本函数为 ImageF 变体

    remove_watermark

    fn remove_watermark(img :
    core
    /types.Image, x : Int, y : Int, width : Int, height : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    图像去水印(基于修复的简化版) 将指定区域的像素用周围像素填充

    resize_16

    fn resize_16(img :
    core
    /types.Image16, new_w : Int, new_h : Int) ->
    core
    /types.Image16

    16-bit 图像缩放。 @see resize 8-bit 版本,本函数为 Image16 变体

    resize_f

    fn resize_f(img :
    core
    /types.ImageF, new_w : Int, new_h : Int) ->
    core
    /types.ImageF

    float 图像缩放。 @see resize 8-bit 版本,本函数为 ImageF 变体

    resize_subsample

    fn resize_subsample(img :
    core
    /types.Image, out_w : Int, out_h : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    面积平均重采样(下采样首选,上采样退化为最近邻)。 每格把源图对应矩形内的像素求平均后写一个输出像素——不建中间缓冲。 失败条件:输入/输出尺寸非正、数据长度与 width*height*channels 不符。

    resize_to_contain

    fn resize_to_contain(img :
    core
    /types.Image, target_w : Int, target_h : Int, fill_color : Array[Byte]) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Resize 到目标尺寸内(contain 模式),保持宽高比,不足部分用 fill_color 填充。

    resize_to_cover

    fn resize_to_cover(img :
    core
    /types.Image, target_w : Int, target_h : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Resize 并裁剪到精确尺寸(cover 模式)。 先按宽高比缩放使图像"覆盖"目标尺寸,然后居中裁剪多余部分。

    rgb_to_cmyk

    fn rgb_to_cmyk(r : Int, g : Int, b : Int) -> (Int, Int, Int, Int) raise
    core
    /types.LoadError

    RGB → CMYK。返回 (C, M, Y, K),范围 0-255。

    rgb_to_cmyk_16

    fn rgb_to_cmyk_16(r : Int, g : Int, b : Int) -> (Int, Int, Int, Int) raise
    core
    /types.LoadError

    16-bit RGB → CMYK。输入范围 0-65535,输出范围 0-65535。 @see rgb_to_cmyk 8-bit 版本,本函数为 Image16 变体

    rgb_to_cmyk_f

    fn rgb_to_cmyk_f(r : Float, g : Float, b : Float) -> (Float, Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → CMYK。输入范围 0.0-1.0,输出范围 0.0-1.0。 @see rgb_to_cmyk 8-bit 版本,本函数为 ImageF 变体

    rgb_to_hsl

    fn rgb_to_hsl(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    RGB → HSL 色彩空间转换。 输入 r,g,b ∈ [0,255],输出 h ∈ [0,360), s ∈ [0,1], l ∈ [0,1]

    rgb_to_hsl_16

    fn rgb_to_hsl_16(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    16-bit RGB → HSL。输入 r,g,b ∈ [0,65535],输出 h ∈ [0,360), s,l ∈ [0,1] @see rgb_to_hsl 8-bit 版本,本函数为 Image16 变体

    rgb_to_hsl_f

    fn rgb_to_hsl_f(r : Float, g : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → HSL。输入 r,g,b ∈ [0,1],输出 h ∈ [0,360), s,l ∈ [0,1] @see rgb_to_hsl 8-bit 版本,本函数为 ImageF 变体

    rgb_to_hsv

    fn rgb_to_hsv(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    RGB → HSV 色彩空间转换。 输入 r,g,b ∈ [0,255],输出 h ∈ [0,360), s ∈ [0,1], v ∈ [0,1]

    rgb_to_hsv_16

    fn rgb_to_hsv_16(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    16-bit RGB → HSV。输入 r,g,b ∈ [0,65535],输出 h ∈ [0,360), s,v ∈ [0,1] @see rgb_to_hsv 8-bit 版本,本函数为 Image16 变体

    rgb_to_hsv_f

    fn rgb_to_hsv_f(r : Float, g : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → HSV。输入 r,g,b ∈ [0,1],输出 h ∈ [0,360), s,v ∈ [0,1] @see rgb_to_hsv 8-bit 版本,本函数为 ImageF 变体

    rgb_to_lab

    fn rgb_to_lab(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    RGB → Lab(CIELAB, D65 白点)。返回 (L, a, b),L 范围 0-100,a/b 范围 -128-127。

    rgb_to_lab_16

    fn rgb_to_lab_16(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    16-bit RGB → LAB。输入 r,g,b ∈ [0,65535],输出 L ∈ [0,100], a,b ∈ [-128,127] @see rgb_to_lab 8-bit 版本,本函数为 Image16 变体

    rgb_to_lab_f

    fn rgb_to_lab_f(r : Float, g : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → LAB。输入 r,g,b ∈ [0,1],输出 L ∈ [0,100], a,b ∈ [-128,127] @see rgb_to_lab 8-bit 版本,本函数为 ImageF 变体

    rgb_to_xyz

    fn rgb_to_xyz(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    RGB → XYZ(sRGB, D65 白点)。返回 (X, Y, Z),范围 0.0-1.0。

    rgb_to_xyz_16

    fn rgb_to_xyz_16(r : Int, g : Int, b : Int) -> (Float, Float, Float) raise
    core
    /types.LoadError

    16-bit RGB → XYZ。输入 r,g,b ∈ [0,65535],输出 x,y,z ∈ [0,1] @see rgb_to_xyz 8-bit 版本,本函数为 Image16 变体

    rgb_to_xyz_f

    fn rgb_to_xyz_f(r : Float, g : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → XYZ。输入 r,g,b ∈ [0,1],输出 x,y,z ∈ [0,1] @see rgb_to_xyz 8-bit 版本,本函数为 ImageF 变体

    rgb_to_ycbcr

    fn rgb_to_ycbcr(r : Int, g : Int, b : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    RGB → YCbCr(ITU-R BT.601)。返回 (Y, Cb, Cr),范围 0-255。

    rgb_to_ycbcr_16

    fn rgb_to_ycbcr_16(r : Int, g : Int, b : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit RGB → YCbCr(ITU-R BT.601)。输入范围 0-65535,输出范围 0-65535。 @see rgb_to_ycbcr 8-bit 版本,本函数为 Image16 变体

    rgb_to_ycbcr_f

    fn rgb_to_ycbcr_f(r : Float, g : Float, b : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float RGB → YCbCr(ITU-R BT.601)。输入范围 0.0-1.0,输出范围 0.0-1.0。 @see rgb_to_ycbcr 8-bit 版本,本函数为 ImageF 变体

    rotate

    fn rotate(img :
    core
    /types.Image, angle_degrees : Float) ->
    core
    /types.Image

    任意角度旋转(绕中心,保留原尺寸,角落填充黑色)。 angle 单位为度,正值逆时针旋转。使用双线性插值。

    rotate_180

    fn rotate_180(img :
    core
    /types.Image) ->
    core
    /types.Image

    旋转 180 度

    rotate_180_16

    fn rotate_180_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    @see rotate_180 8-bit 版本,本函数为 Image16 变体

    rotate_180_f

    fn rotate_180_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    @see rotate_180 8-bit 版本,本函数为 ImageF 变体

    rotate_270

    fn rotate_270(img :
    core
    /types.Image) ->
    core
    /types.Image

    顺时针旋转 270 度(逆时针 90 度)

    rotate_270_16

    fn rotate_270_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    @see rotate_270 8-bit 版本,本函数为 Image16 变体

    rotate_270_f

    fn rotate_270_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    @see rotate_270 8-bit 版本,本函数为 ImageF 变体

    rotate_90

    fn rotate_90(img :
    core
    /types.Image) ->
    core
    /types.Image

    顺时针旋转 90 度

    rotate_90_16

    fn rotate_90_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    @see rotate_90 8-bit 版本,本函数为 Image16 变体

    rotate_90_f

    fn rotate_90_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    @see rotate_90 8-bit 版本,本函数为 ImageF 变体

    seam_carve_resize

    fn seam_carve_resize(img :
    core
    /types.Image, new_w : Int, new_h : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    内容感知缩放(Seam Carving) 支持缩小和放大,放大上限为原尺寸 2 倍

    seam_carve_resize_16

    fn seam_carve_resize_16(img :
    core
    /types.Image16, new_w : Int, new_h : Int) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    内容感知缩放 16-bit 版本 @see seam_carve_resize 8-bit 版本,本函数为 Image16 变体

    seam_carve_resize_f

    fn seam_carve_resize_f(img :
    core
    /types.ImageF, new_w : Int, new_h : Int) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    内容感知缩放 float 版本 @see seam_carve_resize 8-bit 版本,本函数为 ImageF 变体

    ssr

    fn ssr(img :
    core
    /types.Image, sigma? : Float, gain? : Float, offset? : Float) ->
    core
    /types.Image raise
    core
    /types.LoadError

    单尺度 Retinex(SSR)。 对每个像素计算 log(I) - log(I * G_sigma), 其中 G_sigma 为高斯滤波器。 适用于灰度图(channels=1)或 RGB/RGBA 图(channels=3/4)。 sigma 为高斯标准差,gain 为增益,offset 为偏移。

    ssr_16

    fn ssr_16(img :
    core
    /types.Image16, sigma? : Float, gain? : Float, offset? : Float) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    单尺度 Retinex(SSR)16-bit 版本。 @see ssr 8-bit 版本,本函数为 Image16 变体

    ssr_f

    fn ssr_f(img :
    core
    /types.ImageF, sigma? : Float, gain? : Float, offset? : Float) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    单尺度 Retinex(SSR)float 版本。 @see ssr 8-bit 版本,本函数为 ImageF 变体

    threshold_otsu

    fn threshold_otsu(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    Otsu 大津法自动阈值。自动计算最佳全局阈值并二值化。

    threshold_otsu_16

    fn threshold_otsu_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit Otsu 大津法自动阈值。使用 65536-bin 直方图。 输出二值图像(0 或 65535)。 @see threshold_otsu 8-bit 版本,本函数为 Image16 变体

    threshold_otsu_f

    fn threshold_otsu_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float Otsu 大津法自动阈值。将值归一化到 0-255 后使用 256-bin 直方图。 输出二值图像(0.0 或 1.0)。 @see threshold_otsu 8-bit 版本,本函数为 ImageF 变体

    thumbnail

    fn thumbnail(img :
    core
    /types.Image, max_side : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    等比缩略图:长边压到 max_side,短边按比例(四舍五入,至少 1 像素)。 原图两边都不超过 max_side 时原样返回(零分配)。

    thumbnail_budgeted

    fn thumbnail_budgeted(img :
    core
    /types.Image, max_side : Int, budget :
    core
    /types.AllocBudget) ->
    core
    /types.Image raise
    core
    /types.ImageError

    带分配预算的缩略图:先按尺寸算输出字节,超出 budget 直接拒(不分配)。 这是"大图出小图"的推荐入口:预算按输出计,底图内存由解码期 DecodeLimits 把关。

    thumbnail_dims

    fn thumbnail_dims(width : Int, height : Int, max_side : Int) -> (Int, Int)

    等比缩略图的输出尺寸(不分配内存,供预算检查先算)。

    to_grayscale

    fn to_grayscale(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    转为灰度图(channels=1) 使用 ITU-R BT.601 亮度公式: Y = 0.299R + 0.587G + 0.114B 优化:直接从 Bytes 读取,避免额外数组分配

    to_grayscale_16

    fn to_grayscale_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 转灰度。ITU-R BT.601: Y = 0.299R + 0.587G + 0.114B。 输出 channels=1 的 16-bit 灰度图。 @see to_grayscale 8-bit 版本,本函数为 Image16 变体

    to_grayscale_f

    fn to_grayscale_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 转灰度。ITU-R BT.601: Y = 0.299R + 0.587G + 0.114B。 输出 channels=1 的 float 灰度图。 @see to_grayscale 8-bit 版本,本函数为 ImageF 变体

    to_rgb

    fn to_rgb(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    去除 alpha 通道(RGBA → RGB,channels=3)

    to_rgb_16

    fn to_rgb_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 去除 alpha 通道(RGBA → RGB,channels=3) @see to_rgb 8-bit 版本,本函数为 Image16 变体

    to_rgb_f

    fn to_rgb_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 去除 alpha 通道(RGBA → RGB,channels=3) @see to_rgb 8-bit 版本,本函数为 ImageF 变体

    to_rgba

    fn to_rgba(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    添加 alpha 通道(RGB → RGBA,channels=4,alpha=255)

    to_rgba_16

    fn to_rgba_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 添加 alpha 通道(RGB → RGBA,channels=4,alpha=65535) @see to_rgba 8-bit 版本,本函数为 Image16 变体

    to_rgba_f

    fn to_rgba_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 添加 alpha 通道(RGB → RGBA,channels=4,alpha=1.0) @see to_rgba 8-bit 版本,本函数为 ImageF 变体

    transpose_16

    fn transpose_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16

    16-bit 转置。交换宽高,(x,y) -> (y,x)。 @see transpose 8-bit 版本,本函数为 Image16 变体

    transpose_f

    fn transpose_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF

    float 转置。交换宽高,(x,y) -> (y,x)。 @see transpose 8-bit 版本,本函数为 ImageF 变体

    unpremultiply_alpha

    fn unpremultiply_alpha(img :
    core
    /types.Image) ->
    core
    /types.Image raise
    core
    /types.LoadError

    反预乘 alpha(RGBA premA → RGBA unpremultiplied) 要求 channels=4

    unpremultiply_alpha_16

    fn unpremultiply_alpha_16(img :
    core
    /types.Image16) ->
    core
    /types.Image16 raise
    core
    /types.LoadError

    16-bit 反预乘 alpha(RGBA premA → RGBA unpremultiplied)。要求 channels=4。 @see unpremultiply_alpha 8-bit 版本,本函数为 Image16 变体

    unpremultiply_alpha_f

    fn unpremultiply_alpha_f(img :
    core
    /types.ImageF) ->
    core
    /types.ImageF raise
    core
    /types.LoadError

    float 反预乘 alpha(RGBA premA → RGBA unpremultiplied)。要求 channels=4。 @see unpremultiply_alpha 8-bit 版本,本函数为 ImageF 变体

    unsharp_mask_enhance

    fn unsharp_mask_enhance(img :
    core
    /types.Image, amount : Double, radius : Int) ->
    core
    /types.Image raise
    core
    /types.LoadError

    非锐化掩膜(USM)锐化

    warp_affine

    fn warp_affine(img :
    core
    /types.Image, matrix : (Float, Float, Float, Float, Float, Float), new_w : Int, new_h : Int) ->
    core
    /types.Image

    仿射变换。matrix = (a, b, c, d, e, f) 映射 dst→src: 仿射逆映射 src_x = a * dst_x + b * dst_y + c 仿射逆映射 src_y = d * dst_x + e * dst_y + f 使用双线性插值,超出边界的像素 clamp 到边缘。 输出尺寸为 new_w × new_h,通道数与输入相同。

    warp_affine_16

    fn warp_affine_16(img :
    core
    /types.Image16, matrix : (Float, Float, Float, Float, Float, Float), new_w : Int, new_h : Int) ->
    core
    /types.Image16

    16-bit 仿射变换。 @see warp_affine 8-bit 版本,本函数为 Image16 变体

    warp_affine_f

    fn warp_affine_f(img :
    core
    /types.ImageF, matrix : (Float, Float, Float, Float, Float, Float), new_w : Int, new_h : Int) ->
    core
    /types.ImageF

    float 仿射变换。 @see warp_affine 8-bit 版本,本函数为 ImageF 变体

    warp_perspective

    fn warp_perspective(img :
    core
    /types.Image, matrix :
    process
    /transform.PerspectiveMatrix, new_w : Int, new_h : Int) ->
    core
    /types.Image

    透视变换。使用 3×3 矩阵将图像变换到 new_w × new_h。 采用 dst→src 映射 + 双线性插值。

    warp_perspective_16

    fn warp_perspective_16(img :
    core
    /types.Image16, matrix :
    process
    /transform.PerspectiveMatrix, new_w : Int, new_h : Int) ->
    core
    /types.Image16

    16-bit 透视变换。 @see warp_perspective 8-bit 版本,本函数为 Image16 变体

    warp_perspective_f

    fn warp_perspective_f(img :
    core
    /types.ImageF, matrix :
    process
    /transform.PerspectiveMatrix, new_w : Int, new_h : Int) ->
    core
    /types.ImageF

    float 透视变换。 @see warp_perspective 8-bit 版本,本函数为 ImageF 变体

    watermark_default_config

    fn watermark_default_config() ->
    domain
    /watermark.WatermarkConfig

    创建默认水印配置

    watermark_psnr

    fn watermark_psnr(original :
    core
    /types.Image, watermarked :
    core
    /types.Image) -> Double

    计算水印图像的 PSNR(峰值信噪比)

    watermark_robustness_test

    fn watermark_robustness_test(watermarked :
    core
    /types.Image, original_watermark :
    core
    /types.Image, noise_level? : Double) -> Double

    水印鲁棒性测试(添加噪声后提取水印,计算相似度)

    xyz_to_rgb

    fn xyz_to_rgb(x : Float, y : Float, z : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    XYZ → RGB(sRGB, D65 白点)。输入范围 0.0-1.0。

    xyz_to_rgb_16

    fn xyz_to_rgb_16(x : Float, y : Float, z : Float) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit XYZ → RGB。输入 x,y,z ∈ [0,1],输出 r,g,b ∈ [0,65535] @see xyz_to_rgb 8-bit 版本,本函数为 Image16 变体

    xyz_to_rgb_f

    fn xyz_to_rgb_f(x : Float, y : Float, z : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float XYZ → RGB。输入 x,y,z ∈ [0,1],输出 r,g,b ∈ [0,1] @see xyz_to_rgb 8-bit 版本,本函数为 ImageF 变体

    ycbcr_to_rgb

    fn ycbcr_to_rgb(y : Int, cb : Int, cr : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    YCbCr → RGB(ITU-R BT.601)。输入范围 0-255。

    ycbcr_to_rgb_16

    fn ycbcr_to_rgb_16(y : Int, cb : Int, cr : Int) -> (Int, Int, Int) raise
    core
    /types.LoadError

    16-bit YCbCr → RGB(ITU-R BT.601)。输入范围 0-65535。 @see ycbcr_to_rgb 8-bit 版本,本函数为 Image16 变体

    ycbcr_to_rgb_f

    fn ycbcr_to_rgb_f(y : Float, cb : Float, cr : Float) -> (Float, Float, Float) raise
    core
    /types.LoadError

    float YCbCr → RGB(ITU-R BT.601)。输入范围 0.0-1.0。 @see ycbcr_to_rgb 8-bit 版本,本函数为 ImageF 变体

    Source Files