佳能摄像机拍照前的的视频预览(EDSDKv2.8)
wzckr 2011-10-26 06:40:00 我用的像机是Eos450D
我在它的文档上已经找到了一个代码
EdsError startLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , , sizeof(device), &device );
// PC live view starts by setting the PC as the output device for the live view image.
if(err == EDS_ERR_OK)
{
device |= kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
// A property change event notification is issued from the camera if property settings are made successfully.
// Start downloading of the live view image once the property change notification arrives.
}
EdsError downloadEvfData(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
EdsStreamRef stream = NULL;
EdsEvfImageRef = NULL;
// Create memory stream.
err = EdsCreateMemoryStream( 0, &stream);
// Create EvfImageRef.
if(err == EDS_ERR_OK)
{
err = EdsCreateEvfImageRef(stream, &evfImage);
}
// Download live view image data.
if(err == EDS_ERR_OK)
{
err = EdsDownloadEvfImage(camera, evfImage);
}
// Get the incidental data of the image.
if(err == EDS_ERR_OK)
{
// Get the zoom ratio
EdsUInt32 zoom;
EdsGetPropertyData(erfImage kEdsPropID_Evf_ZoomPosition, 0 , sizeof(zoom), &zoom);
// Get the focus and zoom border position
}
//
// Display image
//
// Release stream
if(stream != NULL)
{
EdsRelease(stream);
Stream = NULL;
}
// Release evfImage
if(evfImage != NULL)
{
EdsRelease(evfImage);
evfImage = NULL;
}
}
EdsError endLiveview(EdsCameraRef camera)
{
EdsError err = EDS_ERR_OK;
// Get the output device for the live view image
EdsUInt32 device;
err = EdsGetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , , sizeof(device), &device );
// PC live view ends if the PC is disconnected from the live view image output device.
if(err == EDS_ERR_OK)
{
device &= ~kEdsEvfOutputDevice_PC;
err = EdsSetPropertyData(camera, kEdsPropID_Evf_OutputDevice, 0 , sizeof(device), &device);
}
}
这里有几个问题,第一是我不知道怎么把这个内容变成vb.net的,还有就是我想这一段也是不完整的,因为我找不到怎么把窗体的内容,就是说这个视频要显示在一个窗体里面,或是一个PictureBox或Panel之类的控件里面,怎么指定这个控件好象也没在上面这段代码上找到,有没有人帮个忙,能给我一段比较完整的代码,最好是我复制进去后就可以运行的,谢谢了。