⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.m

📁 该文件架下一共有4个matlab程序。结合到一起可以实现在matlab下实现选中ORL库的一幅图像然后找出与之最相近3张照片并显示出来。
💻 M
字号:
function [rle,rab] = Test( num,testData,eigenVector,meanData,new_data,threshold)%TEST Summary of this function goes here%   Detailed explanation goes here% rle is the index of the picture that the th lower than threshold% rab is the index of the picture that the th higher than thresholdtest=testData-meanData;test=test*eigenVector;m=size(new_data);result=zeros(1,num);min=zeros(1,num);for i=1:num    temp=test-new_data(i,:);    d=temp*temp';    d=d^(2\1);    min(i)=d;    result(i)=i;    for k=i:-1:2        if(min(k-1)>d)            tmp=min(k-1);            min(k-1)=d;            min(k)=tmp;            r=result(k-1);            result(k-1)=i;            result(k)=r;        else            break;        end    endendfor j=num+1:m    temp=test-new_data(j,:);    d=temp*temp';    d=d^(2\1);    r=find(min>d);    if isempty(r)==0        for l=num:-1:r(1)+1            min(l)=min(l-1);            result(l)=result(l-1);        end        min(r(1))=d;        result(r(1))=j;    endendrle=zeros(0);rab=zeros(0);rr=find(min>threshold);if isempty(rr)==0    rab=result(rr(1):num);    if rr(1)>1        rle=result(1:(rr(1)-1));    endelse    rle=result;end    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -