Emgu vb.net cvCalcCovarMatrix - covariance matrix empty

144 views Asked by At

I need to calculate the covariance matrix from an input image. I'm using Emgu cv with visual basic. The problem is the covariance matrix output only have 0 values.

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)

How can i solve this problem?? thanks in advance!!

0

There are 0 answers