Camera Hacker

:

Add Comment | Related Links | TrackBack
Related Content

EdsDownload problem with 2.7 EDSDK

Hi, I am trying to build an C# application using 2.7 EDSDK.

While same code works fine with 2.6 version I'm having issues when calling EdsDownload when image is captured, error returned is EDS_ERR_STREAM_READ_ERROR.
Basically I have very simple test app, init sdk, open a session with camera, register callbacks and trigger a capture. When objectHandler event is raised I'm waiting for ObjectEvent_DirItemCreated and then I download an image. When using 2.6 all working fine, 2.7 is failing.

Anyone experiencing the same?

Thanks

Denis
Wed, 20 Jan 2010 14:09:03 +0000

Yes, I see the same behaviour. With 2.7 I get STREAM_READ_ERROR, with 2.6 I don't.

John

John
Sun, 07 Feb 2010 06:23:17 +0000

Hi John,

I got the same error and wondering if you resolved it.

Cheers, Viktor.

Viktor Trush
Wed, 17 Feb 2010 04:28:06 +0000

Hi there,
I have the same problem. It's realy disappointing because I use a 7D. I wrote an email to canon. We will see...

Mike
Wed, 17 Feb 2010 22:26:40 +0000

Same here, this is very anoying. Please post answer if you solved this. Thanks.

Guy
Sun, 21 Feb 2010 21:19:47 +0000

Hey guys, got a partial workaround. In my case, I just want to take a picture and save it to my hard drive, and you can do this by setting kEdsPropID_SaveTo to kEdsSaveTo_Host. Then, instead of listening for a ObjectEvent_DirItemCreated message, you wait for a kEdsObjectEvent_DirItemRequestTransfer message.

Essentially, with the previous approach I was saving to my SD card during capture and then copying from there to my PC, whereas now it's going straight to my PC. This doesn't solve the problem of reading from your storage card, but if all you want to do is capture, this should work for you.

PS: Btw, I only get my original error when capturing raw files. Jpeg files would work just fine.

J H
Wed, 24 Feb 2010 10:30:54 +0000

I too was see this, but if you read the EdsDownload description in the API documentation it states

"Downloads a file on a remote camera (in the camera memory or on a memory card) to the host computer. The downloaded file is sent directly to a file stream created in advance.
When dividing the file being retrieved, call this API repeatedly. Also in this case, make the data block size a multiple of 512 (bytes), excluding the final block."

the following snippet works great for me

        if (err == EDSDK.EDS_ERR_OK) {
// according to the 2.7 API documentation we must use a multiple of 512 bytes except for
// the final block
uint blockSize = 1024 * 1024; // 1MB at a time
uint remainingBytes = dirInfo.Size;

do {
if (remainingBytes < blockSize) {
blockSize = (uint)(remainingBytes / 512) * 512;
}
remainingBytes -= blockSize;
err = EDSDK.EdsDownload(inRef, blockSize, streamRef);
Debug.WriteLine(String.Format("CreateFileStream = {0:X}", err));
Debug.WriteLineIf(err == 0, String.Format("Download in progress [{0} bytes remaining]",remainingBytes.ToString()));
} while (remainingBytes > 512);
// now we need to download the final block
err = EDSDK.EdsDownload(inRef, remainingBytes, streamRef);
}

MikeInOhio
Thu, 04 Mar 2010 03:46:35 +0000

I had the same problem, I have only EDSDK 2.7, and it actually works just fine on another Macbook than mine...
Mine sometime has problems with the USB (synchronizing with my iPhone fails very easily)

I lost quite a lot of time, so maybe that can help someone.

Raphael
Mon, 10 May 2010 19:55:28 +0000

You havn't understand the SDK :(
here is an C++ example

1. If you want to download an Image directly after taking a shot from the Camera, your cameraRef has to be set to Save the File firstly in the Camera Buffer (set i to 2 or 3):

i=1 // Save to Memorycard
i=2 // Save to Buffer <---
i=3 // Buffer + MemCard <---
setProperty(camera, kEdsPropID_SaveTo, i , 0);

You can test if this works, when you taking a shot and then switch of the camera. There shoud be a warning on the Camera LCD that the camera has to transfer images (from the camera buffer to the host pc)

2. Then you have to register an Object-Event handler and catch the Event "kEdsObjectEvent_DirItemRequestTransfer"

EdsError EDSCALLBACK handleObjectEvent(EdsObjectEvent event, EdsBaseRef object, EdsVoid * context)
{
if(event == kEdsObjectEvent_DirItemRequestTransfer){
transferImage(object);
}

}

3. The last thing is to save the data from the Camera Buffer to the Host PC (you dont have to care about JPEG+RAW both files will be transfered with this code)

void transferImage(EdsBaseRef object){

EdsStreamRef stream = NULL;
EdsDirectoryItemRef PictureFromCamBuffer = object;
EdsDirectoryItemInfo PictureFromCamBufferInfo;

EdsGetDirectoryItemInfo(PictureFromCamBuffer, &PictureFromCamBufferInfo);

//Create Outputfile(s)
EdsCreateFileStream(PictureFromCamBufferInfo.szFileName, kEdsFileCreateDisposition_CreateAlways, kEdsAccess_ReadWrite, &stream);

EdsDownload( PictureFromCamBuffer, PictureFromCamBufferInfo.size, stream);
EdsDownloadComplete(PictureFromCamBuffer);

// Release stream
if (stream != NULL) {
EdsRelease(stream);
stream = NULL;
}
}

4. GOOD LUCK

LX2
Thu, 01 Nov 2012 20:58:26 +0300

5. If your camera complains "PC FULL" you schould tell the capacity of your HDD. You MUST do that after Nr.1 where you defined the saveTo Property. Code:

EdsCapacity capacity;
capacity.reset = 1;
capacity.bytesPerSector = 512*8;
capacity.numberOfFreeClusters = 36864*9999;
err = EdsSetCapacity(camera, capacity);

LX2
Fri, 02 Nov 2012 00:14:33 +0300

Hi. LX2..

I'd like to ask you about saving image from camera. Where are these output files locate in our PC ?? Thanks.

SAFIR
Fri, 08 Nov 2013 04:24:32 +0300

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 2 + 9?
Click button only once, please!

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.