elliotwoods / ofxCanon

openFrameworks addon for control and capture from Canon DSLR's via the EDSDK
37 stars 11 forks source link

open multiple cameras #3

Closed sebasobotka closed 4 years ago

sebasobotka commented 7 years ago

I tried to open two or more cameras in setup() and I got this error: [ error ] ofxCanon: Open session failed with error INTERNAL_ERROR

Is it even possible to have it?

sebasobotka commented 7 years ago

I found a bug in the listDevices() method:

...
for (int i = 0; i < cameraCount; i++) {
            EdsCameraRef camera;
                        //should be i , not 0 !
            ERROR_GOTO_FAIL(EdsGetChildAtIndex(cameraList, i, &camera), "Get the camera device");
elliotwoods commented 7 years ago

ah thank you! i think i had multiple cameras working at one point (not sure if it worked with all the functions)

however, i'm very sorry about the bug here. did you manage to fix it?

sebasobotka commented 7 years ago

Hi, yes I fixed it. I am still working on my project. i will let you know if something comes up.

sebasobotka commented 6 years ago

Hi, How many cameras were you able to connect? I've got problems with more than 30 cameras. Application freezes after few frames. I am using your Device class (not Simple) and I have got a vector of Devices. I think there is something related to updating cameras. I have 48 cameras at all. I am sure that hardware works properly and using the third part software I can manage them correctly. Using my software and your addon I can detect all 48 cameras but not drive all of them. Maybe, do you have some suggestions?

elliotwoods commented 6 years ago

Do you know where the application freezes?

sebasobotka commented 6 years ago

I don't know yet. I printed some logs in update function and it stopped working after few seconds. In setup there is only building a vector of devices. In update only updating those devices. That's all. Now I've got some hardware issues with cameras and can see only 37 cameras in the new machine (32gb) and it works. It's better. So it seems to be related to memory. But another application developed in C# works on the older machine with 16gb Ram. Do you have any ideas?

elliotwoods commented 6 years ago

I'm not sure where the memory issue would be it doesnt allocate very much per device on my side i'm curious if it's a different version of the Canon SDK underneath, which might be the source of the issue?

sebasobotka commented 6 years ago

I went back to the old machine. I am using Canon SDK version 3.6.30.0. I was wrong about one thing. I can print some logs to console when I click on the desktop but devices aren't updated anymore. I don't know how can I catch place where it stops working.

sebasobotka commented 6 years ago

When I constraint number of cameras to e.g 34 it works. More cameras crash the application. Maybe it's related to multithreading stuff which unfortunately I don't understand well yet. Maybe this line is important somewhere.

CoInitializeEx(NULL, 0x0); // COINIT_APARTMENTTHREADED in SDK docs
...
CoUninitialize();

Edit I did some mix of your addon and the ofxEdsk addon and I am able to download images from all cameras at this moment but main thread (update and draw) doesn't work anymore, Fps = 0. All camera threads work but main stops working.

natxopedreira commented 6 years ago

im planing something similar but with less cameras (10), did you found a solution?

sebasobotka commented 6 years ago

Yes, I did. Here is more info about it. https://forum.openframeworks.cc/t/canon-sdk-many-threads-main-thread-0-fps-need-advice/28687/9

natxopedreira commented 6 years ago

Thanks! i will take a look