我需要从输入图像计算协方差矩阵。 我使用Emgu cv和visual basic。 问题是协方差矩阵输出只有0个值。
Dim str As String ="C:\Users\PC\ahhh.png"
Dim original As Image(Of Bgr, Byte) = New Emgu.CV.Image(Of Bgr, Byte)(str)
Dim thresholdoriginal As Image(Of Gray, Byte)
thresholdoriginal = original.Convert(Of Gray, Byte)().ThresholdBinary(New Gray(5), New Gray(255))
Dim covar_Exp As System.IntPtr
Dim matrizOUT As Matrix(Of Single)
matrizOUT = New Matrix(Of Single)(thresholdoriginal.Rows, thresholdoriginal.Cols)
covar_Exp = matrizOUT
Dim avg_Exp As System.IntPtr
Dim p_avg As Matrix(Of Single) = New Matrix(Of Single)(1, thresholdoriginal.Cols)
avg_Exp = p_avg
Dim inputPtr_Sample() As System.IntPtr = {}
inputPtr_Sample.Initialize()
ReDim inputPtr_Sample(0)
inputPtr_Sample(0) = thresholdoriginal
cvCalcCovarMatrix(inputPtr_Sample, 1, covar_Exp, avg_Exp, COVAR_METHOD.CV_COVAR_NORMAL Or COVAR_METHOD.CV_COVAR_ROWS)
我该如何解决这个问题? 提前谢谢!!