VB.net-Aforge视频捕获使用ClickOnce部署应用程序时,视频未显示在图片框上

问题描述

我有这个应用程序,它可以从笔记本电脑中的集成摄像机捕获视频,当我在Visual Studio中运行它时,它可以正常工作,并且可以在pictureBox1中看到视频流,但是当我部署该应用程序时(安装程序包或ClickOnce)并运行它,相机灯打开,但pictureBox1中什么也不显示。而且没有错误消息。

请帮忙吗?

Public Sub callCam()

       PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
        fiF = New FilterInfoCollection(FilterCategory.VideoInputDevice)
        finalVideo = New VideoCaptureDevice(fiF(0).MonikerString)
        finalVideo.VideoResolution = finalVideo.VideoCapabilities(0)
        
        AddHandler finalVideo.NewFrame,New NewFrameEventHandler(AddressOf Scapture)
        finalVideo.Start()
      End Sub

Private Sub Scapture(ByVal sender As Object,ByVal eventArgs As NewFrameEventArgs)


        If ButtonVIDEO.BackColor = Color.Black Then 'In case of Preview only (No recording)

            Try
                BMP = DirectCast(eventArgs.Frame.Clone(),Bitmap) 'Put the data in the bitmap
                PictureBox1.Image = DirectCast(eventArgs.Frame.Clone(),Bitmap) 'present it in the Picture Box

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try


        Else ' In case of Recording
            Try
                BMP = DirectCast(eventArgs.Frame.Clone(),Bitmap) 'present it in the Picture Box
                VFwriter.WriteVideoFrame(BMP) 'Save in Memory

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
    End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)