How can I use Software Development Kit (SDK) in Matlab for image capture using USB camera?

4 次查看(过去 30 天)
I have a canon EOS T4i camera, I would like to capture an image without using Image Acquisition Toolbox.
I have used "videoinput" and "getsnapshot" with my webcam before and I know this approach is pretty straight forward. But now I do not have Image Acquisition Toolbox anymore.
I implemented my image capture using the Canon SDK in MS visual studio. I made an exe file from that c++ implementation and used it in Matlab, which is not what I'm looking for. (same goes with mex files)
I want something purely in Matlab, using the functions coming with the SDK.
Is it even possible?
I tried: loadlibrary('EDSDK'); (the .h file and .lib files are in my working directory) but the error is
error using loaddefinedlibrary the specified module could not be found
My problem is that the SDK comes with several dlls and header files. I don't know how/when link/include them before using the functions. Also how can I directly use c++ functions in Matlab?
This is an example of creating a .NET API in Matlab.
I would like something similar with c++.
Any help or idea is appreciated.
EDIT: (for future references) Be careful with 32 bit libraries in 64 bit Matlab (you may want to use Matlab 32bit if you have 32 bit libraries)

采纳的回答

Guillaume
Guillaume 2015-7-6
编辑:Guillaume 2015-7-6
Possibly, some dlls used by your main dll are not found. This MSDN page gives you the search path and order for dlls. Note that the application directory is most likely matlab's own directory.
You can also use the dependency walker (which used to come with visuals studio) to see all the dlls that are required by your main dll.
edit: I've just noticed that you're talking about C++. Matlab can only use the C calling convention when talking to dlls. If the exports of your C++ dll are not wrapped in extern "C" then matlab won't be able to call them.
  4 个评论
Walter Roberson
Walter Roberson 2015-7-20
dynamically loaded DLLs are usually loaded only upon need, by the operating system. The details differ between operating systems.
64 bit MATLAB can never use 32 bit libraries. That is an operating system restriction that has been true on ever 64 bit operating system I have looked at.
elham sa
elham sa 2015-7-21
Thank you both Walter and Guillaume!
Creating an exe file and placing the dlls in the folder with the exe was the workaround for me, although not the best solution!
(I guess the slowness was due to some other issues on my computer, it was resolved by several restarts.)
Thanks for your help guys!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 COM Component Integration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by