Take the 2-minute tour ×

Now I work on Canon EDSDK for myself. I get liveview image to very slow (5 image per second). How can I do it faster?.

This is my code for getting pointer to image:

    uint _err = EDSDK.EDS_ERR_OK;
    IntPtr imageRef = IntPtr.Zero;
    IntPtr streamRef = IntPtr.Zero;
    IntPtr streamPtr = IntPtr.Zero;
    uint Length = 0;

    _err = EDSDK.EdsCreateMemoryStream(0, out streamRef);
    if (EDSDK.EDS_ERR_OK == _err)
      _err = EDSDK.EdsCreateEvfImageRef(streamRef, out imageRef);

    if (EDSDK.EDS_ERR_OK == _err)
      _err = EDSDK.EdsDownloadEvfImage(_camera, imageRef);          

    if (EDSDK.EDS_ERR_OK == _err)
      // display image
      _err = EDSDK.EdsGetPointer(streamRef, out streamPtr);
      if (EDSDK.EDS_ERR_OK == _err)
        _err = EDSDK.EdsGetLength(streamRef, out Length);

then I load image to Bitmap and it's very very slow. My code:

    byte[] b = new byte[Length];
    Marshal.Copy(streamPtr, b, 0, (int)Length);
    using ( MemoryStream ac = new MemoryStream(b))
      img = (Bitmap)Image.FromStream(ac);

share|improve this question
HEEEELP PLEASE!!! Very slow code is decoding JPEG. How to make it faster? –  user1920116 Jan 23 '13 at 17:11

2 Answers 2

Have you tried using the EdsGetImage method to extract the image data from the memory stream?

In order to use this method you will need to create an additional Image Reference from the memory stream after you use the EdsDownloadEvf method (using the EdsCreateImageRef method). You may then use this Image Reference in the EdsGetImage method to extract the uncompressed Image Data.

share|improve this answer
EdsGetImage return Invalid Parameter for EvfImageRef –  user1920116 Feb 9 '13 at 9:56
No, it's not work :( May be anything else? –  user1920116 Feb 11 '13 at 20:03

libjpeg-turbo, available here http://libjpeg-turbo.virtualgl.org/ will decode in real-time

share|improve this answer

Your Answer


