matlab用于算法的初步验证简单方便,但其对RGBD相机的支持不太成熟。
用 Camillo Taylor开发的Matlab Wrapper for OpenNI 2.2,可以是Matlab通过OpenNI为RGBD相机提供了一个通用的接口,下载链接如下:
ttps://www.mathworks.com/matlabcentral/fileexchange/42127-matlab-wrapper-for-openni-2-2
用方法简介:
首先在奥比开发者社区,下载OpenNI 2.2及以上版本,链接如下:
ttps://developer.orbbec.com.cn/develop_details.html?id=1
%% Directories copied from OpenNIDevEnvironment
OPENNI2_INCLUDE = 'D:\OpenNI-Windows-x64-2.3.0.63\Include'; %修改为自己的路径
OPENNI2_REDIST = 'D:\OpenNI-Windows-x64-2.3.0.63\Lib'; %修改为自己的路径
%% Compile call
mex(['-L' OPENNI2_REDIST],'-lOpenNI2',['-I' OPENNI2_INCLUDE],'mxNI.cpp');
使用:
编译之后,可以键入 mxNI 以查看可以执行的操作。
mxNI
The mxNI function operates as a switchyard function where the first operand, opid, should be an integer
which selects the operation to be performed.
Possible operations:
mxNI(0) - Initializes the device - nothing returned
mxNI(1) - Closes the device - nothing returned
[frame, frame_index, timestamp] = mxNI(2) - Acquires a depth frame
[frame, frame_index, timestamp] = mxNI(3) - Acquires an image frame
mxNI(4) - Toggle image to depth registration off
mxNI(5) - Toggle image to depth registration on
mxNI(10) - Print out current device settings
mxNI(11) - Enumerate all available depth videoModes
mxNI(12) - Enumerate all available color videoModes
mxNI(13, <videoModeId>) - Set the depth video mode
mxNI(14, <videoModeId>) - Set the color video mode
注:目前仅支持单相机,需要连个深度相机的可以将mx
NI.cpp中的彩色图像改为深度,输出两路深度。
备注:
点击下面链接,进入奥比中光开发者社区,了解更多3D视觉技术信息:
https://developer.orbbec.com.cn/
或扫描下方二维码,进入奥比中光开发者社区: