修复 gocv 中 GLCM 调用的方法
时间:2024-02-24
浏览:382
作者:佚名
偷偷努力,悄无声息地变强,然后惊艳所有人!哈哈,小伙伴们又来学习啦~今天我将给大家介绍《修复 gocv 中 GLCM 调用的方法》,这篇文章主要会讲到等等知识点,不知道大家对其都有多少了解,下面我们就一起来看一吧!当然,非常希望大家能多多评论,给出合理的建议,我们一起学习,一起进步!
问题内容
这是我使用 gocv 生成 glcm 的代码,图像处理包的功能对于这个问题并不重要,它们从文件夹中读取图像。 我试图从第三个图像(images[2])获取 glcm,但运行时出现获取错误。 我该如何解决它?
package main
import (
"./imageprocessing"
"gocv.io/x/gocv"
// "fmt"
)
/** CovarFlags
// CovarScrambled indicates to scramble the results.
CovarScrambled CovarFlags = 0
// CovarNormal indicates to use normal covariation.
CovarNormal CovarFlags = 1
// CovarUseAvg indicates to use average covariation.
CovarUseAvg CovarFlags = 2
// CovarScale indicates to use scaled covariation.
CovarScale CovarFlags = 4
// CovarRows indicates to use covariation on rows.
CovarRows CovarFlags = 8
// CovarCols indicates to use covariation on columns.
CovarCols CovarFlags = 16
**/
/**
*
* @brief { function_description }
* @return { description_of_the_return_value }
*/
func main() {
var size int
size = imageprocessing.FolderLength("./imageprocessing/Images/danger")
Images := make([]gocv.Mat,size)
GLCM := gocv.NewMat()
mean := gocv.NewMat()
imageprocessing.ReadFolder(Images,"./imageprocessing/Images/danger",true,false,true)
//CalcCovarMatrix(samples Mat, covar *Mat, mean *Mat, flags CovarFlags, ctype MatType)
gocv.CalcCovarMatrix(Images[2], &GLCM, &mean, gocv.CovarCols, Images[2].Type())
window := gocv.NewWindow("Images[2]")
window.IMShow(Images[2])
window.WaitKey(0)
window.IMShow(GLCM)
window.WaitKey(0)
}解决方案
我将 rgb 图像传递给该函数,我认为该函数会自动处理此问题。 我没有正确阅读功能规范。这就是问题所在。
imageprocessing.ReadFolder(Images,"./imageprocessing/Images/danger",true,false,false) func ReadFolder(Images []gocv.Mat, folder string, print bool, show bool, colorfull bool)
以上就是本文的全部内容了,是否有顺利帮助你解决问题?若是能给你带来学习上的帮助,请大家多多支持golang学习网!更多关于Golang的相关知识,也可关注golang学习网公众号。
本文内容来源于互联网,如有侵权请联系删除。
近期热门
11.18
11.15
站内热门
最新文章
12.01
热门专题
