从佳能相机下载图片到电脑的问题

发布于 2024-09-24 19:18:09 字数 1222 浏览 3 评论 0原文

我将 eos 佳能相机连接到电脑
我有一个应用程序,我可以远程拍照,并将图像下载到电脑,

但是当我从相机中取出SD卡时,我无法将图像从缓冲区下载到电脑

//注册objceteventcallback

err = EDSDK.EdsSetObjectEventHandler(obj.camdevice, EDSDK.ObjectEvent_All, objectEventHandler, new IntPtr(0));
              if (err != EDSDK.EDS_ERR_OK)
                 Debug.WriteLine("Error registering object event handler");

///

public uint objectEventHandler(uint inEvent, IntPtr inRef, IntPtr inContext)
        {
            switch(inEvent)
            {

                case EDSDK.ObjectEvent_DirItemCreated:

                    this.getCapturedItem(inRef);

                    Debug.WriteLine("dir item created");

                    break;
                case EDSDK.ObjectEvent_DirItemRequestTransfer:
                    this.getCapturedItem(inRef);
                    Debug.WriteLine("file transfer request event");
                    break;

                default:
                    Debug.WriteLine(String.Format("ObjectEventHandler: event {0}", inEvent));
                    break;
            }
            return 0;
        }

任何人都可以帮助我,为什么这个事件不调用,

或者我如何将图像从缓冲区下载到电脑,而相机上没有 SD 卡,

谢谢

i connected a eos canon camera to pc
i have an application that i could take picture remotly ,and download image to pc,

but when i remove the SD card from camera , i cant download image from buffer to pc

// register objceteventcallback

err = EDSDK.EdsSetObjectEventHandler(obj.camdevice, EDSDK.ObjectEvent_All, objectEventHandler, new IntPtr(0));
              if (err != EDSDK.EDS_ERR_OK)
                 Debug.WriteLine("Error registering object event handler");

///

public uint objectEventHandler(uint inEvent, IntPtr inRef, IntPtr inContext)
        {
            switch(inEvent)
            {

                case EDSDK.ObjectEvent_DirItemCreated:

                    this.getCapturedItem(inRef);

                    Debug.WriteLine("dir item created");

                    break;
                case EDSDK.ObjectEvent_DirItemRequestTransfer:
                    this.getCapturedItem(inRef);
                    Debug.WriteLine("file transfer request event");
                    break;

                default:
                    Debug.WriteLine(String.Format("ObjectEventHandler: event {0}", inEvent));
                    break;
            }
            return 0;
        }

anyone could help me , why this event does not call ,

or how i download image from buffer to pc, with out have Sd card on my camera

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你在看孤独的风景 2024-10-01 19:18:09

您可能遇到了与我昨天相同的问题:相机尝试存储图像以供以后下载,但发现没有存储卡可以存储它并立即丢弃图像。

要触发回调,您需要将相机设置为在相机初始化例程期间的某个时刻将图像保存到 PC (kEdsSaveTo_Host)。在 C++ 中,它的工作方式如下:

    EdsInt32 saveTarget = kEdsSaveTo_Host;
    err = EdsSetPropertyData( _camera, kEdsPropID_SaveTo, 0, 4, &saveTarget );

您可能需要为此构建一个 IntPtr。至少,这就是 Dmitriy Prozorovskiy 在 akadunno提示) “nofollow”>此帖子

You probably ran into the same problem as I did yesterday: the camera tries to store the image for a later download, finds no memory card to store it to and instantly discards the image.

To get your callback to fire, you need to set the camera to save images to the PC (kEdsSaveTo_Host) at some point during your camera initialization routine. In C++, it worked like this:

    EdsInt32 saveTarget = kEdsSaveTo_Host;
    err = EdsSetPropertyData( _camera, kEdsPropID_SaveTo, 0, 4, &saveTarget );

You probably need to build an IntPtr for this. At least, that's what Dmitriy Prozorovskiy did (prompted by a certain akadunno) in this thread.

饮湿 2024-10-01 19:18:09

SDK(据我所知)仅以在相机文件系统(即SD卡)上创建的对象的形式公开拍照事件。没有我熟悉的从缓冲区捕获的方法。在某种程度上这是有道理的,因为在只有少量板载内存的环境中,保持易失性内存清晰非常重要,这样才能继续拍照。一旦缓冲区被刷新到非易失性内存,您就可以与这些字节进行交互。我知道这是有限制的,但事实就是如此。

The SDK (as far as I know) only exposes the picture taking event in the form of the object being created on the file system of the camera (ie the SD card). There is not a way of which I am familiar to capture from buffer. In a way this makes sense, because in an environment where there is only a small amount of onboard memory, it is important to keep the volatile memory clear so that it can continue to take photographs. Once the buffer has been flushed to nonvolatile memory, you are then clear to interact with those bytes. Limiting, I know, but it is what it is.

慕烟庭风 2024-10-01 19:18:09

问题要求 C#,但在 Java 中,必须将属性设置为:

NativeLongByReference number = new NativeLongByReference( new NativeLong( EdSdkLibrary.EdsSaveTo.kEdsSaveTo_Host ) );
    EdsVoid data = new EdsVoid( number.getPointer() ); 
    NativeLong l = EDSDK.EdsSetPropertyData(edsCamera, new NativeLong(EdSdkLibrary.kEdsPropID_SaveTo), new NativeLong(0), new NativeLong(NativeLong.SIZE), data);

通常的下载就可以了

The question asks for C#, but in Java one will have to setProperty as:

NativeLongByReference number = new NativeLongByReference( new NativeLong( EdSdkLibrary.EdsSaveTo.kEdsSaveTo_Host ) );
    EdsVoid data = new EdsVoid( number.getPointer() ); 
    NativeLong l = EDSDK.EdsSetPropertyData(edsCamera, new NativeLong(EdSdkLibrary.kEdsPropID_SaveTo), new NativeLong(0), new NativeLong(NativeLong.SIZE), data);

And the usual download will do

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文