这几天学习 Piotr's Computer Vision Matlab Toolbox,本来好好的程序有时候可以运行,有时候又会报各种奇怪的错误,而且这些问题貌似都指向matlab的mex文件。简直把人逼疯了,本来就感觉自己项目进度太慢。这一刻终于找到问题的根源了,记录一下。在Piltr的toolbox主页上有这么一行字:
Simply unzip, then add all directories to the Matlab path:
>> addpath(genpath('path/to/toolbox/')); savepath;
If needed, run the compile script for the mex files: <---
>> toolboxCompile;
Note: 64 bit Windows/Linux/Mac binaries are already included.
请注意这一行,If needed, run the compile script for the mex files: 如果必要的话,才去编译mex文件!!!
如果大家忽视这句话里的If needed,而直接去编译mex文件,那么一推的事情都来了,搞得你莫名奇妙,fix一个,又来一个更奇怪的错误,而且都是mex函数里的问题。所以重要的事情说三遍:
不要在matlab里执行命令:>> toolboxCompile
不要在matlab里执行命令:>> toolboxCompile
不要在matlab里执行命令:>> toolboxCompile
而且在编译toolbox的时候,也会出现gcc版本不匹配的警告!!!
只要将Piotr's Computer Vision Matlab Toolbox下载好,把路径都加进去就OK了。