gpt4 book ai didi

vb.net - 使用 Canon EDSDK 2.5.2 VB.NET 实时取景

转载 作者:行者123 更新时间:2023-12-01 01:37:32 25 4
gpt4 key购买 nike

我正在尝试做两件事中的一件,偏好号 1:

使用 VB.NET 和 Canon EDSDK 2.5.2 打开实时 View 并在 Windows 窗体应用程序中呈现实时输出。目前我正在尝试将其放入图片框;但是,我肯定愿意接受建议。

第二个选项是至少打开实时 View ,并通过摄像机上的视频输出将其流式传输到监视器。

不过我真的很想完成第一个!以下是我当前的代码库,帮助!

Private Sub btnStartLiveView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartLiveView.Click

Dim err As Integer = EDS_ERR_OK


Dim prop As Integer = EdsEvfOutputDevice.kEdsEvfOutputDevice_PC
Dim proptype As Integer = EDSDKTypes.kEdsPropID_Evf_OutputDevice
'// Stock the property.'
Dim wkIntPtr As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(prop))
Marshal.StructureToPtr(prop, wkIntPtr, False)
'send property/command to the camera'
EdsSetPropertyData(model.getCameraObject(), proptype, 0, Marshal.SizeOf(prop), prop)

Dim stream As IntPtr
Dim outMemoryRef As IntPtr
Dim evfImage As IntPtr

err = EdsCreateMemoryStream(0, stream)

If err = EDS_ERR_OK Then

err = EdsCreateImageRef(stream, outMemoryRef) '(stream, evfImage)'

Else

Dim str As String = Hex(err)

MessageBox.Show(str)

End If

If err = EDS_ERR_OK Then
err = EdsDownloadEvfImage(model.getCameraObject(), evfImage)
Else

Dim str As String = Hex(err)

MessageBox.Show("&H" & str & "L") ' Shows &H2CL which = ERR_FILE_FORMAT_NOT_RECOGNIZED'
End If

' Get the Incidental Data of the Image'

If err = EDS_ERR_OK Then

Dim zoom As UInt32
Dim point As IntPtr


EdsGetPropertyData(outMemoryRef, kEdsPropID_Evf_ZoomPosition, 0, Marshal.SizeOf(zoom), zoom)

EdsGetPropertyData(outMemoryRef, kEdsPropID_Evf_ZoomPosition, 0, Marshal.SizeOf(point), point)

Else

'MessageBox.Show(err.ToString())'

End If


Dim buffer(Marshal.SizeOf(stream)) As Byte

Dim mStream As System.IO.Stream = New System.IO.MemoryStream(Marshal.SizeOf(stream))


Dim gcTime As GCHandle = GCHandle.Alloc(0, GCHandleType.Pinned)
Dim pTime As IntPtr = gcTime.AddrOfPinnedObject()
Marshal.Copy(stream, buffer, 0, Marshal.SizeOf(stream))

mStream.Write(buffer, 0, Marshal.SizeOf(stream))

Me.PictureBox1.Image = Image.FromStream(mStream)

EdsRelease(stream)
End Sub

最佳答案

我是最初发布此问题的人。我看到这里还有其他人仍在寻求答案。我已经在我的博客 http://www.overridepro.com/2009/06/28/canon-sdk-live-view/ 上发布了我们最终想出的解决方案。 .

关于vb.net - 使用 Canon EDSDK 2.5.2 VB.NET 实时取景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/895265/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com