2.5.2 Je suis en train de faire 1 de deux choses, le nombre de préférence 1:Live View avec Canon EDSDK VB.NET
Allumez le Live View en utilisant VB.NET et le Canon EDSDK et rendre 2.5.2 la sortie en direct dans une application Windows Forms. Actuellement j'essaye de le mettre à une boîte d'image; Cependant, je suis ouvert à des suggestions à coup sûr.
La deuxième option consisterait à activer au moins la vue en direct et à la diffuser via la sortie vidéo de la caméra vers un moniteur. Je veux vraiment accomplir la première cependant! Voici mon code actuel, aidez-moi!
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
Pouvez-vous décrire plus en détail ce qui ne fonctionne pas, comment cela ne fonctionne pas (messages d'erreur détaillés, sur quelle ligne il échoue et autres)? –
Il échoue sur cette ligne: err = EdsCreateImageRef (flux, outMemoryRef) avec ERR_FILE_FORMAT_NOT_RECOGNIZED Toute aide est grandement appréciée ... –