佳能EDSDK C# 编程

zhongyi_s 2016-03-08 04:37:02
佳能EDSDK,C#编程,当调用SetSetting(EDSDK.PropID_SaveTo, (uint)EDSDK.EdsSaveTo.Host);

public void SetSetting(uint PropID, uint Value)//Set 相机设置
{
if (MainCamera.Ref != IntPtr.Zero)
{
int propsize;
EDSDK.EdsDataType proptype;
//get the size of this property
Error = EDSDK.EdsGetPropertySize(MainCamera.Ref, PropID, 0, out proptype, out propsize);
//set the property
Error = EDSDK.EdsSetPropertyData(MainCamera.Ref, PropID, 0, propsize, Value);
}
else { throw new ArgumentNullException("Camera or camera reference is null/zero"); }
}
设置相机存储外设为PC时,相机屏幕上显示FULL,此时相机无法拍摄,有哪位大神指导下!
...全文
314 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
想陪你笑 2019-01-12
  • 打赏
  • 举报
回复
当我调用 EdsCreateMemoryStream 提示:对 PInvoke 函数“CameraToPic!EDSDKLib.EDSDK::EdsCreateMemoryStream”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。可知道是为何?(百度所提出的解决方案已经试遍了)
zhongyi_s 2016-03-10
  • 打赏
  • 举报
回复
引用 5 楼 tcmakebest 的回复:
给相机设置照片存储为PC或者PC+相机后,需要调用另外一个方法告诉相机有足够的存储空间,以下是摘录的源码:
/// <summary>
/// Tells the camera that there is enough space on the HDD if SaveTo is set to Host
/// This method does not use the actual free space!
/// </summary>
public void SetCapacity()
{
    lock (LVlock)
    {
        //create new capacity struct
        EDSDK.EdsCapacity capacity = new EDSDK.EdsCapacity();

        //set big enough values
        capacity.Reset = 1;
        capacity.BytesPerSector = 0x1000;
        capacity.NumberOfFreeClusters = 0x7FFFFFFF;

        //set the values to camera
        Error = EDSDK.EdsSetCapacity(Ref, capacity);
    }
}
多谢! 通过这么设置后的确可以解决PC FULL的问题!
tcmakebest 2016-03-09
  • 打赏
  • 举报
回复
给相机设置照片存储为PC或者PC+相机后,需要调用另外一个方法告诉相机有足够的存储空间,以下是摘录的源码:
/// <summary>
/// Tells the camera that there is enough space on the HDD if SaveTo is set to Host
/// This method does not use the actual free space!
/// </summary>
public void SetCapacity()
{
    lock (LVlock)
    {
        //create new capacity struct
        EDSDK.EdsCapacity capacity = new EDSDK.EdsCapacity();

        //set big enough values
        capacity.Reset = 1;
        capacity.BytesPerSector = 0x1000;
        capacity.NumberOfFreeClusters = 0x7FFFFFFF;

        //set the values to camera
        Error = EDSDK.EdsSetCapacity(Ref, capacity);
    }
}
qq_34229583 2016-03-09
  • 打赏
  • 举报
回复
引用 2 楼 xian_wwq 的回复:
把开发文档贴上来,对照核对
应该是在前面还需要做设置吧
qq_34229583 2016-03-09
  • 打赏
  • 举报
回复
文档上有这么一段话!Note • If kEdsSaveTo_Host or kEdsSaveTo_Both is used, the cam era caches the image data to be transferred until DownloadComplete or CancelDownload APIs are execut ed on the host computer (by an application). The application creates a callback function to receive camera events. If kEdsObjectEvent_DirItemRequestTransfer or kEdsObjectEvent_DirItemRequestTransferDT events are received, the application must execute DownloadComplete (after downloading) or CancelDown load (if images are not needed) for the camera.
xian_wwq 2016-03-08
  • 打赏
  • 举报
回复
把开发文档贴上来,对照核对
泡泡龙 2016-03-08
  • 打赏
  • 举报
回复
你得看佳能文档吧

111,082

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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