27-09-21, 11:40 AM
كود :
Private Sub SurroundingSub()
Dim output = detectionNet.Forward()
Dim detectionMat = New Mat(output.Size(2), output.Size(3), MatType.CV_32F, output.Ptr(0))
For i As Integer = 0 To detectionMat.Rows - 1
Dim confidence As Single = detectionMat.At(Of Single)(i, 2)
If confidence > 0.6 Then
Dim classid As Integer = CInt(detectionMat.At(Of Single)(i, 1))
If classid < Me.labelNames.Length AndAlso (classid = 1) Then
Dim x1 As Integer = CInt((detectionMat.At(Of Single)(i, 3) * frameWidth))
Dim y1 As Integer = CInt((detectionMat.At(Of Single)(i, 4) * frameHeight))
Dim x2 As Integer = CInt((detectionMat.At(Of Single)(i, 5) * frameWidth))
Dim y2 As Integer = CInt((detectionMat.At(Of Single)(i, 6) * frameHeight))
End If
End If
Next
End Sub