C code example for Canon EDSDK Liveview?

Is there anyone with the working part of the C code sample that implements LiveView using Canon EDSDK? The sample code in the documentation looks great until you get to this bit:

// // Display image // 

Yes it is. They do not show how to use a BLT image in a window using data received from the camera. They just say: "Show image." Thanks, Canon.

I have been hunting the Internet (including this forum), but I have not yet found a sample C code that shows how to do this. I try to avoid MFC, VB, managed code, or C #. Is it really possible to do vanilla C, right? Vanilla C ++ is great too.

Thanks FredP

+7
c sample edsdk
source share
1 answer

There are two functions that they don’t tell you about:
1) EdsGetPointer
2) EdsGetLength

This will give you a pointer to the start of the JPEG stream and size accordingly.

Once you use LibJPEG Turbo to unpack, Libjpeg simply not fast enough.

After unpacking, you can show the image using opencv .

 bool CanonCamera::downloadLiveViewImage() { EdsError err = EDS_ERR_OK; EdsEvfImageRef image = NULL; EdsStreamRef stream = NULL; unsigned char* data = NULL; unsigned long size = 0; err = EdsCreateMemoryStream(0, &stream); if (err != EDS_ERR_OK) { cout << "Download Live View Image Error in Function EdsCreateMemoryStream: " << err << "\n"; return false; } err = EdsCreateEvfImageRef(stream, &image); if (err != EDS_ERR_OK) { cout << "Download Live View Image Error in Function EdsCreateEvfImageRef: " << err << "\n"; return false; } err = EdsDownloadEvfImage(cameraRef, image); if (err != EDS_ERR_OK) { cout << "Download Live View Image Error in Function EdsDownloadEvfImage: " << err << "\n"; return false; } err = EdsGetPointer(stream, (EdsVoid**)& data); if (err != EDS_ERR_OK) { cout << "Download Live View Image Error in Function EdsGetPointer: " << err << "\n"; return false; } err = EdsGetLength(stream, &size); if (err != EDS_ERR_OK) { cout << "Download Live View Image Error in Function EdsGetLength: " << err << "\n"; return false; } // libjpegTurbo(data, size); // display RGB image in opencv if (stream != NULL) { EdsRelease(stream); stream = NULL; } if (image != NULL) { EdsRelease(image); image = NULL; } data = NULL; return true; } 
+4
source share

All Articles