佳能摄像机拍照前的的视频预览(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之类的控件里面,怎么指定这个控件好象也没在上面这段代码上找到,有没有人帮个忙,能给我一段比较完整的代码,最好是我复制进去后就可以运行的,谢谢了。
...全文
182 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzckr 2011-10-26
  • 打赏
  • 举报
回复
有一个问题,
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;
}
}

里的自定义的EdsEvfImageRef要怎么定义
我找的例子里面有
<StructLayout(LayoutKind.Sequential)> Public Structure EdsImageInfo
Public width As Integer '// image width
Public height As Integer '// image height

Public numOfComponents As Integer '// number of color components in image.
Public componentDepth As Integer '// bits per sample. 8 or 16.

Public effectiveRect As EdsRect
'// Effective rectangles except
'// a black line of the image.
'// A black line might be in the top and bottom
'// of the thumbnail image.

Public reserved1 As Integer
Public reserved2 As Integer

End Structure
这一类的定义,可是没有EdsEvfImageRef这个
wzckr 2011-10-26
  • 打赏
  • 举报
回复
研究中发现要自定义一个类型EdsEvfImageRef
我网上找到的程序有一些有定义比如:

<StructLayout(LayoutKind.Sequential)> Public Structure EdsImageInfo
Public width As Integer '// image width
Public height As Integer '// image height

Public numOfComponents As Integer '// number of color components in image.
Public componentDepth As Integer '// bits per sample. 8 or 16.

Public effectiveRect As EdsRect
'// Effective rectangles except
'// a black line of the image.
'// A black line might be in the top and bottom
'// of the thumbnail image.

Public reserved1 As Integer
Public reserved2 As Integer

End Structure

可是没有对EdsEvfImageRef的定义,有人能给我一下这个定义吗
宝_爸 2011-10-26
  • 打赏
  • 举报
回复
这个比较偏门了。

sdk里没有完整的例子吗?

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧