I’m trying to develop a windows application using Visual Basic to capture phots from my WebCam, Here I’m using EmguCV wrap library below is my code which is resulting in “Overload resolution failed because no accessible ‘New’ can be called with these arguments”. Any anyone suggest how to resolve this error? Thank You
`
Imports Emgu.CV
Imports Emgu.CV.Structure
Imports Emgu.CV.CvEnum
Imports System.Drawing
Imports System.Globalization
Public Class WebCamForm
Private capture As VideoCapture
Public ReadOnly Property InstalledUICulture As CultureInfo
Private Sub PhotoCaptureForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Initialize the Capture object for webcam access
capture = New VideoCapture()
End Sub
Private Sub Button_CapturePhoto_Click(sender As Object, e As EventArgs) Handles Button_CapturePhoto.Click
' Capture a frame from the webcam
Dim currentFrame As Mat = capture.QueryFrame()
If currentFrame IsNot Nothing Then
' Convert the Mat object to an Image(Of Bgr, Byte) object
Dim imageFrame As Image(Of Bgr, Byte) = currentFrame.ToImage(Of Bgr, Byte)()
' Convert the Image(Of Bgr, Byte) object to a Bitmap object
Dim bitmapFrame As Bitmap = New Bitmap(imageFrame)
' Display the captured image in the PictureBox
PictureBox1.Image = bitmapFrame
' Save the captured image to a file
Dim fileName As String = "captured_photo.jpg"
bitmapFrame.Save(fileName)
End If
End Sub
Private Sub PhotoCaptureForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
' Release the resources associated with the Capture object
If capture IsNot Nothing Then
capture.Dispose()
End If
End Sub
End Class
`
Error Msg that I got:
Severity Code Description Project File Line Suppression State Error (active) BC30518 Overload resolution failed because no accessible 'New' can be called with these arguments: 'Public Overloads Sub New(filename As String)': Value of type 'Image(Of Bgr, Byte)' cannot be converted to 'String'. 'Public Overloads Sub New(stream As Stream)': Value of type 'Image(Of Bgr, Byte)' cannot be converted to 'Stream'. 'Public Overloads Sub New(original As Image)': Value of type 'Image(Of Bgr, Byte)' cannot be converted to 'Image'. IFAB_Control_Center C:UsersusersourcereposIFABWebCamForm.vb 25