Visual Basic How To: Getting Frames from Video Files

Опубликовано: 20 Июнь 2026
на канале: Pillazo
14,029
20

This'll show you how to get video frames from a video file one by one using Emgu CV.

By default, your programs are 32bit, if you are using the 64bit EmguCV, you need to make your program a 64bit program. Here is how:    • Visual Basic How To: Changing from 32Bit t...  

Code:
Imports Emgu.CV
Imports Emgu.CV.Util
Imports Emgu.CV.Structure

Public Class Form1

Dim capturez As Capture

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

OpenFileDialog1.ShowDialog()

End Sub

Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk

Timer1.Enabled = True
capturez = New Capture(OpenFileDialog1.FileName.ToString)

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Try

capturez.QueryFrame()
Dim imagez As Image(Of Bgr, Byte) = capturez.RetrieveBgrFrame
PictureBox1.Image = imagez.ToBitmap
Catch ex As Exception
Timer1.Enabled = False
End Try

End Sub
End Class