我试图做两件事1,优先数1:

打开使用VB.NET和佳能EDSDK 2.5.2实时显示和渲染在Windows实时输出窗体应用程序。目前,我试图把它放到一个图片框;不过,我很开放的建议是肯定的。

第二个选择是将上实时显示至少转弯,并让它通过相机上的视频输出到监视器流。

我真的想虽然完成第一次!下面是我当前的代码库,帮助!

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文件
Dim camera as New Camera
camera.EstablishSession()
camera.TakePicture("C:\path\to\save.jpg")
camera.StartLiveView(me.LiveViewPictureBox)
camera.StopLiveView()
camera.FlushTransferQueue()

我想你可能会发现:

<snip>

多年来,我已收到多个电子邮件的更新的代码块,这是在GitHub作为开源:

http://github.com/superjoe30/Camlift-Controller

Camera类是在slnCamliftController / SRC / Camera.vb

一些这个代码是尴尬可怕。例如,为了得到它,为5D和7D相机的工作,我必须创建初始化SDK程序,然后崩溃的目的。可怕!我知道!这在Klugesaurus找到。这就像当你试图连接到5D或7D的,没有什么工作。有尖峰存在的一个坑。因此,我们推一个农民(的Klugesaurus)到尖峰,杀了他(失败默默),所以我们可以在整个农民的尸体行走安全。

这是丑陋和可怕,但: 它屡试不爽。 如果你不这样做,这是行不通的。 我也问过佳能多次,如果他们将释放源代码EOS Utility,它连接到5D和7D完美。他们扎实每次都拒绝了。我的同事开玩笑说,他们不希望透露,他们也正在使用Klugesaurus。 不管怎么说,我只是想给你一个头到那个讨厌的细节。

我还创建了一个Python模块与摄像机接口: http://github.com/superjoe30/pyedsdk

有代码样本此处和acomplishing它的不同的方式的讨论。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top