首页 > 解决方案 > 如何使用 gocv 将图像的 Alpha 通道转换为白色?

问题描述

如何使用 gocv 将图像的 Alpha 通道转换为白色?抱歉,我找不到文档。

package main

import (
    "fmt"
    "os"

    "gocv.io/x/gocv"
)

func main() {
    inputs := "test.png"
    img := gocv.IMRead(inputs, gocv.IMReadUnchanged)
    defer img.Close()
    if img.Empty() {
        fmt.Printf("cannot read image %s\n", inputs)
        os.Exit(1)
    }
    // how to convert alpha channel of the image to white color
    gocv.Split(img)
}

标签: gogocv

解决方案


推荐阅读