Capturing Depth image from Stereo Vision using Matlab
You will find the complete source code on Stereolabs’ Github page.
If you simply want to use the ZED stereo camera with Matlab (without the ZED SDK) you can refer to this article.
You must have Matlab installed on your system and of course, the ZED SDK needs to be installed too.
Open a terminal in zed-Matlab directory and execute the following command:
export MATLAB_ROOT=/usr/local/MATLAB/R2012b mkdir build cd build cmake ../src make make install
In cmake GUI, set ‘where is the source code’ as ‘zed-matlab\src’ and ‘Where to build the binairies ‘ as ‘zed-matlab\build’.
Then be sure to specify a x64 version of Visual Studio, the ZED SDK is only compatible with x64 compiler. Click ‘Configure’, you may encounter an error saying ‘MATLAB not found…nothing will be built.’, don’t worry, you juste need to specify the variable ‘MATLAB_ROOT’ (ex : MATLAB_ROOT=C:/Program Files/MATLAB/R2014b).
Click, ‘Generate’, then go to the folder build and open ‘MEX.sln’ with visual studio. Set the Solution Configuration to Release and build mexZED, then build INSTALL.
Run the sample
You can now find the generated MEXA file in the matlab directory (e.g. ‘\zed-matlab\matlab’), you can launch Matlab and run the ZED_Camera.m file.