matlab - MATLAB - 'lib\sift\bin\siftfeat' 未被识别为内部或外部命令、可运行程序或批处理文件
问题描述
% thresholds used for g2NN test
dr2 = 0.5;
extract_feat = 1; % by default extract SIFT features using Hess' code
if(exist('filesift','var') && ~strcmp(filesift,'nofile'))
extract_feat = 0;
end
tic; % to calculate proc time
%C:\python36\Disso\sift-forensic-master
if extract_feat
sift_bin = fullfile('lib','sift','bin','siftfeat'); % e.g. 'lib/sift/bin/siftfeat' in linux
[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
if status1 ~=0
error('error calling executables');
end
% import sift descriptors
[num, locs, descs] = import_sift(desc_file);
system(['rm ' desc_file]);
else
% import sift descriptors
[num, locs, descs] = import_sift(filesift);
end
if (num==0)
p1=[];
p2=[];
tp=[];
else
p1=[];
p2=[];
num=0;
% load data
loc1 = locs(:,1:2);
%scale1 = locs(:,3);
%ori1 = locs(:,4);
des1 = descs;
% descriptor are normalized with norm-2
if (size(des1,1)<15000)
des1 = des1./repmat(sqrt(diag(des1*des1')),1,size(des1,2));
else
des1_norm = des1;
for j= 1 : size(des1,2)
des1_j = des1_norm(j,:);
des1_norm(j,:) = des1_j/norm(des1_j,2);
end
des1 = des1_norm;
end
% sift matching
des2t = des1'; % precompute matrix transpose
if size(des1,1) > 1 % start the matching procedure iff there are at least 2 points
for i = 1 : size(des1,1)
dotprods = des1(i,:) * des2t; % Computes vector of dot products
[vals,indx] = sort(acos(dotprods)); % Take inverse cosine and sort results
j=2;
while vals(j)<dr2* vals(j+1)
j=j+1;
end
for k = 2 : j-1
match(i) = indx(k);
if pdist([loc1(i,1) loc1(i,2); loc1(match(i),1) loc1(match(i),2)]) >10
p1 = [p1 [loc1(i,2); loc1(i,1); 1]];
p2 = [p2 [loc1(match(i),2); loc1(match(i),1); 1]];
num=num+1;
end
end
end
end
tp = toc; % processing time (features + matching)
if size(p1,1)==0
fprintf('Found %d matches.\n', num);
else
p=[p1(1:2,:)' p2(1:2,:)'];
p=unique(p,'rows');
p1=[p(:,1:2)'; ones(1,size(p,1))];
p2=[p(:,3:4)'; ones(1,size(p,1))];
num=size(p1,2);
fprintf('Found %d matches.\n', num);
end
end
大家好,我已经上传了上面用于复制移动伪造检测的代码。在运行代码时,我遇到了几个错误。我还上传了我无法修复的错误片段。我还联系了编写此代码的人,他回复我以下消息:“您需要根据您的操作系统编译文件夹 bin/sift 中的第三方库。”。
我希望在这里找到解决方案。
错误片段
解决方案
推荐阅读
- mysql - 如何连接 3 个表,其中一个表映射来自其他两个表的 id?
- php - PHP:从数组中设置一个(深)数组键
- php - 在我的邮件 php 中出现错误,不知道如何更正
- java - 捕获 IllegalArgumentException 是否很好
- html - 如何在html(不是css)中使图像变暗
- reactjs - 验证步进组件的子表单
- javascript - 网页抓取使用 JavaScript 呈现内容的网页
- java - 如何修复“401 未经授权。未提供 Api 密钥”
- c - C:函数不更新全局数组(使用 strcpy / malloc)
- qt - 如何创建自定义 ListView Qt?