简体   繁体   中英

Canon EDSDK - Multiple cameras - Take photo simultaneously

I am using this library: https://www.codeproject.com/Articles/688276/Canon-EDSDK-Tutorial-in-Csharp

I have multiple cameras (Canon EOS 1300D). I load them with API:

CanonAPI canonAPI = new CanonAPI();
List<Camera> cameras = canonAPI.GetCameraList();

then I make some settings (to save files in PC, not in cameras and open session). After that I want to make multiple Photos at once. Like as close to each other. Right now all I can think of is this:

foreach (Camera camera in cameras)
{
    camera.TakePhotoAsync();
}

Sadly, this approach has a little delay. But in multiple cameras (5) that delay is somewhat 200-300ms (I think, don't remember), and that is too big.

Another info: For taking photo I use WPF and button. Cameras are connected through usb hub, have no SD card and I am saving photos directly to computer. Everything works, I need to take photos at once.

Try using a Parallel loop

Parallel.ForEach(cameras , camera =>
{
     //Your stuff
});

be careful using Parallel loops while using files and threads. you can read about Parallel loops

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM