我正在 Ubuntu 上研究 matlab R2013a。我指的是这段代码:
sift_bin = fullfile('lib/sift/bin/siftfeat');
[pf,nf,ef] = fileparts(filename);
desc_file = [fullfile(pf,nf) '.txt'];
im1=imread(filename);
if (size(im1,1)<=1000 && size(im1,2)<=1000)
status1 = system([sift_bin ' -x -o ' desc_file ' ' filename]);
else
status1 = system([sift_bin ' -d -x -o ' desc_file ' ' filename]);
end
但它给出了一个错误:
lib/sift/bin/siftfeat cannot execute binary file
系统调用有什么问题吗?
lib/sift/bin/siftfeat 是 sift 库的路径。
最佳答案
使用file
确保该文件是可执行文件并查看其体系结构的实用程序
system('file /bin/ls')
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xf31e99218b4d7034cf8257055686bca22f5a3c01, stripped
ans = 0
然后
uname -a
显示系统架构system('uname -a')
Linux optiPlex7010 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
ans = 0
如您所见,我有 64 位 Linux,可执行文件也是 64 位。但是,对于 32 位系统,可执行文件支持是向后兼容的。这意味着 64 位系统可以同时执行 32 位和 64 位可执行文件,但 32 位系统只能执行 32 位可执行文件。
从您的评论中,我看到您正在尝试在 32 位系统中启动 64 位可执行文件,但它无法做到这一点。您应该会找到
siftfeat
的 32 位版本或者如果可能的话,将您的操作系统更改为 64 位。
关于matlab - Ubuntu 错误 : "filename" cannot execute binary file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21645125/