├── CalculateEpipolarLine_alpha2.m ├── Calculate_Dist_alpha1.m ├── CheckUniform_alpha2.m ├── DetectSIFTFeaturesANDInfo_alpha3.m ├── FD_all_alpha1.m ├── Other_Matching_All_alpha3.m ├── OthersAlgorithms ├── LLT_up │ ├── LLTA.m │ ├── LLTR.m │ ├── LLTV.m │ ├── LLTV_DMA_alpha1.m │ ├── LLT_DMA_sub_alpha1.m │ ├── LLT_P_alpha1.m │ ├── LLT_alpha1.m │ ├── LLT_init.m │ ├── demo.m │ ├── evaluate.m │ ├── initialization.m │ ├── norm2.m │ ├── plot_matches.m │ └── sift_match.m ├── SOCBV.m └── WGTM │ ├── GTM.m │ ├── RSOC_OP.m │ ├── Readme.txt │ ├── WGTM.m │ ├── WGTM_C_EXE.m │ ├── WGTM_C_Function-2015-12-08.zip │ ├── WGTM_C_Function.exe │ ├── WGTM_P_function_alpha1.m │ └── input.txt ├── ParFeatureMatching_CalcuSearchingRange_alpha2.m ├── ParFeatureMatching_FindGoodEmission_alpha2.m ├── ParFeatureMatching_FindGoodEpipolar_checkUniform_alpha1.m ├── ParFeatureMatching_ParMatching_alpha3.m ├── ParFeatureMatching_RemoveOutliers_alpha2_1.m ├── ParFeatureMatching_alpha7.m ├── RANSAC_Norm8Point.m ├── RANSAC_Norm8Point_alpha2.m ├── RANSAC_alpha1.m ├── README.md ├── SIFT_RemoveSameMatching_Sub_alpha1.m ├── SIFT_RemoveSameMatching_alpha1.m ├── Slope20180301_L.jpg ├── Slope20180301_R.jpg ├── Slope20180301_SIFTandOne2One.mat ├── vlfeat-0.9.20.rar └── vlfeat-0.9.20 ├── apps ├── phow_caltech101.m ├── recognition │ ├── encodeImage.m │ ├── experiments.m │ ├── extendDescriptorsWithGeometry.m │ ├── getDenseSIFT.m │ ├── readImage.m │ ├── setupCaltech256.m │ ├── setupFMD.m │ ├── setupGeneric.m │ ├── setupScene67.m │ ├── setupVoc.m │ ├── trainEncoder.m │ └── traintest.m └── sift_mosaic.m └── bin ├── glnx86 ├── aib ├── libvl.so ├── mser ├── sift ├── test_gauss_elimination ├── test_getopt_long ├── test_gmm ├── test_heap-def ├── test_host ├── test_imopv ├── test_kmeans ├── test_liop ├── test_mathop ├── test_mathop_abs ├── test_nan ├── test_qsort-def ├── test_rand ├── test_sqrti ├── test_stringop ├── test_svd2 ├── test_threads └── test_vec_comp ├── glnxa64 ├── aib ├── libvl.so ├── mser ├── sift ├── test_gauss_elimination ├── test_getopt_long ├── test_gmm ├── test_heap-def ├── test_host ├── test_imopv ├── test_kmeans ├── test_liop ├── test_mathop ├── test_mathop_abs ├── test_nan ├── test_qsort-def ├── test_rand ├── test_sqrti ├── test_stringop ├── test_svd2 ├── test_threads └── test_vec_comp ├── maci ├── aib ├── libvl.dylib ├── mser ├── sift ├── test_gauss_elimination ├── test_getopt_long ├── test_gmm ├── test_heap-def ├── test_host ├── test_imopv ├── test_kmeans ├── test_liop ├── test_mathop ├── test_mathop_abs ├── test_nan ├── test_qsort-def ├── test_rand ├── test_sqrti ├── test_stringop ├── test_svd2 ├── test_threads └── test_vec_comp ├── maci64 ├── aib ├── libvl.dylib ├── mser ├── sift ├── test_gauss_elimination ├── test_getopt_long ├── test_gmm ├── test_heap-def ├── test_host ├── test_imopv ├── test_kmeans ├── test_liop ├── test_mathop ├── test_mathop_abs ├── test_nan ├── test_qsort-def ├── test_rand ├── test_sqrti ├── test_stringop ├── test_svd2 ├── test_threads └── test_vec_comp ├── win32 ├── aib.exe ├── mser.exe ├── msvcr100.dll ├── sift.exe ├── test_gauss_elimination.exe ├── test_getopt_long.exe ├── test_gmm.exe ├── test_heap-def.exe ├── test_host.exe ├── test_imopv.exe ├── test_kmeans.exe ├── test_liop.exe ├── test_mathop.exe ├── test_mathop_abs.exe ├── test_nan.exe ├── test_qsort-def.exe ├── test_rand.exe ├── test_sqrti.exe ├── test_stringop.exe ├── test_svd2.exe ├── test_threads.exe ├── test_vec_comp.exe ├── vl.dll └── vl.lib └── win64 ├── aib.exe ├── mser.exe ├── msvcr100.dll ├── sift.exe ├── test_gauss_elimination.exe ├── test_getopt_long.exe ├── test_gmm.exe ├── test_heap-def.exe ├── test_host.exe ├── test_imopv.exe ├── test_kmeans.exe ├── test_liop.exe ├── test_mathop.exe ├── test_mathop_abs.exe ├── test_nan.exe ├── test_qsort-def.exe ├── test_rand.exe ├── test_sqrti.exe ├── test_stringop.exe ├── test_svd2.exe ├── test_threads.exe ├── test_vec_comp.exe ├── vl.dll └── vl.lib /CalculateEpipolarLine_alpha2.m: -------------------------------------------------------------------------------- 1 | function [EpiLines1ab,EpiLines2ab] = CalculateEpipolarLine_alpha2(Location1,Location2,Location1All,Location2All) 2 | %{ 3 | 2018/08/29 4 | CalculateEpipolarLine_alpha1 5 | 1. sub-program for calculating epipolar lines. 6 | 7 | 2018/08/31 8 | CalculateEpipolarLine_alpha2 9 | 1. sub-program for calculating epipolar lines for all locations. 10 | 11 | %} 12 | if size(Location1,1) > size(Location1,2) 13 | Location1T = Location1'; 14 | Location2T = Location2'; 15 | end 16 | FundemantalMatrix = RANSAC_Norm8Point(Location1T,Location2T); 17 | 18 | EpiLines1 = (FundemantalMatrix'*([Location2All ones(size(Location1All,1),1)])')'; 19 | EpiLines1ab = EpiLines1(:,[1 3]); 20 | EpiLines1ab = (EpiLines1ab./repmat(EpiLines1(:,2),[1 2])).*(-1); 21 | 22 | EpiLines2 = (FundemantalMatrix*([Location1All ones(size(Location2All,1),1)])')'; 23 | EpiLines2ab = EpiLines2(:,[1 3]); 24 | EpiLines2ab = (EpiLines2ab./repmat(EpiLines2(:,2),[1 2])).*(-1); -------------------------------------------------------------------------------- /Calculate_Dist_alpha1.m: -------------------------------------------------------------------------------- 1 | function Dist = Calculate_Dist_alpha1(DistType, Location1, Location2, f) 2 | 3 | %pfp = (Location2' * f)'; 4 | Algeb = (Location2' * f)'; 5 | Algeb = Algeb .* Location1; 6 | Dist = sum(Algeb, 1) .^ 2; 7 | 8 | if strcmp(DistType, 'sampson') 9 | epl1 = f * Location1; 10 | epl2 = f' * Location2; 11 | Dist = Dist ./ (epl1(1,:).^2 + epl1(2,:).^2 + epl2(1,:).^2 + epl2(2,:).^2); 12 | end -------------------------------------------------------------------------------- /CheckUniform_alpha2.m: -------------------------------------------------------------------------------- 1 | function IfUniform = CheckUniform_alpha2(Location1,Indices,Ratio) 2 | %{ 3 | 2018/09/06 4 | CheckUniform_alpha2 5 | 1. add ratio to IdealMeanRatio 6 | 7 | 8 | 2018/08/29 9 | CheckUniform_alpha1 10 | 1. sub-program for checking if uniform distribution 11 | %} 12 | 13 | Location1DT = delaunay(Location1); 14 | TriDistance = [sqrt(sum((Location1(Location1DT(:,1),:)-Location1(Location1DT(:,2),:)).^2,2)) sqrt(sum((Location1(Location1DT(:,1),:)-Location1(Location1DT(:,3),:)).^2,2)) sqrt(sum((Location1(Location1DT(:,2),:)-Location1(Location1DT(:,3),:)).^2,2))]; 15 | MeanMatrixOriginal = mean(TriDistance(:)); 16 | 17 | Location1Sampled = Location1(Indices,:); 18 | Location1SampledDT = delaunay(Location1Sampled); 19 | TriDistanceSampled = [sqrt(sum((Location1Sampled(Location1SampledDT(:,1),:)-Location1Sampled(Location1SampledDT(:,2),:)).^2,2)) sqrt(sum((Location1Sampled(Location1SampledDT(:,1),:)-Location1Sampled(Location1SampledDT(:,3),:)).^2,2)) sqrt(sum((Location1Sampled(Location1SampledDT(:,2),:)-Location1Sampled(Location1SampledDT(:,3),:)).^2,2))]; 20 | MeanMatrixSampled = mean(TriDistanceSampled(:)); 21 | 22 | IdealMeanRatio = sqrt(size(Location1,1)./size(Location1Sampled,1)); 23 | RealMeanRatio = MeanMatrixSampled/MeanMatrixOriginal; 24 | 25 | IfUniform = RealMeanRatio > (IdealMeanRatio*Ratio); -------------------------------------------------------------------------------- /DetectSIFTFeaturesANDInfo_alpha3.m: -------------------------------------------------------------------------------- 1 | function [validBlobs1,features1] = DetectSIFTFeaturesANDInfo_alpha3(I1,PeakThresh,edge_thresh) 2 | %{ 3 | 2016/11/20 4 | DetectSIFTFeaturesANDInfo_alpha2 5 | 1. Only detect one image. 6 | 7 | 2018/04/02 8 | DetectSIFTFeaturesANDInfo_alpha3 9 | 1. Add PeakThresh defalt=0; 0 10 20 30 10 | %} 11 | %% Read Image Pair 12 | %peak_thresh = 0;%0 10 20 30 13 | 14 | 15 | Color1 = size(I1,3); 16 | if Color1 > 1, 17 | [validBlobs1V,features1] = vl_sift(im2single(rgb2gray(I1)),'edgethresh', edge_thresh);%,'peak_thresh',PeakThresh 18 | else 19 | [validBlobs1V,features1] = vl_sift(im2single(I1),'edgethresh', edge_thresh) ; 20 | end 21 | 22 | %% 23 | Location1(:,1) = validBlobs1V(1,:); 24 | Location1(:,2) = validBlobs1V(2,:); 25 | 26 | Scale1 = validBlobs1V(3,:); 27 | Orientation1 = validBlobs1V(4,:); 28 | 29 | validBlobs1 = SURFPoints; 30 | Num1 = length(validBlobs1V); 31 | for i = 1:Num1, 32 | SIFTTemp = SURFPoints(Location1(i,:)); 33 | SIFTTemp.Orientation = Orientation1(i); 34 | SIFTTemp.Scale = Scale1(i); 35 | SIFTTemp.Metric = 1; 36 | 37 | validBlobs1 = [validBlobs1;SIFTTemp]; 38 | end -------------------------------------------------------------------------------- /FD_all_alpha1.m: -------------------------------------------------------------------------------- 1 | % please decompress the vlfeat-0.9.20.rar firstly 2 | run('vlfeat-0.9.20/toolbox/vl_setup') 3 | addpath(genpath('OthersAlgorithms/LLT_up/')); 4 | addpath(genpath('OthersAlgorithms/WGTM/')); 5 | 6 | % PeakThresh = 0; 7 | % EdgeThresh = 40; 8 | 9 | method = 3; 10 | % method 1: LLTA 11 | % method 2: LLTR 12 | % method 3: LLTV 13 | % method 4: SOCBV 14 | % method 5: WGTM 15 | 16 | %% Feature extraction 17 | 18 | t0 = clock; 19 | % I1 = imread( 'Slope20180301_L.jpg' ); 20 | % I2 = imread( 'Slope20180301_R.jpg' ); 21 | % [validBlobs1,features1] = DetectSIFTFeaturesANDInfo_alpha3(I1,0,40); 22 | % [validBlobs2,features2] = DetectSIFTFeaturesANDInfo_alpha3(I2,0,40); 23 | 24 | load('Slope20180301_SIFTandOne2One.mat'); 25 | Location1 = validBlobs1.Location; 26 | Location2 = validBlobs2.Location; 27 | 28 | %% FD feature matching 29 | t1 = clock; 30 | [indexPairsPar,RecordIndiesNew,tform1,tform2,IndicesInitialRANSAC,indexPairsInitialRANSAC,inliersInitialRANSAC,GoodClassidx,SearchingRange,RealSearchingRange] =ParFeatureMatching_alpha7(features1,features2,validBlobs1,validBlobs2,I1,I2); 31 | %[indexPairsPar,RecordIndies,BestInliersDifferSTD,tform1,tform2,IndicesInitialRANSAC,indexPairsInitialRANSAC,inliersInitialRANSAC] = ParFeatureMatching_alpha4(features1,features2,validBlobs1,validBlobs2,I2,ThresholdS); 32 | inliersPar = ParFeatureMatching_RemoveOutliers_alpha2_1(Location1,Location2,indexPairsPar,RecordIndiesNew,method); 33 | t2 = clock; 34 | FDMatchingTime = etime(t2,t1); 35 | FeatureExtractionTime = etime(t1,t0); 36 | 37 | matchedPoints1 = validBlobs1(indexPairsPar(inliersPar,1),:); 38 | matchedPoints2 = validBlobs2(indexPairsPar(inliersPar,2),:); 39 | figure,showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2); 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Other_Matching_All_alpha3.m: -------------------------------------------------------------------------------- 1 | function inliers = Other_Matching_All_alpha3(Locations,method) 2 | %{ 3 | 2018/04/13 4 | Other_Matching_All_alpha3 5 | 6 | 7 | 2018/04/04 8 | Other_Matching_All_alpha1 9 | 1. Based on Other_Modeling_All_alpha1 10 | 2. Only retain matching 11 | 12 | 13 | 2016/12/05 14 | Other_Modeling_All_alpha1 15 | 1. Adapt DMA dynamic matching area to advanced algorithms. 16 | 17 | method 1: LLTA 18 | method 2: LLTR 19 | method 3: LLTV 20 | method 4: SOCBV 21 | method 5: WGTM 22 | method 6: RANSAC 23 | method 7: GTM 24 | %} 25 | MatchedLocation1 = Locations(:,1:2); 26 | MatchedLocation2 = Locations(:,3:4); 27 | if method == 1 || method == 2 || method == 3, 28 | %% mode 1: LLTA; 2: LLTR; 3: LLTV. 29 | mode = method; 30 | inliers = LLT_DMA_sub_alpha1(MatchedLocation1,MatchedLocation2,mode); 31 | elseif method == 4, 32 | %% SOCBV 33 | K = 20; 34 | [inliers,~] = SOCBV(MatchedLocation1,MatchedLocation2,K,0.2); 35 | elseif method == 5, 36 | %% WGTM 37 | K = 20; 38 | [inliers,~] = WGTM_P_function_alpha1(MatchedLocation1,MatchedLocation2,K,0.2); 39 | elseif method == 6, 40 | %% RANSAC 41 | [~, inliersSub] = RANSAC_alpha1(MatchedLocation1, MatchedLocation2, 5, 0.00001); 42 | Num = 1:size(MatchedLocation1,1); 43 | inliers = Num(inliersSub); 44 | elseif method == 7, 45 | %% GTM 46 | [inliers_Location1,~] = GTM_function_ForDMA_alpha1(MatchedLocation1,MatchedLocation2); 47 | [~,~,inliers] = GTM_LocationtoIndex_alpha1(inliers_Location1,MatchedLocation1,indexPairs); 48 | end 49 | 50 | % [Accuracy,Precision,Recall,Specificity,ResultingInliersNum,MissingInliersNum,ResultingOutliersNum,MissingOutliersNum,TrueInliers,TrueOutiers 51 | 52 | %% ResultingNum and MissingNum 53 | % ToltalNum = size(MatchedLocation1,1); 54 | % RecordInliers = false(1,ToltalNum); 55 | % RecordInliers(inliers) = true; 56 | % 57 | % ResultingInliersNum = length(find(RecordInliers(TrueInliers)==1)); 58 | % MissingInliersNum = length(find(RecordInliers(TrueInliers)==0)); 59 | % 60 | % ResultingOutliersNum = length(find(RecordInliers(TrueOutiers)==1)); 61 | % MissingOutliersNum = length(find(RecordInliers(TrueOutiers)==0)); 62 | % 63 | % ResultingNumAll = ResultingInliersNum + ResultingOutliersNum; 64 | % MissingNumAll = MissingInliersNum + MissingOutliersNum; 65 | % %% Accuracy, Recall, Precision and Specificity 66 | % Accuracy = (ResultingInliersNum + MissingOutliersNum) / (ResultingNumAll + MissingNumAll); 67 | % Recall = ResultingInliersNum / (ResultingInliersNum + MissingInliersNum); 68 | % if ResultingNumAll == 0, 69 | % Precision = 0; 70 | % else 71 | % Precision = ResultingInliersNum / ResultingNumAll; 72 | % end 73 | % if MissingOutliersNum + ResultingOutliersNum == 0, 74 | % Specificity = 0; 75 | % else 76 | % Specificity = MissingOutliersNum / (MissingOutliersNum + ResultingOutliersNum); 77 | % end 78 | 79 | %{ 80 | Center1 = [mean(MatchedLocation1(:,1)) mean(MatchedLocation1(:,2))]; 81 | Center2 = [mean(MatchedLocation2(:,1)) mean(MatchedLocation2(:,2))]; 82 | TransMatrix_ALL = [1 0 (Center2(:,1) - Center1(:,1));0 1 (Center2(:,2) - Center1(:,2));0 0 1]; 83 | %TransMatrix_ALL = Transformation_alpha1(MatchedLocation1(TrueInliers,:),MatchedLocation2(TrueInliers,:)); 84 | ProjectionSet_MatchedLocation1 = Tranversal_KNN_CalculateProjection_alpha1(MatchedLocation1,TransMatrix_ALL); 85 | 86 | figure, 87 | plot(ProjectionSet_MatchedLocation1(TrueInliers,1),ProjectionSet_MatchedLocation1(TrueInliers,2),'r*');hold on 88 | plot(MatchedLocation2(TrueInliers,1),MatchedLocation2(TrueInliers,2),'b*'); 89 | plot(ProjectionSet_MatchedLocation1(TrueOutiers,1),ProjectionSet_MatchedLocation1(TrueOutiers,2),'mo'); 90 | plot(MatchedLocation2(TrueOutiers,1),MatchedLocation2(TrueOutiers,2),'co'); 91 | for i = 1:length(TrueInliers), 92 | line([ProjectionSet_MatchedLocation1(TrueInliers(i),1) MatchedLocation2(TrueInliers(i),1)],[ProjectionSet_MatchedLocation1(TrueInliers(i),2) MatchedLocation2(TrueInliers(i),2)],'color','g'); 93 | end 94 | for i = 1:length(TrueOutiers), 95 | line([ProjectionSet_MatchedLocation1(TrueOutiers(i),1) MatchedLocation2(TrueOutiers(i),1)],[ProjectionSet_MatchedLocation1(TrueOutiers(i),2) MatchedLocation2(TrueOutiers(i),2)],'color','r'); 96 | end 97 | title('Initial'); 98 | 99 | figure, 100 | plot(ProjectionSet_MatchedLocation1(TrueInliers,1),ProjectionSet_MatchedLocation1(TrueInliers,2),'r*');hold on 101 | plot(MatchedLocation2(TrueInliers,1),MatchedLocation2(TrueInliers,2),'b*'); 102 | 103 | for i = 1:length(ResultingInliers), 104 | line([ProjectionSet_MatchedLocation1(ResultingInliers(i),1) MatchedLocation2(ResultingInliers(i),1)],[ProjectionSet_MatchedLocation1(ResultingInliers(i),2) MatchedLocation2(ResultingInliers(i),2)],'color','g'); 105 | end 106 | if ~isempty(MissingInliers), 107 | for i = 1:length(MissingInliers), 108 | line([ProjectionSet_MatchedLocation1(MissingInliers(i),1) MatchedLocation2(MissingInliers(i),1)],[ProjectionSet_MatchedLocation1(MissingInliers(i),2) MatchedLocation2(MissingInliers(i),2)],'color','r'); 109 | end 110 | end 111 | title('Inliers'); 112 | 113 | figure, 114 | plot(ProjectionSet_MatchedLocation1(TrueOutiers,1),ProjectionSet_MatchedLocation1(TrueOutiers,2),'mo');hold on 115 | plot(MatchedLocation2(TrueOutiers,1),MatchedLocation2(TrueOutiers,2),'co'); 116 | for i = 1:length(MissingOutliers), 117 | line([ProjectionSet_MatchedLocation1(MissingOutliers(i),1) MatchedLocation2(MissingOutliers(i),1)],[ProjectionSet_MatchedLocation1(MissingOutliers(i),2) MatchedLocation2(MissingOutliers(i),2)],'color','g'); 118 | end 119 | if ~isempty(ResultingOutliers), 120 | for i = 1:length(ResultingOutliers), 121 | line([ProjectionSet_MatchedLocation1(ResultingOutliers(i),1) MatchedLocation2(ResultingOutliers(i),1)],[ProjectionSet_MatchedLocation1(ResultingOutliers(i),2) MatchedLocation2(ResultingOutliers(i),2)],'color','r'); 122 | end 123 | end 124 | title('Outliers'); 125 | 126 | x = 1; 127 | %} 128 | %CalculatingOutliers = 129 | 130 | % ResultingOutliers = find(RecordTrueOutliers(RecordProcessedOutliers)); 131 | % MissingOutliers = find(RecordProcessedOutliers(RecordTrueOutliers)); 132 | 133 | 134 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLTA.m: -------------------------------------------------------------------------------- 1 | function VecFld = LLTA(X, Y, conf) 2 | %% Initialization 3 | gamma = conf.gamma; 4 | beta = conf.beta; 5 | lambda = conf.lambda; 6 | theta = conf.theta; 7 | a = conf.a; 8 | MaxIter = conf.MaxIter; 9 | ecr = conf.ecr; 10 | minP = conf.minP; 11 | M = conf.M; 12 | Kn = conf.Kn; 13 | 14 | %% Initiaization R = I, t = 0, P = P = I_N*N 15 | [N, D]=size(X); 16 | A = eye(D); 17 | t = zeros(D,1); 18 | s = 1; 19 | P = eye(N); 20 | iter=1; tecr=1; E=1; %ntol = tol+10, L = 0 21 | sigma2=sum(sum((Y-X).^2))/(N*D); 22 | %% 23 | % Search the k nearest neighbors for each point X 24 | X2= sum(X.^2,2); %N*1 25 | distance = repmat(X2,1,N)+repmat(X2',N,1)-2*X*X'; 26 | [~, index] = sort(distance); 27 | neighborhood = index(2:(1+Kn),:); %K*N 28 | 29 | %% 30 | % Compute W by minimizeing the cost function E_LLE(W) = sum(square(xi - sum(Wij*xj))) 31 | if(Kn>D) 32 | tol=1e-5; % regularlizer in case constrained fits are ill conditioned 33 | else 34 | tol=0; 35 | end 36 | 37 | W = zeros(Kn,N);%wij represprent xi is the set of neighbors of xj and the wight is wij 38 | WW = sparse(1:N,1:N,zeros(1,N),N,N,4*Kn*N);%N*N 39 | IsubW = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 40 | for i = 1:N 41 | z = X(neighborhood(:,i),:) - repmat(X(i,:),Kn,1); % shift ith pt to origin K*D 42 | G = z*z'; % local covariance K*K 43 | G = G + eye(Kn,Kn)* tol * trace(G); % regularlization 44 | W(:,i) = G\ones(Kn,1); % solve Gw = 1 45 | W(:,i) = W(:,i)/sum(W(:,i)); % normalize 46 | w = W(:,i); 47 | j = neighborhood(:,i); 48 | WW(i,j) = w'; 49 | IsubW(i,j) = IsubW(i,j) - w'; 50 | end 51 | 52 | 53 | %% 54 | % EM iteration 55 | PS = []; 56 | while (iter ecr) && (sigma2 > 1e-8) 57 | %% E-step. 58 | % Update P 59 | 60 | E_old = E; 61 | T = repmat(t, [1,N]); 62 | TX = A*X'+ T; %D*N 63 | [P1, E] = get_P(Y, TX', sigma2 ,gamma, a); 64 | PS = [PS, P1]; 65 | P1 = max(P1, minP); 66 | P = sparse(1:N,1:N,P1,N,N,N);%N*N 67 | Np = sum(P1); 68 | muX = X'* P1 / Np; 69 | muY = Y'* P1 / Np; 70 | 71 | YtPX = Y'* P * X - muY * muX' * Np; 72 | Q = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 73 | Q = IsubW'*P*IsubW; 74 | XtQX = X'*Q*X; 75 | A = (Y'* P * X - muY * muX' * Np) / (2 * lambda * sigma2 * XtQX + X'*P*X - muX * muX' * Np ); 76 | t = muY - A * muX; 77 | %update E 78 | E = E + lambda * norm(A * X' * sqrt(P)* IsubW','fro'); 79 | tecr=(E-E_old)/E; 80 | %% M-step. 81 | % update C by solving linear system 82 | % update sigma^2 and gamma by tr(v_TPv)/D.tr(P) and tr(P)/N 83 | T = repmat(t, [1,N]); 84 | TX = A*X'+ T; 85 | V = Y - TX'; 86 | sigma2 = sum(sum(V.^2.*repmat(P1,1,D)))/(D*Np); 87 | %sigma2 = trace(V'*P*V)/(D*trace(P)); 88 | numcorr = length(find(P > theta)); 89 | gamma=numcorr/N; 90 | if gamma > 0.95, gamma = 0.95; end 91 | if gamma < 0.05, gamma = 0.05; end 92 | iter=iter+1; 93 | end 94 | %% 95 | VecFld.X = X; 96 | VecFld.Y = Y; 97 | VecFld.A = A; 98 | VecFld.t = t; 99 | VecFld.beta = beta; 100 | VecFld.TX= TX'; 101 | VecFld.P = diag(P); 102 | VecFld.PS = PS; 103 | VecFld.VFCIndex = find(VecFld.P > theta); 104 | 105 | % disp('Removing outliers succesfully completed.'); 106 | 107 | 108 | %%%%%%%%%%%%%%%%%%%%%%%% 109 | function K=con_K(x,y,beta) 110 | % CON_K constructs the kernel K, 111 | % where K(i, j) = k(x, y) = exp(-beta*||x-y||^2). 112 | 113 | [n, d]=size(x); [m, d]=size(y); 114 | 115 | K=repmat(x,[1 1 m])-permute(repmat(y,[1 1 n]),[3 2 1]); 116 | K=squeeze(sum(K.^2,2)); 117 | K=-beta * K; 118 | K=exp(K); 119 | 120 | %%%%%%%%%%%%%%%%%%%%%%%% 121 | function [P, E]=get_P(Y, TX, sigma2 ,gamma, a) 122 | % GET_P estimates the posterior probability and part of the energy. 123 | 124 | D = size(Y, 2); 125 | temp1 = exp(-sum((Y-TX).^2,2)/(2*sigma2)); 126 | temp2 = (2*pi*sigma2)^(D/2)*(1-gamma)/(gamma*a); 127 | P=temp1./(temp1+temp2); 128 | E=P'*sum((Y-TX).^2,2)/(2*sigma2)+sum(P)*log(sigma2)*D/2 - log(gamma)*sum(P) - log(1-gamma)*sum(1-P); 129 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLTR.m: -------------------------------------------------------------------------------- 1 | function VecFld = LLTR(X, Y, conf) 2 | % LLTR Locally Linear Trasforming for rigid dataset 3 | % VECFLD = LLTV(X, Y, CONF) 4 | % learning vector field from random samples with outliers. 5 | % Input: 6 | % X, Y: Original data. 7 | % conf: Refer to the function LLT_init 8 | %% Initialization 9 | gamma = conf.gamma; 10 | beta = conf.beta; 11 | lambda = conf.lambda; 12 | theta = conf.theta; 13 | a = conf.a; 14 | MaxIter = conf.MaxIter; 15 | ecr = conf.ecr; 16 | minP = conf.minP; 17 | M = conf.M; 18 | Kn = conf.Kn; 19 | 20 | %% Initiaization R = I, t = 0, P = P = I_N*N 21 | [N, D]=size(X); 22 | R = eye(D); 23 | t = zeros(D,1); 24 | s = 1; 25 | P = eye(N); 26 | iter=1; tecr=1; E=1; %ntol = tol+10, L = 0 27 | sigma2=sum(sum((Y-X).^2))/(N*D); 28 | %% 29 | % Search the k nearest neighbors for each point X 30 | X2= sum(X.^2,2); %N*1 31 | distance = repmat(X2,1,N)+repmat(X2',N,1)-2*X*X'; 32 | [~, index] = sort(distance); 33 | neighborhood = index(2:(1+Kn),:); %K*N 34 | 35 | %% 36 | % Compute W by minimizeing the cost function E_LLE(W) = sum(square(xi - sum(Wij*xj))) 37 | if(Kn>D) 38 | tol=1e-5; % regularlizer in case constrained fits are ill conditioned 39 | else 40 | tol=0; 41 | end 42 | 43 | W = zeros(Kn,N);%wij represprent xi is the set of neighbors of xj and the wight is wij 44 | WW = sparse(1:N,1:N,zeros(1,N),N,N,4*Kn*N);%N*N 45 | IsubW = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 46 | for i = 1:N 47 | z = X(neighborhood(:,i),:) - repmat(X(i,:),Kn,1); % shift ith pt to origin K*D 48 | G = z*z'; % local covariance K*K 49 | G = G + eye(Kn,Kn)* tol * trace(G); % regularlization 50 | W(:,i) = G\ones(Kn,1); % solve Gw = 1 51 | W(:,i) = W(:,i)/sum(W(:,i)); % normalize 52 | w = W(:,i); 53 | j = neighborhood(:,i); 54 | WW(i,j) = w'; 55 | IsubW(i,j) = IsubW(i,j) - w'; 56 | end 57 | 58 | %% 59 | % EM iteration 60 | PS = []; 61 | while (iter ecr) && (sigma2 > 1e-8) 62 | %% E-step. 63 | % Update P 64 | E_old = E; 65 | T = repmat(t, [1,N]); 66 | TX = s*R*X'+ T; %D*N 67 | [P1, E] = get_P(Y, TX', sigma2 ,gamma, a); 68 | PS = [PS, P1]; 69 | P1 = max(P1, minP); 70 | P = sparse(1:N,1:N,P1,N,N,N);%N*N 71 | Np = sum(P1); 72 | muX = X'* P1 / Np; 73 | muY = Y'* P1 / Np; 74 | A = Y'* P * X - muY * muX' * Np; %A = Y'*P*X - muY*P1'*X - Y'*P1*muX' + Np * muY* muX' 75 | [U,S,V]=svd(A); C=eye(D); 76 | C(end,end)=det(U*V'); 77 | R=U*C*V'; 78 | Q = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 79 | Q = IsubW'*P*IsubW; 80 | XtQX = X'*Q*X; 81 | s = trace(S*C)/(sum(sum(X.^2.*repmat(P1,1,D))) - Np*(muX' * muX) + 2*lambda*sigma2*trace(XtQX)); 82 | t = muY - s*R*muX; 83 | %muX = sum(X.*repmat(P1,1,D))/sum(P1); 84 | %muY = sum(Y.*repmat(P1,1,D))/sum(P1); 85 | %t = muY' - s*R*muX'; 86 | %Xhat = X - repmat(muX, N, 1); 87 | %Yhat = Y - repmat(muY, N, 1); 88 | %P = sparse(1:N,1:N,P1,N,N,N);%N*N 89 | %YtPX = Yhat'*P*Xhat; 90 | %[U,S,V] = svd(YtPX); 91 | %C = eye(D); 92 | %C(end,end) = det(U*V'); 93 | %R = U*C*V'; 94 | %XtPX = Xhat'*P*Xhat; 95 | %s = trace(YtPX'*R)/(trace(XtPX)+2*lambda*sigma2*trace(XtQX)) 96 | %update E 97 | E = E + lambda * norm(sqrt(P)*s*IsubW*X,'fro'); 98 | tecr=(E-E_old)/E; 99 | %% M-step. 100 | % update C by solving linear system 101 | % update sigma^2 and gamma by tr(v_TPv)/D.tr(P) and tr(P)/N 102 | T = repmat(t, [1,N]); 103 | TX = s*R*X'+ T; 104 | V = Y - TX'; 105 | sigma2 = sum(sum(V.^2.*repmat(P1,1,D)))/(D*Np); 106 | %sigma2 = trace(V'*P*V)/(D*trace(P)); 107 | numcorr = length(find(P > theta)); 108 | gamma=numcorr/N; 109 | if gamma > 0.95, gamma = 0.95; end 110 | if gamma < 0.05, gamma = 0.05; end 111 | iter=iter+1; 112 | end 113 | %% 114 | VecFld.X = X; 115 | VecFld.Y = Y; 116 | VecFld.beta = beta; 117 | VecFld.TX= TX'; 118 | VecFld.R = R; 119 | VecFld.t = t; 120 | VecFld.s = s; 121 | VecFld.P = diag(P); 122 | VecFld.PS = PS; 123 | VecFld.VFCIndex = find(VecFld.P > theta); 124 | 125 | % disp('Removing outliers succesfully completed.'); 126 | 127 | 128 | %%%%%%%%%%%%%%%%%%%%%%%% 129 | function K=con_K(x,y,beta) 130 | % CON_K constructs the kernel K, 131 | % where K(i, j) = k(x, y) = exp(-beta*||x-y||^2). 132 | 133 | [n, d]=size(x); [m, d]=size(y); 134 | 135 | K=repmat(x,[1 1 m])-permute(repmat(y,[1 1 n]),[3 2 1]); 136 | K=squeeze(sum(K.^2,2)); 137 | K=-beta * K; 138 | K=exp(K); 139 | 140 | %%%%%%%%%%%%%%%%%%%%%%%% 141 | function [P, E]=get_P(Y, TX, sigma2 ,gamma, a) 142 | % GET_P estimates the posterior probability and part of the energy. 143 | 144 | D = size(Y, 2); 145 | temp1 = exp(-sum((Y-TX).^2,2)/(2*sigma2)); 146 | temp2 = (2*pi*sigma2)^(D/2)*(1-gamma)/(gamma*a); 147 | P=temp1./(temp1+temp2); 148 | E=P'*sum((Y-TX).^2,2)/(2*sigma2)+sum(P)*log(sigma2)*D/2 - log(gamma)*sum(P) - log(1-gamma)*sum(1-P); 149 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLTV.m: -------------------------------------------------------------------------------- 1 | function VecFld = LLTV(X, Y, conf) 2 | % LLTV Locally Linear Trasforming for nonrigid 3 | % VECFLD = LLTV(X, Y, CONF) 4 | % learning vector field from random samples with outliers. 5 | % Input: 6 | % X, Y: Original data. 7 | % conf: Refer to the function LLT_init 8 | %% Initialization 9 | gamma = conf.gamma; 10 | beta = conf.beta; 11 | eta = conf.lambda; 12 | theta = conf.theta; 13 | a = conf.a; 14 | MaxIter = conf.MaxIter; 15 | ecr = conf.ecr; 16 | minP = conf.minP; 17 | M = conf.M; 18 | Kn = conf.Kn; 19 | 20 | %% Initialization gamma, C = 0,P = I_N*N 21 | [N, D]=size(X); 22 | tmp_X = unique(X, 'rows'); idx = randperm(size(tmp_X,1)); 23 | idx = idx(1:min(M,size(tmp_X,1)));ctrl_pts=tmp_X(idx,:); 24 | K=con_K(ctrl_pts,ctrl_pts,beta);% M*M 25 | U = con_K(X, ctrl_pts, beta);%N*M 26 | C = zeros(M, D);%M*2 27 | P = eye(N);%N*N 28 | iter=1; tecr=1; E=1; 29 | sigma2=sum(sum((Y-X).^2))/(N*D); 30 | 31 | %% 32 | % Search the k nearest neighbors for each point X 33 | X2= sum(X.^2,2); %N*1 34 | distance = repmat(X2,1,N)+repmat(X2',N,1)-2*X*X'; 35 | [~, index] = sort(distance); 36 | neighborhood = index(2:(1+Kn),:); %K*N 37 | 38 | %% 39 | % Compute W by minimizeing the cost function E_LLE(W) = sum(square(xi - sum(Wij*xj))) 40 | if(Kn>D) 41 | tol=1e-5; % regularlizer in case constrained fits are ill conditioned 42 | else 43 | tol=0; 44 | end 45 | 46 | W = zeros(Kn,N);%wij represprent xi is the set of neighbors of xj and the wight is wij 47 | WW = sparse(1:N,1:N,zeros(1,N),N,N,4*Kn*N);%N*N 48 | IsubW = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 49 | for i = 1:N 50 | z = X(neighborhood(:,i),:) - repmat(X(i,:),Kn,1); % shift ith pt to origin K*D 51 | G = z*z'; % local covariance K*K 52 | G = G + eye(Kn,Kn)* tol * trace(G); % regularlization 53 | W(:,i) = G\ones(Kn,1); % solve Gw = 1 54 | W(:,i) = W(:,i)/sum(W(:,i)); % normalize 55 | w = W(:,i); 56 | j = neighborhood(:,i); 57 | WW(i,j) = w'; 58 | IsubW(i,j) = IsubW(i,j) - w'; 59 | end 60 | 61 | %% 62 | % EM iteration 63 | %figure; 64 | PS = []; 65 | while (iter ecr) && (sigma2 > 1e-8) 66 | %% E-step. 67 | % Update P 68 | E_old = E; 69 | Tx = X + U*C; 70 | [P1, E] = get_P(Y, Tx, sigma2 ,gamma, a); 71 | PS = [PS, P1]; 72 | %DrawArrow2(X,Y,P1); 73 | P1 = max(P1, minP); 74 | P1 = max(P1, minP); 75 | P = sparse(1:N,1:N,P1,N,N,N); 76 | Q = IsubW'*P*IsubW; 77 | %update E 78 | E = E + eta/2*norm(sqrt(P) * IsubW * Tx,'fro'); 79 | tecr=(E-E_old)/E; 80 | 81 | %% M-step. 82 | % update C by solving linear system 83 | % update sigma^2 and gamma by tr(v_TPv)/D.tr(P) and tr(P)/N 84 | 85 | %C = (U'*P*U + eta*sigma2*U'*Q*U)\(U'*P*Y-U'*(P + eta*sigma2*Q)*X);%M*2 86 | % C = (U'*(P + eta*sigma2*Q)*U) \ (U'*P*Y-U'*(P + eta*sigma2*Q)*X); 87 | C = (U'*P*U + eta*sigma2*U'*Q*U)\(U'*(P*Y-(P + eta*sigma2*Q)*X)); 88 | V = Y - X - U*C; 89 | sigma2 = trace(V'*P*V)/(D*trace(P)); 90 | numcorr = length(find(P > theta)); 91 | gamma=numcorr/N; 92 | if gamma > 0.95, gamma = 0.95; end 93 | if gamma < 0.05, gamma = 0.05; end 94 | iter=iter+1; 95 | end 96 | %% 97 | VecFld.X = X; 98 | VecFld.Y = Y; 99 | VecFld.beta = beta; 100 | VecFld.TX= X + U*C; 101 | VecFld.C=C; 102 | VecFld.ctrl_pts = ctrl_pts; 103 | VecFld.P = diag(P); 104 | VecFld.PS = PS; 105 | VecFld.VFCIndex = find(VecFld.P > theta); 106 | 107 | % disp('Removing outliers succesfully completed.'); 108 | 109 | 110 | %%%%%%%%%%%%%%%%%%%%%%%% 111 | function K=con_K(x,y,beta) 112 | % CON_K constructs the kernel K, 113 | % where K(i, j) = k(x, y) = exp(-beta*||x-y||^2). 114 | 115 | [n, d]=size(x); [m, d]=size(y); 116 | 117 | K=repmat(x,[1 1 m])-permute(repmat(y,[1 1 n]),[3 2 1]); 118 | K=squeeze(sum(K.^2,2)); 119 | K=-beta * K; 120 | K=exp(K); 121 | 122 | %%%%%%%%%%%%%%%%%%%%%%%% 123 | function [P, E]=get_P(Y, Tx, sigma2 ,gamma, a) 124 | % GET_P estimates the posterior probability and part of the energy. 125 | 126 | D = size(Y, 2); 127 | temp1 = exp(-sum((Y-Tx).^2,2)/(2*sigma2)); 128 | temp2 = (2*pi*sigma2)^(D/2)*(1-gamma)/(gamma*a); 129 | P=temp1./(temp1+temp2); 130 | E=P'*sum((Y-Tx).^2,2)/(2*sigma2)+sum(P)*log(sigma2)*D/2 - log(gamma)*sum(P) - log(1-gamma)*sum(1-P); 131 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLTV_DMA_alpha1.m: -------------------------------------------------------------------------------- 1 | function VecFld = LLTV_DMA_alpha1(X, Y, conf) 2 | % LLTV Locally Linear Trasforming for nonrigid 3 | % VECFLD = LLTV(X, Y, CONF) 4 | % learning vector field from random samples with outliers. 5 | % Input: 6 | % X, Y: Original data. 7 | % conf: Refer to the function LLT_init 8 | %% Initialization 9 | gamma = conf.gamma; 10 | beta = conf.beta; 11 | eta = conf.lambda; 12 | theta = conf.theta; 13 | a = conf.a; 14 | MaxIter = conf.MaxIter; 15 | ecr = conf.ecr; 16 | minP = conf.minP; 17 | M = conf.M; 18 | Kn = conf.Kn; 19 | 20 | %% Initialization gamma, C = 0,P = I_N*N 21 | [N, D]=size(X); 22 | tmp_X = unique(X, 'rows'); idx = randperm(size(tmp_X,1)); 23 | idx = idx(1:min(M,size(tmp_X,1)));ctrl_pts=tmp_X(idx,:); 24 | K=con_K(ctrl_pts,ctrl_pts,beta);% M*M 25 | U = con_K(X, ctrl_pts, beta);%N*M 26 | C = zeros(M, D);%M*2 27 | P = eye(N);%N*N 28 | iter=1; tecr=1; E=1; 29 | sigma2=sum(sum((Y-X).^2))/(N*D); 30 | 31 | %% 32 | % Search the k nearest neighbors for each point X 33 | X2= sum(X.^2,2); %N*1 34 | distance = repmat(X2,1,N)+repmat(X2',N,1)-2*X*X'; 35 | [~, index] = sort(distance); 36 | neighborhood = index(2:(1+Kn),:); %K*N 37 | 38 | %% 39 | % Compute W by minimizeing the cost function E_LLE(W) = sum(square(xi - sum(Wij*xj))) 40 | if(Kn>D) 41 | tol=1e-5; % regularlizer in case constrained fits are ill conditioned 42 | else 43 | tol=0; 44 | end 45 | 46 | W = zeros(Kn,N);%wij represprent xi is the set of neighbors of xj and the wight is wij 47 | WW = sparse(1:N,1:N,zeros(1,N),N,N,4*Kn*N);%N*N 48 | IsubW = sparse(1:N,1:N,ones(1,N),N,N,4*Kn*N);%N*N 49 | for i = 1:N 50 | z = X(neighborhood(:,i),:) - repmat(X(i,:),Kn,1); % shift ith pt to origin K*D 51 | G = z*z'; % local covariance K*K 52 | G = G + eye(Kn,Kn)* tol * trace(G); % regularlization 53 | W(:,i) = G\ones(Kn,1); % solve Gw = 1 54 | W(:,i) = W(:,i)/sum(W(:,i)); % normalize 55 | w = W(:,i); 56 | j = neighborhood(:,i); 57 | WW(i,j) = w'; 58 | IsubW(i,j) = IsubW(i,j) - w'; 59 | end 60 | 61 | %% 62 | % EM iteration 63 | %figure; 64 | PS = []; 65 | while (iter ecr) && (sigma2 > 1e-8) 66 | %% E-step. 67 | % Update P 68 | E_old = E; 69 | Tx = X + U*C; 70 | [P1, E] = get_P(Y, Tx, sigma2 ,gamma, a); 71 | PS = [PS, P1]; 72 | %DrawArrow2(X,Y,P1); 73 | P1 = max(P1, minP); 74 | P1 = max(P1, minP); 75 | P = sparse(1:N,1:N,P1,N,N,N); 76 | Q = IsubW'*P*IsubW; 77 | %update E 78 | E = E + eta/2*norm(sqrt(P) * IsubW * Tx,'fro'); 79 | tecr=(E-E_old)/E; 80 | 81 | %% M-step. 82 | % update C by solving linear system 83 | % update sigma^2 and gamma by tr(v_TPv)/D.tr(P) and tr(P)/N 84 | 85 | %C = (U'*P*U + eta*sigma2*U'*Q*U)\(U'*P*Y-U'*(P + eta*sigma2*Q)*X);%M*2 86 | % C = (U'*(P + eta*sigma2*Q)*U) \ (U'*P*Y-U'*(P + eta*sigma2*Q)*X); 87 | C = (U'*P*U + eta*sigma2*U'*Q*U)\(U'*(P*Y-(P + eta*sigma2*Q)*X)); 88 | V = Y - X - U*C; 89 | sigma2 = trace(V'*P*V)/(D*trace(P)); 90 | numcorr = length(find(P > theta)); 91 | gamma=numcorr/N; 92 | if gamma > 0.95, gamma = 0.95; end 93 | if gamma < 0.05, gamma = 0.05; end 94 | iter=iter+1; 95 | end 96 | %% 97 | VecFld.X = X; 98 | VecFld.Y = Y; 99 | VecFld.beta = beta; 100 | VecFld.TX= X + U*C; 101 | VecFld.C=C; 102 | VecFld.ctrl_pts = ctrl_pts; 103 | VecFld.P = diag(P); 104 | VecFld.PS = PS; 105 | VecFld.VFCIndex = find(VecFld.P > theta); 106 | 107 | % disp('Removing outliers succesfully completed.'); 108 | 109 | 110 | %%%%%%%%%%%%%%%%%%%%%%%% 111 | function K=con_K(x,y,beta) 112 | % CON_K constructs the kernel K, 113 | % where K(i, j) = k(x, y) = exp(-beta*||x-y||^2). 114 | 115 | [n, d]=size(x); [m, d]=size(y); 116 | 117 | K=repmat(x,[1 1 m])-permute(repmat(y,[1 1 n]),[3 2 1]); 118 | K=squeeze(sum(K.^2,2)); 119 | K=-beta * K; 120 | K=exp(K); 121 | 122 | %%%%%%%%%%%%%%%%%%%%%%%% 123 | function [P, E]=get_P(Y, Tx, sigma2 ,gamma, a) 124 | % GET_P estimates the posterior probability and part of the energy. 125 | 126 | D = size(Y, 2); 127 | temp1 = exp(-sum((Y-Tx).^2,2)/(2*sigma2)); 128 | temp2 = (2*pi*sigma2)^(D/2)*(1-gamma)/(gamma*a); 129 | P=temp1./(temp1+temp2); 130 | E=P'*sum((Y-Tx).^2,2)/(2*sigma2)+sum(P)*log(sigma2)*D/2 - log(gamma)*sum(P) - log(1-gamma)*sum(1-P); 131 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLT_DMA_sub_alpha1.m: -------------------------------------------------------------------------------- 1 | function inliers = LLT_DMA_sub_alpha1(Location1,Location2,mode) 2 | %{ 3 | 2016/12/05 4 | LLT_DMA_alpha1 5 | 1. LLT for DMA 6 | 7 | mode 1: LLTA 8 | mode 2: LLTR 9 | mode 3: LLTV 10 | %} 11 | 12 | %% conf 13 | conf.lambda = 9 * (10^9); 14 | %% Dynamic conf.Kn and M 2016/12/6 15 | if size(Location1,1) <= 15, 16 | conf.Kn = 5; 17 | conf.M = size(Location1,1); %For LLTV 18 | else 19 | conf.Kn = 15; 20 | end 21 | %conf.Kn = 5; 22 | %% 23 | if ~exist('conf'), conf = []; end 24 | conf = LLT_init(conf); 25 | 26 | %% Norm 27 | % X = [Location1(:,1)';Location1(:,2)']'; 28 | % Y = [Location2(:,1)';Location2(:,2)']'; 29 | [nX, nY, ~]=norm2(Location1,Location2); 30 | if mode == 1, 31 | %% LLTA 32 | % sprintf('LLTA:') 33 | VecFldA=LLTA(nX, nY, conf); 34 | inliers = VecFldA.VFCIndex; 35 | elseif mode == 2, 36 | %% LLTR 37 | % sprintf('LLTR:') 38 | VecFldR=LLTR(nX, nY, conf); 39 | inliers = VecFldR.VFCIndex; 40 | else 41 | %% LLTV 42 | % sprintf('LLTV:') 43 | VecFldV=LLTV(nX, nY, conf); 44 | inliers = VecFldV.VFCIndex; 45 | end -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLT_P_alpha1.m: -------------------------------------------------------------------------------- 1 | function [inliersLLTA,inliersLLTR,inliersLLTV,LLTAMatchingTime,LLTRMatchingTime,LLTVMatchingTime] = LLT_P_alpha1(Location1,Location2) 2 | %{ 3 | 2016/03/20 4 | LLT_alpha1 5 | 1. For OtherAlgorightms_alpha5 6 | 2. For nonrigid 7 | 8 | 2016/11/26 9 | LLT_P_alpha1 10 | 1. For processing in batch. 11 | 12 | %} 13 | inliersLLTA = []; 14 | inliersLLTR = []; 15 | inliersLLTV = []; 16 | %% conf 17 | conf.lambda = 9 * (10^9); 18 | conf.Kn = 15; 19 | if ~exist('conf'), conf = []; end 20 | conf = LLT_init(conf); 21 | 22 | %% Norm 23 | % X = [Location1(:,1)';Location1(:,2)']'; 24 | % Y = [Location2(:,1)';Location2(:,2)']'; 25 | [nX, nY, ~]=norm2(Location1,Location2); 26 | 27 | %% LLTA 28 | % sprintf('LLTA:') 29 | t1=clock; 30 | VecFldA=LLTA(nX, nY, conf); 31 | inliersLLTA = VecFldA.VFCIndex; 32 | t2=clock; 33 | LLTAMatchingTime = etime(t2,t1); 34 | %% LLTR 35 | % sprintf('LLTR:') 36 | t1=clock; 37 | VecFldR=LLTR(nX, nY, conf); 38 | inliersLLTR = VecFldR.VFCIndex; 39 | t2=clock; 40 | LLTRMatchingTime = etime(t2,t1); 41 | %% LLTV 42 | % sprintf('LLTV:') 43 | t1=clock; 44 | VecFldV=LLTV(nX, nY, conf); 45 | inliersLLTV = VecFldV.VFCIndex; 46 | t2=clock; 47 | LLTVMatchingTime = etime(t2,t1); -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLT_alpha1.m: -------------------------------------------------------------------------------- 1 | function [inliersLLTA,inliersLLTR,inliersLLTV] = LLT_alpha1(Location1,Location2) 2 | %{ 3 | 2016/03/20 4 | LLT_alpha1 5 | 1. For OtherAlgorightms_alpha5 6 | 2. For nonrigid 7 | 8 | %} 9 | inliersLLTA = []; 10 | inliersLLTR = []; 11 | %% conf 12 | conf.lambda = 9 * (10^9); 13 | conf.Kn = 15; 14 | if ~exist('conf'), conf = []; end 15 | conf = LLT_init(conf); 16 | 17 | %% Norm 18 | % X = [Location1(:,1)';Location1(:,2)']'; 19 | % Y = [Location2(:,1)';Location2(:,2)']'; 20 | [nX, nY, ~]=norm2(Location1,Location2); 21 | 22 | %% LLTA 23 | sprintf('LLTA:') 24 | tic, 25 | VecFldA=LLTA(nX, nY, conf); 26 | inliersLLTA = VecFldA.VFCIndex; 27 | toc, 28 | %% LLTR 29 | sprintf('LLTR:') 30 | tic, 31 | VecFldR=LLTR(nX, nY, conf); 32 | inliersLLTR = VecFldR.VFCIndex; 33 | toc, 34 | %% LLTV 35 | sprintf('LLTV:') 36 | tic, 37 | VecFldV=LLTV(nX, nY, conf); 38 | inliersLLTV = VecFldV.VFCIndex; 39 | toc, -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/LLT_init.m: -------------------------------------------------------------------------------- 1 | function conf = LLT_init(conf) 2 | % VFC Vector Field Consensus 3 | % CONF = LLT_init(CONF) sets the default configuration for LLT. 4 | % 5 | % gamma: Percentage of inliers in the samples. This is an inital value 6 | % for EM iteration, and it is not important. Default value is 0.9. 7 | % 8 | % beta: Paramerter of Gaussian Kernel, k(x, y) = exp(-beta*||x-y||^2). 9 | % Default value is 0.1. 10 | % 11 | % lambda: Represents the trade-off between the goodness of data fit 12 | % and LLT constraint. Default value is 9 * (10^9);. 13 | % 14 | % theta: If the posterior probability of a sample being an inlier is 15 | % larger than theta, then it will be regarded as an inlier. 16 | % Default value is 0.75. 17 | % 18 | % a: Paramerter of the uniform distribution. We assume that the outliers 19 | % obey a uniform distribution 1/a. Default Value is 10. 20 | % 21 | % MaxIter: Maximum iterition times. Defualt value is 500. 22 | % 23 | % ecr: The minimum limitation of the energy change rate in the iteration 24 | % process. Default value is 1e-5. 25 | % 26 | % minP: The posterior probability Matrix P may be singular for matrix 27 | % inversion. We set the minimum value of P as minP. Default value is 28 | % 1e-5. 29 | % Kn: The number of k-nearst neibourhood. Default value is 15. 30 | % M: The number of control point. Default value is 15. 31 | 32 | 33 | % Authors: Jiayi Ma (jyma2010@gmail.com) 34 | % Date: 04/17/2012 35 | 36 | if ~isfield(conf,'MaxIter'), conf.MaxIter = 500; end; 37 | if ~isfield(conf,'gamma'), conf.gamma = 0.9; end; 38 | if ~isfield(conf,'beta'), conf.beta = 0.1; end; 39 | if ~isfield(conf,'lambda'), conf.lambda = 9000000000; end; 40 | if ~isfield(conf,'theta'), conf.theta = 0.75; end; 41 | if ~isfield(conf,'a'), conf.a = 10; end; 42 | if ~isfield(conf,'ecr'), conf.ecr = 1e-5; end; 43 | if ~isfield(conf,'minP'), conf.minP = 1e-5; end; 44 | if ~isfield(conf,'Kn'), conf.Kn = 15; end; 45 | if ~isfield(conf,'M'), conf.M = 15; end; 46 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/demo.m: -------------------------------------------------------------------------------- 1 | %%This is a demo for removing outliers. In this demo, the SIFT matches is known in advance. 2 | clear; 3 | close all; 4 | 5 | %class = 1; method = 'affine' 6 | %class = 2; method = 'rigid'; 7 | class = 3; method = 'nonrigid'; 8 | k = 1; 9 | 10 | SiftThreshold = 1.5; 11 | 12 | conf.lambda = 9 * (10^9); 13 | conf.Kn = 15; 14 | 15 | %affine 16 | al = {'2-refimg(2).tif', '6-refimg(6).tif'}; 17 | ar = {'2-t.bmp', '6-t.bmp'}; 18 | 19 | %rigid 20 | rl = {'batch_2-2.tif','Sh2000.tif'}; 21 | rr = {'batch_2-3.tif','Sh2001.tif'}; 22 | 23 | %nonrigid 24 | nl = {'C23.bmp', '621.bmp'}; 25 | nr = {'C13.bmp', '611.bmp'}; 26 | 27 | switch class 28 | case 1 29 | fn_l = al;fn_r = ar; 30 | case 2 31 | fn_l = rl;fn_r = rr; 32 | case 3 33 | fn_l = nl;fn_r = nr; 34 | end 35 | k = min(k, numel(fn_l)); 36 | Ia = imread(fn_l{k}); 37 | Ib = imread(fn_r{k}); 38 | if size(Ia,3)==1 39 | Ia = repmat(Ia,[1,1,3]); 40 | end 41 | if size(Ib,3)==1 42 | Ib = repmat(Ib,[1,1,3]); 43 | end 44 | 45 | %% 46 | fn1 = fn_l{k}; 47 | k1 = strfind(fn1, '.'); 48 | k1 = k1(end); 49 | fn2 = fn_r{k}; 50 | k2 = strfind(fn2, '.'); 51 | k2 = k2(end); 52 | tmp = [fn1(1:k1-1) '_' fn2(1:k2-1)]; 53 | fn_match = ['./data/' tmp '.mat']; 54 | flag = 0; 55 | if ~exist(fn_match, 'file') || flag 56 | [X, Y] = sift_match(Ia, Ib, SiftThreshold, fn_match); 57 | else 58 | load(fn_match); 59 | [X, Y] = sift_match(Ia, Ib, SiftThreshold, fn_match); 60 | end 61 | tmp = [tmp '_' method]; 62 | [nX, nY, normal]=norm2(X,Y); 63 | if ~exist('conf'), conf = []; end 64 | conf = LLT_init(conf); 65 | switch method 66 | case 'affine' 67 | VecFld=LLTA(nX, nY, conf); 68 | case 'rigid' 69 | VecFld=LLTR(nX, nY, conf); 70 | case 'nonrigid' 71 | VecFld=LLTV(nX, nY, conf); 72 | end 73 | VecFld.TX=(VecFld.TX)*normal.yscale+repmat(normal.ym,size(Y,1),1); 74 | [precise, recall, corrRate] = evaluate(CorrectIndex, VecFld.VFCIndex, size(X,1)); 75 | [wa,ha,~] = size(Ia);[wb,hb,~] = size(Ib);maxw = max(wa,wb);maxh = max(ha,hb);Ib(wb+1:maxw, :,:) = 0;Ia(wa+1:maxw, :,:) = 0; 76 | plot_matches(Ia, Ib, X, Y, 1:size(X,1), CorrectIndex); 77 | figure; 78 | plot_matches(Ia, Ib, X, Y, VecFld.VFCIndex, CorrectIndex); 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/evaluate.m: -------------------------------------------------------------------------------- 1 | function [precision, recall, corrRate] = evaluate(CorrectIndex, VFCIndex, siz,fid) 2 | % [PRECISION, RECALL, CORRRATE] = EVALUATE(CORRECTINDEX, VFCINDEX, SIZ) 3 | % evaluates the performence of VFC with precision and recall. 4 | % 5 | % Input: 6 | % CorrectIndex, VFCIndex: Correct indexes and indexes reserved by VFC. 7 | % 8 | % siz: Number of initial matches. 9 | % 10 | % Output: 11 | % precision, recall, corrRate: Precision and recall of VFC, percentage of 12 | % initial correct matches. 13 | % 14 | % See also:: VFC(). 15 | 16 | if length(VFCIndex)==0 17 | VFCIndex = 1:siz; 18 | end 19 | 20 | tmp=zeros(1, siz); 21 | tmp(VFCIndex) = 1; 22 | tmp(CorrectIndex) = tmp(CorrectIndex)+1; 23 | VFCCorrect = find(tmp == 2); 24 | NumCorrectIndex = length(CorrectIndex); 25 | NumVFCIndex = length(VFCIndex); 26 | NumVFCCorrect = length(VFCCorrect); 27 | 28 | corrRate = NumCorrectIndex/siz; 29 | precision = NumVFCCorrect/NumVFCIndex; 30 | recall = NumVFCCorrect/NumCorrectIndex; 31 | 32 | if nargin < 4 33 | fprintf('\ncorrect correspondence rate in the original data: %d/%d = %f\r\n', NumCorrectIndex, siz, corrRate); 34 | fprintf('precision rate: %d/%d = %f\r\n', NumVFCCorrect, NumVFCIndex, precision); 35 | fprintf('recall rate: %d/%d = %f\r\n', NumVFCCorrect, NumCorrectIndex, recall); 36 | else 37 | fprintf(fid,'\ncorrect correspondence rate in the original data: %d/%d = %f\r\n', NumCorrectIndex, siz, corrRate); 38 | fprintf(fid,'precision rate: %d/%d = %f\r\n', NumVFCCorrect, NumVFCIndex, precision); 39 | fprintf(fid,'recall rate: %d/%d = %f\r\n', NumVFCCorrect, NumCorrectIndex, recall); 40 | end -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/initialization.m: -------------------------------------------------------------------------------- 1 | addpath('data'); 2 | addpath('vlfeat'); 3 | addpath('img'); 4 | old = cd; 5 | cd ./vlfeat/toolbox 6 | vl_setup; 7 | cd(old); 8 | -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/norm2.m: -------------------------------------------------------------------------------- 1 | function [X, Y, normal] =norm2(x,y) 2 | % NORM2 nomalizes the data to have zero means and unit covariance 3 | 4 | x = double(x); 5 | y = double(y); 6 | 7 | n=size(x,1); 8 | m=size(y,1); 9 | 10 | normal.xm=mean(x); 11 | normal.ym=mean(y); 12 | 13 | x=x-repmat(normal.xm,n,1); 14 | y=y-repmat(normal.ym,m,1); 15 | 16 | normal.xscale=sqrt(sum(sum(x.^2,2))/n); 17 | normal.yscale=sqrt(sum(sum(y.^2,2))/m); 18 | 19 | X=x/normal.xscale; 20 | Y=y/normal.yscale; -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/plot_matches.m: -------------------------------------------------------------------------------- 1 | function [FP,FN] = plot_matches(I1, I2, X, Y, VFCIndex, CorrectIndex) 2 | % PLOT_MATCHES(I1, I2, X, Y, VFCINDEX, CORRECTINDEX) 3 | % considers correct indexes and indexes reserved by VFC, and then 4 | % only plots the ture positive with blue lines, false positive with red 5 | % lines, false negative with green lines. For visibility, it plots at 6 | % most NUMPLOT (Default value is 50) matches proportionately. 7 | % 8 | % Input: 9 | % I1, I2: Tow input images. 10 | % 11 | % X, Y: Coordinates of intrest points of I1, I2 respectively. 12 | % 13 | % VFCIndex: Indexes reserved by VFC. 14 | % 15 | % CorrectIndex: Correct indexes. 16 | % 17 | % See also:: VFC(). 18 | 19 | % Define the most matches to plot 20 | NumPlot = 100; 21 | 22 | n = size(X,1); 23 | tmp=zeros(1, n); 24 | tmp(VFCIndex) = 1; 25 | tmp(CorrectIndex) = tmp(CorrectIndex)+1; 26 | VFCCorrect = find(tmp == 2); 27 | TruePos = VFCCorrect; %Ture positive 28 | tmp=zeros(1, n); 29 | tmp(VFCIndex) = 1; 30 | tmp(CorrectIndex) = tmp(CorrectIndex)-1; 31 | FalsePos = find(tmp == 1); %False positive 32 | tmp=zeros(1, n); 33 | tmp(CorrectIndex) = 1; 34 | tmp(VFCIndex) = tmp(VFCIndex)-1; 35 | FalseNeg = find(tmp == 1); %False negative 36 | 37 | FP = FalsePos; 38 | FN = FalseNeg; 39 | 40 | NumPos = length(TruePos)+length(FalsePos)+length(FalseNeg); 41 | if NumPos > NumPlot 42 | t_p = length(TruePos)/NumPos; 43 | n1 = round(t_p*NumPlot); 44 | f_p = length(FalsePos)/NumPos; 45 | n2 = round(f_p*NumPlot); 46 | f_n = length(FalseNeg)/NumPos; 47 | n3 = round(f_n*NumPlot); 48 | else 49 | n1 = length(TruePos); 50 | n2 = length(FalsePos); 51 | n3 = length(FalseNeg); 52 | end 53 | 54 | per = randperm(length(TruePos)); 55 | TruePos = TruePos(per(1:n1)); 56 | per = randperm(length(FalsePos)); 57 | FalsePos = FalsePos(per(1:n2)); 58 | per = randperm(length(FalseNeg)); 59 | FalseNeg = FalseNeg(per(1:n3)); 60 | 61 | interval = 20; 62 | WhiteInterval = 255*ones(size(I1,1), interval, 3); 63 | imagesc(cat(2, I1, WhiteInterval, I2)) ; 64 | hold on ; 65 | line([X(FalsePos,1)'; Y(FalsePos,1)'+size(I1,2)+interval], [X(FalsePos,2)' ; Y(FalsePos,2)'],'linewidth', 1, 'color', 'r') ; 66 | line([X(FalseNeg,1)'; Y(FalseNeg,1)'+size(I1,2)+interval], [X(FalseNeg,2)' ; Y(FalseNeg,2)'],'linewidth', 1, 'color', 'w') ; 67 | line([X(TruePos,1)'; Y(TruePos,1)'+size(I1,2)+interval], [X(TruePos,2)' ; Y(TruePos,2)'],'linewidth', 1, 'color', 'b') ; 68 | axis equal ;axis off ; 69 | hold off 70 | drawnow; -------------------------------------------------------------------------------- /OthersAlgorithms/LLT_up/sift_match.m: -------------------------------------------------------------------------------- 1 | function [X, Y, S1, S2] = sift_match(I1, I2, theta, fn_match) 2 | % [X, Y, S1, S2] = SIFT_MATCH(I1, I2, THETA) does sift match use 3 | % VL_Feat. 4 | % 5 | % Input: 6 | % I1, I2: Tow input image. 7 | % 8 | % theta: A descriptor D1 is matched to a descriptor D2 only if the 9 | % distance d(D1,D2) multiplied by THRESH is not greater than the 10 | % distance of D1 to all other descriptors. The default value of 11 | % THRESH used by VL_Feat is 1.5. 12 | % 13 | % Output: 14 | % X, Y: SIFT matches of interest points. 15 | % S1, S2: Scale of the matches point pairs 16 | 17 | [f1,d1] = vl_sift(im2single(rgb2gray(I1))) ; 18 | [f2,d2] = vl_sift(im2single(rgb2gray(I2))) ; 19 | 20 | [matches, scores] = vl_ubcmatch(d1,d2, theta) ; 21 | 22 | x1 = f1(1,matches(1,:)) ; 23 | x2 = f2(1,matches(2,:)) + size(I1,2) ; 24 | y1 = f1(2,matches(1,:)) ; 25 | y2 = f2(2,matches(2,:)) ; 26 | X = [x1; y1]'; 27 | Y = [f2(1,matches(2,:)); y2]'; 28 | S1 = f1(3, matches(1,:)); 29 | S2 = f2(3, matches(2,:)); 30 | 31 | %save(fn_match, 'X', 'Y'); 32 | 33 | % figure ; clf ; 34 | % imagesc(cat(2, I1, I2)) ;hold on ; 35 | % h = line([x1 ; x2], [y1 ; y2]) ; set(h,'linewidth', 2, 'color', 'b') ; 36 | % axis equal ;axis off ; -------------------------------------------------------------------------------- /OthersAlgorithms/SOCBV.m: -------------------------------------------------------------------------------- 1 | function [inliers,Inter]= SOCBV(P1,P2,K,ea) 2 | % Weighted Graph Transformation Matching Algorithm: 3 | % The algorithm takes two sets of corresponding points (initial matches) and find matches 4 | % using the geometrical relation between points. 5 | 6 | % Input - P1: an array with size N X 2 containing the first set of points. 7 | % - P2: N X 2 vactor containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 8 | % - K: The number of closet neighbores of a point that are connected with point in the graph. 9 | % - ea: is the stopping threshold or the min value of remaining matches in the weighted graph after removing an 10 | % outlier. 11 | 12 | % Output - inliers: the inlier matches 13 | % - outliers: the outlier matches 14 | 15 | 16 | % Copyright (c) 2014-2015 by Fanyang Meng (mengfanyang@email.szu.edu.cn) 17 | % the college of Information Engineering, Shenzhen University, Shenzhen, China. 18 | % we would like to thank M.Izadi for his help with codes of GTM and WGTM 19 | % algorithm. 20 | 21 | % 22 | %% Distance matrices 23 | dist1=zeros(size(P1,1));angle1 = zeros(size(P1,1)); 24 | dist2=zeros(size(P2,1));angle2 = zeros(size(P2,1)); 25 | for i=1:size(P1,1) 26 | for j=1:size(P1,1) 27 | dist1(i,j)=norm(P1(i,:)-P1(j,:)); 28 | dist2(i,j)=norm(P2(i,:)-P2(j,:)); 29 | angle1(i,j) = atan2(P1(i,1)-P1(j,1),P1(i,2)-P1(j,2)); 30 | angle2(i,j) = atan2(P2(i,1)-P2(j,1),P2(i,2)-P2(j,2)); 31 | end 32 | end 33 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 34 | medianDist1 = median(dist1(:));medianDist2 = median(dist2(:)); 35 | % Creating the weighted 36 | W = exp(-abs(dist1/medianDist1 - dist2/medianDist2)); 37 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 | %% SOCBV algorithm 39 | % creating KNN graphs 40 | KNNG1 = createKNNGraph(dist1,K,medianDist1,W); 41 | KNNG2 = createKNNGraph(dist2,K,medianDist2,W); 42 | % Creating the vote graph 43 | [VGX,VGY] = createVoteGraph(KNNG1,KNNG2,angle1,angle2,W); 44 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 45 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 46 | % % Inneighbor and Outneighbor with weighted 47 | NeighborVoteX = sum((VGX'+VGX))./(sum((KNNG1+KNNG1'))+eps); 48 | NeighborVoteY = sum((VGY'+VGY))./(sum((KNNG2+KNNG2'))+eps); 49 | NeighborVote = (NeighborVoteX + NeighborVoteY)/2; 50 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 51 | flag=0;Inter = 1; 52 | inliers =1:length(P1); outliers = []; 53 | while flag==0 54 | KNNG1_old=KNNG1; KNNG2_old=KNNG2; %finding the worst node as outlier 55 | [~,ind] = min(NeighborVote); 56 | outliers = [outliers ind(1)]; 57 | dist1(ind(1),:)= medianDist1 + 1;dist1(:,ind(1))= medianDist1 + 1; 58 | dist2(ind(1),:)= medianDist2 + 1;dist2(:,ind(1))= medianDist2 + 1; 59 | % updating the KNN graphs and the InVote graph 60 | KNNG1 = createKNNGraph(dist1,K,medianDist1,W); 61 | KNNG2 = createKNNGraph(dist2,K,medianDist2,W); 62 | ind = find(sum(xor(KNNG1_old,KNNG1),2)+sum(xor(KNNG2_old,KNNG2),2))'; 63 | [VGX,VGY] = updateVoteGraph(KNNG1,KNNG2,angle1,angle2,ind,VGX,VGY,W); 64 | 65 | VGX(outliers(end),:) = 0; VGX(:,outliers(end)) = 0; 66 | VGY(outliers(end),:) = 0; VGY(:,outliers(end)) = 0; 67 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69 | % % updating Inneighbor and Outneighbor with weighted 70 | NeighborVoteX = sum((VGX'+VGX))./(sum((KNNG1+KNNG1'))+eps); 71 | NeighborVoteY = sum((VGY'+VGY))./(sum((KNNG2+KNNG2'))+eps); 72 | NeighborVote = (NeighborVoteX + NeighborVoteY)/2; 73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 74 | inliers =1:length(P1); 75 | inliers = inliers(~ismember(inliers,outliers)); 76 | NeighborVote(outliers) = Inf; 77 | EA = 1- min(NeighborVote(inliers)); 78 | % checking the stop criteria 79 | if length(inliers)<= 3||EA< ea 80 | flag = 1; 81 | end 82 | Inter = Inter +1; 83 | end 84 | 85 | end 86 | %% 87 | % the function creates KNN graph that is not symetric. 88 | function G=createKNNGraph(dist,K,medianDist,W) 89 | G = zeros(length(dist)); 90 | for i = 1:length(dist) 91 | ind = find(dist(i,:)3 93 | [~,ind1] = sort(dist(i,ind)); 94 | ind = ind(ind1(1:min(K,length(ind1)))); 95 | G(i,ind) = W(i,ind); 96 | end 97 | G(i,i) = 1; W(i,i) =1; 98 | end 99 | end 100 | %% 101 | % the function creates weighted graph. 102 | function [VGX,VGY]= createVoteGraph(G1,G2,A1,A2,W) 103 | VGX = zeros(size(A1)); VGY = zeros(size(A2)); 104 | for i=1:size(A1,1) 105 | % VGX 106 | ind = find(G1(i,:)>0); ind = ind(ind~=i); 107 | if ~isempty(ind) 108 | knnA1X = A1(i,ind);knnA2X = A2(i,ind); 109 | [~,IndxAX] = sort(knnA1X); [~,IndxAY] = sort(knnA2X); 110 | CirLcs = CirclLCS(IndxAX,IndxAY); 111 | VGX(i,[ind(CirLcs) i])= length(CirLcs)/length(ind)*W(i,[ind(CirLcs) i]); 112 | else 113 | VGX(i,[i ind])= 0; 114 | end 115 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 116 | % VGY 117 | ind = find(G2(i,:)>0); ind = ind(ind~=i); 118 | if ~isempty(ind) 119 | knnA1Y = A1(i,ind);knnA2Y = A2(i,ind); 120 | [~,IndxAX] = sort(knnA1Y); [~,IndxAY] = sort(knnA2Y); 121 | CirLcs = CirclLCS(IndxAY,IndxAX); 122 | VGY(i,[ind(CirLcs) i])= length(CirLcs)/length(ind)*W(i,[ind(CirLcs) i]); 123 | else 124 | VGY(i,[i ind])= 0; 125 | end 126 | 127 | end 128 | end 129 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 130 | % the function updated weighted graph fastly. 131 | function [VGX,VGY] = updateVoteGraph(G1,G2,A1,A2,outliers,VGX,VGY,W) 132 | for j=1:length(outliers) 133 | i = outliers(j); 134 | ind = find(G1(i,:)>0);ind=ind(ind~=i); 135 | if ~isempty(ind) 136 | VGX(i,[i ind])= 0; 137 | knnA1X = A1(i,ind);knnA2X = A2(i,ind); 138 | [~,IndxAX] = sort(knnA1X); [~,IndxAY] = sort(knnA2X); 139 | CirLcs = CirclLCS(IndxAX,IndxAY); 140 | VGX(i,[ind(CirLcs) i])= length(CirLcs)/length(ind)*W(i,[ind(CirLcs) i]); 141 | else 142 | VGX(i,[i ind])= 0; 143 | end 144 | %%%%%%%%%%%%%%%%%%%%%%%% 145 | ind = find(G2(i,:)>0); ind = ind(ind~=i); 146 | if ~isempty(ind) 147 | VGY(i,[i ind])= 0; 148 | knnA1Y = A1(i,ind);knnA2Y = A2(i,ind); 149 | [~,IndxAX] = sort(knnA1Y); [~,IndxAY] = sort(knnA2Y); 150 | CirLcs = CirclLCS(IndxAY,IndxAX); 151 | VGY(i,[i ind(CirLcs)])= length(CirLcs)/length(ind)*W(i,[ind(CirLcs) i]); 152 | else 153 | VGY(i,[i ind])= 0; 154 | end 155 | end 156 | end 157 | %% 158 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 159 | 160 | function [lcstr,B] = CirclLCS(a,b) 161 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 162 | Db = [b b]; 163 | M = length(a); N = length(Db); 164 | C = zeros(M+1,N+1); B = C; 165 | for i = 2:M+1 166 | for j = 2:N+1 167 | if a(i-1) == Db(j-1) 168 | C(i,j) = C(i-1,j-1) + 1; 169 | B(i,j) = 0; 170 | else 171 | if C(i-1,j) >= C(i,j-1) 172 | C(i,j) = C(i-1,j); 173 | B(i,j) = 1; 174 | else 175 | C(i,j) = C(i,j-1); 176 | B(i,j) = -1; 177 | end 178 | end 179 | end 180 | end 181 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 182 | LCSL = 0; LIndx= []; 183 | for i = 1: (ceil(N/2)-1) 184 | TM = M+1; TN = ceil(N/2)+i; 185 | Indx = zeros(1,M); 186 | while TM>1 && TN>i 187 | if B(TM,TN) == 0 188 | Indx(TM-1) = 1; 189 | TN = TN-1; TM = TM-1; 190 | else 191 | if B(TM,TN)==-1 192 | TN = TN-1; 193 | else 194 | TM = TM-1; 195 | end 196 | end 197 | end 198 | if LCSL0); 204 | end 205 | -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/GTM.m: -------------------------------------------------------------------------------- 1 | function [inliers outliers]=GTM(P1,P2,K) 2 | % Graph Transformation Matching Algorithm: 3 | % The algorithm takes two sets of corresponding points (initial matches) and find matches 4 | % by finding two isomorphic graphs for them. 5 | % Input - P1: N X 2 vactor containing the first set of points (it could be generally used for matching points of higher dimentional spaces). 6 | % - P2: N X 2 vactor containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 7 | % - K: the number of closet neighbores of a point that are connected with point in the graph. 8 | 9 | % Output - inliers: the inlier matches 10 | % - outliers: the outlier matches 11 | 12 | 13 | % Copyright (c) 2010-2011 by Mohammad Izadi (mia4@sfu.ca), 14 | % Laboratory of Robotic Vision, School of Engineering Science, Simon Fraser University 15 | 16 | % Created: April 25 2010 17 | % Last Modified July 04 2011 18 | 19 | %% Distance matrices 20 | dist1=zeros(size(P1,1)); 21 | dist2=zeros(size(P2,1)); 22 | for i=1:size(P1,1) 23 | for j=1:size(P1,1) 24 | dist1(i,j)=sqrt(sum((P1(i,:)-P1(j,:)).^2)); 25 | dist2(i,j)=sqrt(sum((P2(i,:)-P2(j,:)).^2)); 26 | end 27 | end 28 | %% median distance 29 | medianDist1=median(dist1(:)); 30 | medianDist2=median(dist2(:)); 31 | 32 | %% GTM 33 | outliers=zeros(1,length(P1)); 34 | G1 = createKNNGraph(dist1,K,medianDist1); 35 | G2 = createKNNGraph(dist2,K,medianDist2); 36 | h = waitbar(0,'Please wait...'); 37 | while sum(sum(G1~=G2))>0 38 | waitbar(sum(outliers)/size(P1,1)) 39 | R = abs(G1-G2); 40 | [m,ind]=max(sum(R')); 41 | outliers(ind(1))=1; 42 | G1(ind(1),:)=0;G1(:,ind(1))=0; 43 | G2(ind(1),:)=0;G2(:,ind(1))=0; 44 | dist1(ind(1),:)=medianDist1+1;dist1(:,ind(1))=medianDist1+1; 45 | dist2(ind(1),:)=medianDist2+1;dist2(:,ind(1))=medianDist2+1; 46 | G1 = createKNNGraph(dist1,K,medianDist1); 47 | G2 = createKNNGraph(dist2,K,medianDist2); 48 | end 49 | outliers=find(sum(G1,2)'<=1); 50 | inliers=find(sum(G1,2)'>1); 51 | close(h) 52 | end 53 | % function G=createKNNGraph(dist,K,medianDist) 54 | % G = zeros(length(dist)); 55 | % for i=1:length(dist) 56 | % ind=find(dist(i,:)<=medianDist); 57 | % [d,ind1]=sort(dist(i,ind)); 58 | % ind=ind(ind1(1:min(K,length(ind1)))); 59 | % G(i,ind)=1; 60 | % end 61 | % end 62 | % 63 | % 64 | % 65 | % 66 | function G=createKNNGraph(dist,K,medianDist) 67 | G = zeros(length(dist)); 68 | 69 | % disconnecting all vertices that do not have K neighbors 70 | flag=0; 71 | while flag==0 72 | flag=1; 73 | for i=1:length(dist) 74 | ind=find(dist(i,:)<=medianDist); 75 | if length(ind)0 76 | dist(i,:)=Inf;dist(:,i)=Inf; 77 | flag=0; 78 | end 79 | end 80 | end 81 | 82 | % creating K-NN graph 83 | for i=1:length(dist) 84 | ind=find(dist(i,:)<=medianDist); 85 | [d,ind1]=sort(dist(i,ind)); 86 | if length(ind)>=K 87 | ind=ind(ind1(1:K)); 88 | else 89 | ind=[]; 90 | end 91 | G(i,ind)=1; 92 | end 93 | end 94 | -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/RSOC_OP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/OthersAlgorithms/WGTM/RSOC_OP.m -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/Readme.txt: -------------------------------------------------------------------------------- 1 | In this folder there are four functions: 2 | 3 | - GTM.m: This function is the implementaion of the GTM algorithm in Matlab. The function takes two sets of corresponding points P1 and P2 (initial 4 | matches) and finds matches using GTM algorithm by finding two isomorphic graphs for them. The inputs and outputs are detailed in the following: 5 | -Inputs: 6 | - P1: an array with size N X 2 containing the first set of points. 7 | - P2: an array with size N X 2 containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 8 | - K: the number of closet neighbores of a point that are connected with point in the graph. 9 | -Outputs: 10 | - inliers: the index of inlier matches in P1 and P2. 11 | - outliers: the index of outlier matches in P1 and P2. 12 | 13 | - GTM_C_EXE.m: The GTM algorithm is implemented in C++ and its execution file is used in this function for speeding up and utilizing in Matlab functions. 14 | All inputs and outputs are completely similar to those of the function GTM.m detailed above. 15 | 16 | - WGTM.m: This function is the implementaion of the WGTM algorithm in Matlab. The function takes two sets of corresponding points P1 and P2 (initial 17 | matches) and finds matches using WGTM algorithm by the geometrical relation between points. The inputs and outputs are detailed in the following: 18 | -Inputs: 19 | - P1: an array with size N X 2 containing the first set of points. 20 | - P2: an array with size N X 2 containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 21 | - K: the number of closet neighbores of a point that are connected with point in the graph. 22 | - emu: is the stopping threshold or the maximum change in the weighted graph after removing an outlier. 23 | -Outputs: 24 | - inliers: the index of inlier matches in P1 and P2. 25 | - outliers: the index of outlier matches in P1 and P2. 26 | 27 | - WGTM_C_EXE.m: The WGTM algorithm is implemented in C++ and its execution file is used in this function for speeding up and utilizing in Matlab functions. 28 | All inputs and outputs are completely similar to those of the function WGTM.m detailed above. 29 | 30 | *************** 31 | The source code of both functions in C++ exists in the folder "WGTM & GTM Source code in C++". In this folder, the project named "WGTM_C_Function" contains 32 | the c++ functions of both GTM and WGTM algorithm. This C++ source code is used to generate two execute file that are used in the function GTM_C_EXE.m and WGTM_C_EXE.m that 33 | are explained above. -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/WGTM.m: -------------------------------------------------------------------------------- 1 | function [inliers outliers,x]=WGTM(P1,P2,K,emu) 2 | % Weighted Graph Transformation Matching Algorithm: 3 | % The algorithm takes two sets of corresponding points (initial matches) and find matches 4 | % using the geometrical relation between points. 5 | 6 | % Input - P1: an array with size N X 2 containing the first set of points. 7 | % - P2: N X 2 vactor containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 8 | % - K: The number of closet neighbores of a point that are connected with point in the graph. 9 | % - emu: is the stopping threshold or the maximum change in the weighted graph after removing an 10 | % outlier. 11 | 12 | % Output - inliers: the inlier matches 13 | % - outliers: the outlier matches 14 | 15 | 16 | % Copyright (c) 2010-2011 by Mohammad Izadi (mia4@sfu.ca), 17 | % Laboratory of Robotic Vision, School of Engineering Science, Simon Fraser University 18 | 19 | % Created: May 10 2010 20 | % Last Modified October 18 2011 21 | % 22 | %% Distance matrices 23 | dist1=zeros(size(P1,1)); 24 | dist2=zeros(size(P2,1)); 25 | for i=1:size(P1,1) 26 | for j=1:size(P1,1) 27 | dist1(i,j)=norm(P1(i,:)-P1(j,:)); 28 | dist2(i,j)=norm(P2(i,:)-P2(j,:)); 29 | end 30 | end 31 | %% median distance 32 | medianDist1=median(dist1(:)); 33 | medianDist2=median(dist2(:)); 34 | 35 | %% WGTM algorithm 36 | 37 | outliers=[]; 38 | 39 | % creating KNN graphs 40 | KNNG1 = createKNNGraph(dist1,K,medianDist1); 41 | KNNG2 = createKNNGraph(dist2,K,medianDist2); 42 | 43 | % Creating the weighted graph 44 | WG = createWeightedGraph(KNNG1,KNNG2,P1,P2); 45 | 46 | angDist=90; 47 | flag=0; 48 | mu=[]; 49 | Mu=[]; 50 | x=[]; 51 | y=[]; 52 | for i=1:length(WG) 53 | 54 | if isempty(WG(i,WG(i,:)>=0)) 55 | x(i)=-1; 56 | y(i)=-1; 57 | else 58 | x(i)=mean(WG(i,WG(i,:)>=0)); 59 | y(i)=std(WG(i,WG(i,:)>=0)); 60 | end 61 | end 62 | inliers=1:length(P1); 63 | inliers=inliers(~ismember(inliers,outliers)); 64 | 65 | Mu=[Mu;max(WG(find(WG>=0)))*180/3.14]; 66 | mu=[mu;mean(x(x>=0))]; 67 | while flag==0 68 | KNNG1_old=KNNG1; 69 | KNNG2_old=KNNG2; 70 | 71 | % finding nodes that have less than two edges and considering as outlier 72 | x=max(WG'); 73 | ind=find(x<0); 74 | x1=sum(KNNG1'); 75 | x2=sum(KNNG1); 76 | ind=[ind find(x1<=2&x2<=2)]; 77 | ind=ind(~ismember(ind,outliers)); 78 | flag2=0; 79 | if ~isempty(ind) 80 | flag2=1; 81 | for i=1:length(ind) 82 | outliers=[outliers ind(i)]; 83 | dist1(ind(i),:)=medianDist1+1;dist1(:,ind(i))=medianDist1+1; 84 | dist2(ind(i),:)=medianDist2+1;dist2(:,ind(i))=medianDist2+1; 85 | end 86 | x=3.14; 87 | y=1; 88 | else 89 | 90 | %finding the worst node as outlier 91 | x=[]; 92 | y=[]; 93 | for i=1:length(WG) 94 | 95 | if isempty(WG(i,WG(i,:)>=0)) 96 | x(i)=-1; 97 | y(i)=-1; 98 | else 99 | x(i)=mean(WG(i,WG(i,:)>=0)); 100 | y(i)=std(WG(i,WG(i,:)>=0)); 101 | end 102 | end 103 | [a,ind]=max(x); 104 | outliers=[outliers ind(1)]; 105 | 106 | x(ind(1))=-1; 107 | dist1(ind(1),:)=medianDist1+1;dist1(:,ind(1))=medianDist1+1; 108 | dist2(ind(1),:)=medianDist2+1;dist2(:,ind(1))=medianDist2+1; 109 | end 110 | 111 | % updating the KNN graphs and the weeighted graph 112 | KNNG1 = createKNNGraph(dist1,K,medianDist1); 113 | KNNG2 = createKNNGraph(dist2,K,medianDist2); 114 | ind=find(sum(xor(KNNG1_old,KNNG1)')+sum(xor(KNNG2_old,KNNG2)')); 115 | [WG] = updateWeightedGraph(KNNG1,KNNG2,P1,P2,ind,WG); 116 | 117 | inliers=find(sum(KNNG1')>1); 118 | inliers=1:length(P1); 119 | inliers=inliers(~ismember(inliers,outliers)); 120 | if isempty(mu) 121 | Mu=[360 ;max(WG(find(WG>=0)))*180/3.14 ]; 122 | mu=[2*pi ;mean(x(x>=0))]; 123 | else 124 | Mu=[Mu;max(WG(find(WG>=0)))*180/3.14]; 125 | mu=[mu;mean(x(x>=0))]; 126 | end 127 | 128 | [length(inliers) abs(mu(end)-mu(end-1)) Mu(end) angDist] 129 | 130 | % checking the stop criteria 131 | if length(inliers)<=2||(flag2==0 && Mu(end)0; 155 | end 156 | %% 157 | % the function creates weighted graph. 158 | function [Gs]=createWeightedGraph(G1,G2,P1,P2) 159 | Gs = -ones(size(P1,1)); 160 | for i=1:size(P1,1) 161 | ind=find(G1(i,:)>0); 162 | ind=ind(ind~=i); 163 | ind1=find(G2(i,ind)==0); 164 | 165 | if ~isempty(ind) 166 | 167 | t=getAngularDistance(P1(ind,:)-ones(length(ind),1)*P1(i,:),P2(ind,:)-ones(length(ind),1)*P2(i,:)); 168 | 169 | if length(ind1)/length(ind)>0.5 170 | t(ind1)=3.14; 171 | end 172 | if any(isnan(t)) 173 | t(isnan(t))=-1; 174 | end 175 | Gs(i,ind)=t; 176 | end 177 | end 178 | end 179 | %% 180 | % the function updated weighted graph fastly. 181 | function [Gs]=updateWeightedGraph(G1,G2,P1,P2,outliers,Gs) 182 | for j=1:length(outliers) 183 | i=outliers(j); 184 | ind=find(G1(i,:)>0); 185 | ind=ind(ind~=i); 186 | ind1=find(G2(i,ind)==0); 187 | 188 | if ~isempty(ind) 189 | 190 | t=getAngularDistance(P1(ind,:)-ones(length(ind),1)*P1(i,:),P2(ind,:)-ones(length(ind),1)*P2(i,:)); 191 | 192 | if length(ind1)/length(ind)>0.5 193 | t(ind1)=3.14; 194 | end 195 | if any(isnan(t)) 196 | t(1:end)=-1; 197 | end 198 | Gs(i,:)=-1; 199 | Gs(i,ind)=t; 200 | else 201 | Gs(i,:)=-1; 202 | end 203 | end 204 | end 205 | %% 206 | % the function computes the angular distance between two nodes. 207 | function t=getAngularDistance(r1,r2) 208 | t=zeros(size(r1,1)); 209 | for j=1:size(r1,1) 210 | t1=acos(dot(r1(j,:),r2(j,:))/(norm(r1(j,:))*norm(r2(j,:)))); 211 | a=r2(j,:)*[cos(t1) -sin(t1);sin(t1) cos(t1)]; 212 | if abs(a(2)/a(1)-r1(j,2)/r1(j,1))>abs(a(1)/a(2)-r1(j,2)/r1(j,1)) 213 | t1=-t1; 214 | end 215 | 216 | r3=r2*[cos(t1) -sin(t1);sin(t1) cos(t1)]; 217 | for i=1:size(r1,1) 218 | t(j,i)=abs(acos(dot(r1(i,:),r3(i,:))/(norm(r1(i,:))*norm(r3(i,:))))); 219 | end 220 | end 221 | [a,ind]=min(mean(t,2)); 222 | t=t(ind,:); 223 | end 224 | -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/WGTM_C_EXE.m: -------------------------------------------------------------------------------- 1 | function [inliers,outliers]=WGTM_C_EXE(P1,P2,K,mu) 2 | % Weighted Graph Transformation Matching Algorithm implemented in C++: 3 | % The algorithm takes two sets of corresponding points (initial matches) and find matches 4 | % using the geometrical relation between points. 5 | % The WGTM algorithm is implemented in C++ and its execution file is used in 6 | % the following code for speeding up and utilizing in Matlab functions. 7 | 8 | % Input - P1: an array with size N X 2 containing the first set of points. 9 | % - P2: N X 2 vactor containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 10 | % - K: The number of closet neighbores of a point that are connected with point in the graph. 11 | % - emu: is the stopping threshold or the maximum change in the weighted graph after removing an 12 | % outlier. 13 | 14 | % Output - inliers: the inlier matches 15 | % - outliers: the outlier matches 16 | 17 | 18 | % Copyright (c) 2010-2011 by Mohammad Izadi (mia4@sfu.ca), 19 | % Laboratory of Robotic Vision, School of Engineering Science, Simon Fraser University 20 | 21 | % Created: May 10 2010 22 | % Last Modified October 18 2011 23 | % 24 | fid=fopen('input.txt','w'); 25 | fprintf(fid,'%f %f %f %f %f ',double(length(P1)),double(K),double(mu),double(P1'),double(P2')); 26 | fclose(fid); 27 | dos('WGTM_C_Function.exe'); 28 | fid=fopen('output.txt','r'); 29 | y=fscanf(fid,'%f'); 30 | outliers=find(y'); 31 | inliers=find(y'==0); 32 | fclose(fid); 33 | -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/WGTM_C_Function-2015-12-08.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/OthersAlgorithms/WGTM/WGTM_C_Function-2015-12-08.zip -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/WGTM_C_Function.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/OthersAlgorithms/WGTM/WGTM_C_Function.exe -------------------------------------------------------------------------------- /OthersAlgorithms/WGTM/WGTM_P_function_alpha1.m: -------------------------------------------------------------------------------- 1 | function [inliers outliers,x]=WGTM_P_function_alpha1(P1,P2,K,emu) 2 | % Weighted Graph Transformation Matching Algorithm: 3 | % The algorithm takes two sets of corresponding points (initial matches) and find matches 4 | % using the geometrical relation between points. 5 | 6 | % Input - P1: an array with size N X 2 containing the first set of points. 7 | % - P2: N X 2 vactor containing the corresponding points of the first set of points (the m-th point of P1 and P2 are initially matched). 8 | % - K: The number of closet neighbores of a point that are connected with point in the graph. 9 | % - emu: is the stopping threshold or the maximum change in the weighted graph after removing an 10 | % outlier. 11 | 12 | % Output - inliers: the inlier matches 13 | % - outliers: the outlier matches 14 | 15 | 16 | % Copyright (c) 2010-2011 by Mohammad Izadi (mia4@sfu.ca), 17 | % Laboratory of Robotic Vision, School of Engineering Science, Simon Fraser University 18 | 19 | % Created: May 10 2010 20 | % Last Modified October 18 2011 21 | % 22 | %% Distance matrices 23 | dist1=zeros(size(P1,1)); 24 | dist2=zeros(size(P2,1)); 25 | for i=1:size(P1,1) 26 | for j=1:size(P1,1) 27 | dist1(i,j)=norm(P1(i,:)-P1(j,:)); 28 | dist2(i,j)=norm(P2(i,:)-P2(j,:)); 29 | end 30 | end 31 | %% median distance 32 | medianDist1=median(dist1(:)); 33 | medianDist2=median(dist2(:)); 34 | 35 | %% WGTM algorithm 36 | 37 | outliers=[]; 38 | 39 | % creating KNN graphs 40 | KNNG1 = createKNNGraph(dist1,K,medianDist1); 41 | KNNG2 = createKNNGraph(dist2,K,medianDist2); 42 | 43 | % Creating the weighted graph 44 | WG = createWeightedGraph(KNNG1,KNNG2,P1,P2); 45 | 46 | angDist=90; 47 | flag=0; 48 | mu=[]; 49 | Mu=[]; 50 | x=[]; 51 | y=[]; 52 | for i=1:length(WG) 53 | 54 | if isempty(WG(i,WG(i,:)>=0)) 55 | x(i)=-1; 56 | y(i)=-1; 57 | else 58 | x(i)=mean(WG(i,WG(i,:)>=0)); 59 | y(i)=std(WG(i,WG(i,:)>=0)); 60 | end 61 | end 62 | inliers=1:length(P1); 63 | inliers=inliers(~ismember(inliers,outliers)); 64 | 65 | Mu=[Mu;max(WG((WG>=0)))*180/3.14]; 66 | mu=[mu;mean(x(x>=0))]; 67 | while flag==0 68 | KNNG1_old=KNNG1; 69 | KNNG2_old=KNNG2; 70 | 71 | % finding nodes that have less than two edges and considering as outlier 72 | x=max(WG'); 73 | ind=find(x<0); 74 | x1=sum(KNNG1'); 75 | x2=sum(KNNG1); 76 | ind=[ind find(x1<=2&x2<=2)]; 77 | ind=ind(~ismember(ind,outliers)); 78 | flag2=0; 79 | if ~isempty(ind) 80 | flag2=1; 81 | for i=1:length(ind) 82 | outliers=[outliers ind(i)]; 83 | dist1(ind(i),:)=medianDist1+1;dist1(:,ind(i))=medianDist1+1; 84 | dist2(ind(i),:)=medianDist2+1;dist2(:,ind(i))=medianDist2+1; 85 | end 86 | x=3.14; 87 | y=1; 88 | else 89 | 90 | %finding the worst node as outlier 91 | x=[]; 92 | y=[]; 93 | for i=1:length(WG) 94 | 95 | if isempty(WG(i,WG(i,:)>=0)) 96 | x(i)=-1; 97 | y(i)=-1; 98 | else 99 | x(i)=mean(WG(i,WG(i,:)>=0)); 100 | y(i)=std(WG(i,WG(i,:)>=0)); 101 | end 102 | end 103 | [a,ind]=max(x); 104 | outliers=[outliers ind(1)]; 105 | 106 | x(ind(1))=-1; 107 | dist1(ind(1),:)=medianDist1+1;dist1(:,ind(1))=medianDist1+1; 108 | dist2(ind(1),:)=medianDist2+1;dist2(:,ind(1))=medianDist2+1; 109 | end 110 | 111 | % updating the KNN graphs and the weeighted graph 112 | KNNG1 = createKNNGraph(dist1,K,medianDist1); 113 | KNNG2 = createKNNGraph(dist2,K,medianDist2); 114 | ind=find(sum(xor(KNNG1_old,KNNG1)')+sum(xor(KNNG2_old,KNNG2)')); 115 | [WG] = updateWeightedGraph(KNNG1,KNNG2,P1,P2,ind,WG); 116 | 117 | inliers=find(sum(KNNG1')>1); 118 | inliers=1:length(P1); 119 | inliers=inliers(~ismember(inliers,outliers)); 120 | if isempty(mu) 121 | Mu=[360 ;max(WG((WG>=0)))*180/3.14 ]; 122 | mu=[2*pi ;mean(x(x>=0))]; 123 | else 124 | Mu=[Mu;max(WG((WG>=0)))*180/3.14]; 125 | mu=[mu;mean(x(x>=0))]; 126 | end 127 | 128 | % [length(inliers) abs(mu(end)-mu(end-1)) Mu(end) angDist] 129 | 130 | % checking the stop criteria 131 | if length(inliers)<=2||(flag2==0 && Mu(end)0; 155 | end 156 | %% 157 | % the function creates weighted graph. 158 | function [Gs]=createWeightedGraph(G1,G2,P1,P2) 159 | Gs = -ones(size(P1,1)); 160 | for i=1:size(P1,1) 161 | ind=find(G1(i,:)>0); 162 | ind=ind(ind~=i); 163 | ind1=find(G2(i,ind)==0); 164 | 165 | if ~isempty(ind) 166 | 167 | t=getAngularDistance(P1(ind,:)-ones(length(ind),1)*P1(i,:),P2(ind,:)-ones(length(ind),1)*P2(i,:)); 168 | 169 | if length(ind1)/length(ind)>0.5 170 | t(ind1)=3.14; 171 | end 172 | if any(isnan(t)) 173 | t(isnan(t))=-1; 174 | end 175 | Gs(i,ind)=t; 176 | end 177 | end 178 | end 179 | %% 180 | % the function updated weighted graph fastly. 181 | function [Gs]=updateWeightedGraph(G1,G2,P1,P2,outliers,Gs) 182 | for j=1:length(outliers) 183 | i=outliers(j); 184 | ind=find(G1(i,:)>0); 185 | ind=ind(ind~=i); 186 | ind1=find(G2(i,ind)==0); 187 | 188 | if ~isempty(ind) 189 | 190 | t=getAngularDistance(P1(ind,:)-ones(length(ind),1)*P1(i,:),P2(ind,:)-ones(length(ind),1)*P2(i,:)); 191 | 192 | if length(ind1)/length(ind)>0.5 193 | t(ind1)=3.14; 194 | end 195 | if any(isnan(t)) 196 | t(1:end)=-1; 197 | end 198 | Gs(i,:)=-1; 199 | Gs(i,ind)=t; 200 | else 201 | Gs(i,:)=-1; 202 | end 203 | end 204 | end 205 | %% 206 | % the function computes the angular distance between two nodes. 207 | function t=getAngularDistance(r1,r2) 208 | t=zeros(size(r1,1)); 209 | for j=1:size(r1,1) 210 | t1=acos(dot(r1(j,:),r2(j,:))/(norm(r1(j,:))*norm(r2(j,:)))); 211 | a=r2(j,:)*[cos(t1) -sin(t1);sin(t1) cos(t1)]; 212 | if abs(a(2)/a(1)-r1(j,2)/r1(j,1))>abs(a(1)/a(2)-r1(j,2)/r1(j,1)) 213 | t1=-t1; 214 | end 215 | 216 | r3=r2*[cos(t1) -sin(t1);sin(t1) cos(t1)]; 217 | for i=1:size(r1,1) 218 | t(j,i)=abs(acos(dot(r1(i,:),r3(i,:))/(norm(r1(i,:))*norm(r3(i,:))))); 219 | end 220 | end 221 | [a,ind]=min(mean(t,2)); 222 | t=t(ind,:); 223 | end 224 | -------------------------------------------------------------------------------- /ParFeatureMatching_CalcuSearchingRange_alpha2.m: -------------------------------------------------------------------------------- 1 | function SearchingRange = ParFeatureMatching_CalcuSearchingRange_alpha2(Inliers_ProjectedLocation1,EpiLines1ab) 2 | %{ 3 | 2018/09/02 4 | ParFeatureMatching_CalcuSearchingRange_alpha2 5 | 1. Calculate the searching range depending on the epipolar line which has 6 | the maximum slope and on the projected features in I1. 7 | 8 | 2018/08/31 9 | ParFeatureMatching_CalcuSearchingRange_alpha1 10 | 1. Calculate the searching range depending on the epipolar line which has 11 | the maximum slope and on the projected size of I1. 12 | 13 | %} 14 | % numRows = SizeI1(1); 15 | % numCols = SizeI1(2); 16 | % inPts = [1, 1; 1, numRows; numCols, numRows; numCols, 1]; 17 | % outPts = transformPointsForward(tform1, inPts); 18 | 19 | [MaxSlope,MaxSlopeN] = max(abs(EpiLines1ab(:,1))); 20 | % xL = [Left_Most1 Right_Most1]; 21 | EL = polyval(EpiLines1ab(MaxSlopeN,:),[max(Inliers_ProjectedLocation1(:,1)) min(Inliers_ProjectedLocation1(:,1))]); 22 | 23 | SearchingRange = abs(EL(1)-EL(2)); -------------------------------------------------------------------------------- /ParFeatureMatching_FindGoodEmission_alpha2.m: -------------------------------------------------------------------------------- 1 | function [GoodClassidx,tform1,tform2,QualifiedSampling,Sampled_Location1,Sampled_Location2,SearchingRange,RealSearchingRange,k,EpiLines1ab,EpiLines2ab] = ParFeatureMatching_FindGoodEmission_alpha2(Sampled_Location1,Sampled_Location2,SizeI2,Location1) 2 | %{ 3 | 2018/09/12 4 | ParFeatureMatching_FindGoodEmission_alpha2 5 | 1. Remove outliers 6 | 7 | 8 | 2018/09/10 9 | ParFeatureMatching_FindGoodEmission_alpha1 10 | 1. For real images 11 | 2. Find good sampling with accordant transmation angle by k-means 12 | 13 | 2018/09/10 14 | ParFeatureMatching_Model_FindGoodEmission_alpha1 15 | 1. For simulated datasets 16 | 2. Find good sampling with accordant transmation angle by k-means 17 | 18 | 19 | %} 20 | k = 0; 21 | QualifiedSampling = false; 22 | GoodClassidx = []; 23 | tform1 = []; 24 | tform2 = []; 25 | EpiLines1ab = []; 26 | EpiLines2ab = []; 27 | SearchingRange = []; 28 | RealSearchingRange = []; 29 | 30 | Sampled_Location1Old = Sampled_Location1; 31 | Sampled_Location2Old = Sampled_Location2; 32 | 33 | while ~QualifiedSampling 34 | k = k + 1; 35 | % [idx,~,~,~] = kmeans(Vector_Location,k,'Distance','cosine'); 36 | Vector_Location = Sampled_Location1 - Sampled_Location2; 37 | idx = kmeans(Vector_Location,k,'Distance','cosine'); 38 | %% Get class number 39 | ClassN = zeros(1,k); 40 | Classidx = cell(1,k); 41 | for i = 1:k 42 | Classidx{i} = (idx==i); 43 | ClassN(i) = sum(Classidx{i}); 44 | end 45 | if max(ClassN) < 30 46 | x = 1; 47 | break 48 | end 49 | %% 50 | tformTemp = cell(k,2); 51 | EpiLinesabTemp = cell(k,2); 52 | QualifiedSamplingTemp = false(1,k); 53 | SearchingRangeTemp = Inf(1,k); 54 | DifferMaxTemp = Inf(1,k); 55 | MinimumSearchingRangeTemp = zeros(1,k); 56 | WrongIdxTemp = false(size(Sampled_Location1,1),1); 57 | % figure, 58 | for i = 1:k 59 | CurrentWrong = true; 60 | 61 | if ClassN(i) >= 30 62 | 63 | while CurrentWrong && ClassN(i) > 30 64 | Current_Sampled_Location1 = Sampled_Location1(Classidx{i},:); 65 | Current_Sampled_Location2 = Sampled_Location2(Classidx{i},:); 66 | %% 67 | 68 | x = 1; 69 | %% 70 | Current_Fundemantal = RANSAC_Norm8Point_alpha2(Current_Sampled_Location1, Current_Sampled_Location2); 71 | [t1, t2] = estimateUncalibratedRectification(Current_Fundemantal, Current_Sampled_Location1, Current_Sampled_Location2,SizeI2); 72 | 73 | tformTemp{i,1} = projective2d(t1); 74 | tformTemp{i,2} = projective2d(t2); 75 | 76 | Sampled_ProjectedLocation1 = transformPointsForward(tformTemp{i,1}, Sampled_Location1); 77 | Sampled_ProjectedLocation2 = transformPointsForward(tformTemp{i,2}, Sampled_Location2); 78 | 79 | %% 80 | Current_Sampled_ProjectedLocation1 = Sampled_ProjectedLocation1(Classidx{i},:); 81 | Current_Sampled_ProjectedLocation2 = Sampled_ProjectedLocation2(Classidx{i},:); 82 | 83 | Qualified_Sampled_ProjectedLocation1 = Sampled_ProjectedLocation1(~WrongIdxTemp,:); 84 | Qualified_Sampled_ProjectedLocation2 = Sampled_ProjectedLocation2(~WrongIdxTemp,:); 85 | 86 | [EpiLinesabTemp{i,1},EpiLinesabTemp{i,2}] = CalculateEpipolarLine_alpha2(Current_Sampled_ProjectedLocation1,Current_Sampled_ProjectedLocation2,Qualified_Sampled_ProjectedLocation1,Qualified_Sampled_ProjectedLocation2); 87 | 88 | 89 | 90 | MayQualified1Temp = (abs(EpiLinesabTemp{i,1}(:,1))<0.01); 91 | MayQualified2Temp = (abs(EpiLinesabTemp{i,2}(:,1))<0.01); 92 | MayQualifiedPairsTemp = (MayQualified1Temp&MayQualified2Temp); 93 | QualifiedSamplingTemp(i) = all(MayQualifiedPairsTemp); 94 | 95 | %% Remove outliers 96 | ProjectedLocation1 = transformPointsForward(tformTemp{i,1}, Location1); 97 | SearchingRange = ParFeatureMatching_CalcuSearchingRange_alpha2(ProjectedLocation1,EpiLinesabTemp{i,1}); 98 | MinimumSearchingRange = ((max(ProjectedLocation1(:,2)) - min(ProjectedLocation1(:,2)))/size(ProjectedLocation1,1))*50; 99 | Diff = abs(Sampled_ProjectedLocation1(:,2) - Sampled_ProjectedLocation2(:,2)); 100 | WrongIdx = Diff>max([SearchingRange MinimumSearchingRange]); 101 | 102 | if any(WrongIdx) 103 | WrongIdxTemp = WrongIdxTemp | WrongIdx; 104 | for j = 1:k 105 | if i==j && any(WrongIdx(Classidx{j})) 106 | x = 1; 107 | % CurrentWrong = true; 108 | else 109 | CurrentWrong = false; 110 | end 111 | x = 1; 112 | ClassN(j) = ClassN(j) - sum(Classidx{j}(WrongIdx)); 113 | Classidx{j}(WrongIdx) = false; 114 | x = 1; 115 | end 116 | 117 | x =1; 118 | else 119 | CurrentWrong = false; 120 | end 121 | end 122 | 123 | x = 1; 124 | 125 | if QualifiedSamplingTemp(i) 126 | Qualified_Sampled_ProjectedLocation1 = Sampled_ProjectedLocation1(~WrongIdxTemp,:); 127 | Qualified_Sampled_ProjectedLocation2 = Sampled_ProjectedLocation2(~WrongIdxTemp,:); 128 | 129 | DifferMaxTemp(i) = max(abs(Qualified_Sampled_ProjectedLocation1(:,2)-Qualified_Sampled_ProjectedLocation2(:,2))); 130 | % ProjectedLocation1 = transformPointsForward(tformTemp{i,1}, Location1); 131 | SearchingRangeTemp(i) = SearchingRange; 132 | MinimumSearchingRangeTemp(i) = MinimumSearchingRange; 133 | % SearchingRangeTemp(i) = ParFeatureMatching_CalcuSearchingRange_alpha2(ProjectedLocation1,EpiLinesabTemp{i,1}); 134 | % MinimumSearchingRangeTemp(i) = ((max(ProjectedLocation1(:,2)) - min(ProjectedLocation1(:,2)))/size(ProjectedLocation1,1))*50; 135 | 136 | % Diff = abs(Sampled_ProjectedLocation1(:,2) - Sampled_ProjectedLocation2(:,2)); 137 | % max(Diff) 138 | 139 | % figure, 140 | % plot(Current_Sampled_Location1(:,1),Current_Sampled_Location1(:,2),'r*');hold on 141 | % plot(Current_Sampled_Location2(:,1),Current_Sampled_Location2(:,2),'k*'); 142 | % line([Current_Sampled_Location1(:,1)';Current_Sampled_Location2(:,1)'],[Current_Sampled_Location1(:,2)';Current_Sampled_Location2(:,2)'],'Color','g'); 143 | % 144 | % figure, 145 | % plot(Qualified_Sampled_ProjectedLocation1(:,1),Qualified_Sampled_ProjectedLocation1(:,2),'r*');hold on 146 | % plot(Qualified_Sampled_ProjectedLocation2(:,1),Qualified_Sampled_ProjectedLocation2(:,2),'k*'); 147 | % line([Qualified_Sampled_ProjectedLocation1(:,1)';Qualified_Sampled_ProjectedLocation2(:,1)'],[Qualified_Sampled_ProjectedLocation1(:,2)';Qualified_Sampled_ProjectedLocation2(:,2)'],'Color','g'); 148 | x = 1; 149 | end 150 | 151 | end 152 | end 153 | if any(WrongIdxTemp) 154 | Sampled_Location1(WrongIdxTemp,:) = []; 155 | Sampled_Location2(WrongIdxTemp,:) = []; 156 | for j = 1:k 157 | Classidx{j}(WrongIdxTemp) = []; 158 | end 159 | end 160 | 161 | if any(QualifiedSamplingTemp) 162 | QualifiedSampling = true; 163 | [~,GoodClass] = min(DifferMaxTemp); 164 | GoodClassidx = Classidx{GoodClass}; 165 | tform1 = tformTemp{GoodClass,1}; 166 | tform2 = tformTemp{GoodClass,2}; 167 | EpiLines1ab = EpiLinesabTemp{GoodClass,1}; 168 | EpiLines2ab = EpiLinesabTemp{GoodClass,2}; 169 | SearchingRange = SearchingRangeTemp(GoodClass); 170 | RealSearchingRange = max([SearchingRange MinimumSearchingRangeTemp(GoodClass)]); 171 | % x = 1; 172 | %% get real searching range 173 | 174 | %% 175 | Sampled_ProjectedLocation1 = transformPointsForward(tformTemp{GoodClass,1}, Sampled_Location1); 176 | Sampled_ProjectedLocation2 = transformPointsForward(tformTemp{GoodClass,2}, Sampled_Location2); 177 | 178 | % figure, 179 | % plot(Sampled_Location1Old(:,1),Sampled_Location1Old(:,2),'r*');hold on 180 | % plot(Sampled_Location2Old(:,1),Sampled_Location2Old(:,2),'k*'); 181 | % line([Sampled_Location1Old(:,1)';Sampled_Location2Old(:,1)'],[Sampled_Location1Old(:,2)';Sampled_Location2Old(:,2)'],'Color','g'); 182 | % 183 | % figure, 184 | % plot(Sampled_Location1(:,1),Sampled_Location1(:,2),'r*');hold on 185 | % plot(Sampled_Location2(:,1),Sampled_Location2(:,2),'k*'); 186 | % line([Sampled_Location1(:,1)';Sampled_Location2(:,1)'],[Sampled_Location1(:,2)';Sampled_Location2(:,2)'],'Color','g'); 187 | % 188 | % figure, 189 | % plot(Sampled_ProjectedLocation1(:,1),Sampled_ProjectedLocation1(:,2),'r*');hold on 190 | % plot(Sampled_ProjectedLocation2(:,1),Sampled_ProjectedLocation2(:,2),'k*'); 191 | % line([Sampled_ProjectedLocation1(:,1)';Sampled_ProjectedLocation2(:,1)'],[Sampled_ProjectedLocation1(:,2)';Sampled_ProjectedLocation2(:,2)'],'Color','g'); 192 | % RemainRatio = (max(Sampled_Location1(:,2))-min(Sampled_Location1(:,2)))/(max(Sampled_Location1Old(:,2))-min(Sampled_Location1Old(:,2))) 193 | % x = 1; 194 | end 195 | end 196 | 197 | %% 198 | -------------------------------------------------------------------------------- /ParFeatureMatching_FindGoodEpipolar_checkUniform_alpha1.m: -------------------------------------------------------------------------------- 1 | function [indexPairs,Toltalinliers,IfUniform] = ParFeatureMatching_FindGoodEpipolar_checkUniform_alpha1(features1,features2,validBlobs1,validBlobs2,I2,Indices) 2 | %{ 3 | 2018/04/14 4 | ParFeatureMatching_FindGoodEpipolar_alpha2 5 | 1. For uniform distribution 6 | 2. Add block 7 | 8 | %} 9 | Samplefeatures1 = features1(:,Indices); 10 | SamplevalidBlobs1 = validBlobs1(Indices,:); 11 | % 12 | [indexPairs, Scores] = vl_ubcmatch(Samplefeatures1,features2); 13 | indexPairs = indexPairs'; 14 | 15 | %% 16 | 17 | %% 18 | SampleLocation1 = SamplevalidBlobs1.Location; 19 | Location2 = validBlobs2.Location; 20 | MatchedSampleLocation1 = SampleLocation1(indexPairs(:,1),:); 21 | MatchedLocation2 = Location2(indexPairs(:,2),:); 22 | [indexPairs,~] = SIFT_RemoveSameMatching_alpha1(MatchedSampleLocation1,MatchedLocation2,Scores,indexPairs); 23 | 24 | 25 | MatchedSampleLocation1 = SampleLocation1(indexPairs(:,1),:); 26 | MatchedLocation2 = Location2(indexPairs(:,2),:); 27 | %% 28 | IfUniform = false; 29 | BlockNum = 5; 30 | One2OneNum = size(indexPairs,1); 31 | Toltalinliers = false(One2OneNum,1); 32 | 33 | % [~, inliers] = RANSAC_alpha1(MatchedSampleLocation1, MatchedLocation2, One2OneNum, 0.00001); 34 | % Toltalinliers(inliers) = true; 35 | 36 | % 37 | Mdl_MatchedSampleLocation1Row = KDTreeSearcher(MatchedSampleLocation1(:,2)); 38 | Min_MatchedSampleLocation1Row = min(Mdl_MatchedSampleLocation1Row.X); 39 | Max_MatchedSampleLocation1Row = max(Mdl_MatchedSampleLocation1Row.X); 40 | 41 | Interval = (Max_MatchedSampleLocation1Row - Min_MatchedSampleLocation1Row)/BlockNum; 42 | % NumRef = 1:One2OneNum; 43 | % Curr_NumRefDebug = []; 44 | inliersNum = zeros(1,BlockNum); 45 | for i = 1:BlockNum 46 | Curr_RowMin = Min_MatchedSampleLocation1Row + Interval*(i-1); 47 | if i ~= BlockNum 48 | Curr_RowMax = Min_MatchedSampleLocation1Row + Interval*i; 49 | else 50 | Curr_RowMax = Min_MatchedSampleLocation1Row + (Interval*i) + 1; 51 | end 52 | Curr_Num = (Mdl_MatchedSampleLocation1Row.X >= Curr_RowMin) & (Mdl_MatchedSampleLocation1Row.X < Curr_RowMax); 53 | % Curr_NumRef = NumRef(Curr_Num); 54 | % Curr_NumRefDebug = [Curr_NumRefDebug Curr_NumRef]; 55 | [~, inliers] = RANSAC_alpha1(MatchedSampleLocation1(Curr_Num,:), MatchedLocation2(Curr_Num,:), sum(Curr_Num), 0.00001); 56 | inliersNum(i) = sum(inliers); 57 | Toltalinliers(Curr_Num) = inliers; 58 | end 59 | 60 | if sum(Toltalinliers) > 8 61 | IfUniform = CheckUniform_alpha2(double(MatchedSampleLocation1),Toltalinliers,0.75); 62 | end 63 | % 64 | % if IfUniform 65 | % RegistedMatchedSampleLocation1 = MatchedSampleLocation1(Toltalinliers,:); 66 | % RegistedMatchedLocation2 = MatchedLocation2(Toltalinliers,:); 67 | % Best_F = RANSAC_Norm8Point(RegistedMatchedSampleLocation1', RegistedMatchedLocation2'); 68 | % [t1, t2] = estimateUncalibratedRectification(Best_F, RegistedMatchedSampleLocation1, RegistedMatchedLocation2, size(I2)); 69 | % tform1 = projective2d(t1); 70 | % tform2 = projective2d(t2); 71 | % else 72 | % tform1 = []; 73 | % tform2 = []; 74 | % end 75 | 76 | % Length1 = max(SampleLocation1(:,1)) - min(SampleLocation1(:,1)); 77 | % Width1 = max(SampleLocation1(:,2)) - min(SampleLocation1(:,2)); 78 | % 79 | % LengthMatched1 = max(MatchedSampleLocation1(Toltalinliers,1)) - min(MatchedSampleLocation1(Toltalinliers,1)); 80 | % WidthMatched1 = max(MatchedSampleLocation1(Toltalinliers,2)) - min(MatchedSampleLocation1(Toltalinliers,2)); 81 | % 82 | % LengthRatio1 = LengthMatched1/Length1; 83 | % WidthRatio1 = WidthMatched1/Width1; 84 | % if ~IfGood 85 | % InliersDifferSTD = 100; 86 | % tform1 = []; 87 | % tform2 = []; 88 | % indexPairs = []; 89 | % Toltalinliers = []; 90 | % return 91 | % end 92 | % matchedPoints1 = SamplevalidBlobs1(indexPairs(Toltalinliers,1),:); 93 | % matchedPoints2 = validBlobs2(indexPairs(Toltalinliers,2),:); 94 | % figure,showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2); 95 | %{ 96 | RegistedMatchedSampleLocation1 = MatchedSampleLocation1(Toltalinliers,:); 97 | RegistedMatchedLocation2 = MatchedLocation2(Toltalinliers,:); 98 | Best_F = RANSAC_Norm8Point(RegistedMatchedSampleLocation1', RegistedMatchedLocation2'); 99 | [t1, t2] = estimateUncalibratedRectification(Best_F, RegistedMatchedSampleLocation1, RegistedMatchedLocation2, size(I2)); 100 | tform1 = projective2d(t1); 101 | tform2 = projective2d(t2); 102 | 103 | RegistedMatchedSampleLocation1out = transformPointsForward(tform1, RegistedMatchedSampleLocation1); 104 | RegistedMatchedLocation2out = transformPointsForward(tform2, RegistedMatchedLocation2); 105 | 106 | InliersDiffer = RegistedMatchedSampleLocation1out(:,2) - RegistedMatchedLocation2out(:,2); 107 | InliersDifferSTD = std(InliersDiffer); 108 | 109 | 110 | % figure, 111 | % plot(RegistedMatchedSampleLocation1out(:,1),RegistedMatchedSampleLocation1out(:,2),'yo');hold on 112 | % plot(RegistedMatchedLocation2out(:,1),RegistedMatchedLocation2out(:,2),'g*'); 113 | % for i = 1:sum(inliers) 114 | % line([RegistedMatchedSampleLocation1out(i,1) RegistedMatchedLocation2out(i,1)],[RegistedMatchedSampleLocation1out(i,2) RegistedMatchedLocation2out(i,2)],'Color','k'); 115 | % end 116 | %% 117 | %{ 118 | [Best_F, inliers] = RANSAC_alpha1(MatchedSampleLocation1, MatchedLocation2, 2000, 0.00001);%0.00001 119 | %[Accuracy,Recall,Precision,Specificity,ResultingInliersNum,ResultingOutliersNum,ResultingOutliersRatio] = Evaluate_alpha1(MatchedLocation1,inliers,TrueInliers,TrueOutiers); 120 | 121 | % matchedPoints1 = SamplevalidBlobs1(indexPairs(inliers,1),:); 122 | % matchedPoints2 = validBlobs2(indexPairs(inliers,2),:); 123 | % figure, 124 | % showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2); 125 | %% 126 | RegistedMatchedSampleLocation1 = MatchedSampleLocation1(inliers,:); 127 | RegistedMatchedLocation2 = MatchedLocation2(inliers,:); 128 | 129 | 130 | [t1, t2] = estimateUncalibratedRectification(Best_F, RegistedMatchedSampleLocation1, RegistedMatchedLocation2, size(I2)); 131 | 132 | tform1 = projective2d(t1); 133 | tform2 = projective2d(t2); 134 | 135 | RegistedMatchedSampleLocation1out = transformPointsForward(tform1, RegistedMatchedSampleLocation1); 136 | RegistedMatchedLocation2out = transformPointsForward(tform2, RegistedMatchedLocation2); 137 | 138 | InliersDiffer = RegistedMatchedSampleLocation1out(:,2) - RegistedMatchedLocation2out(:,2); 139 | InliersDifferSTD = std(InliersDiffer); 140 | 141 | %% 142 | matchedPoints1 = SamplevalidBlobs1(indexPairs(inliers,1),:); 143 | matchedPoints2 = validBlobs2(indexPairs(inliers,2),:); 144 | figure,showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2); 145 | % plot(RegistedMatchedSampleLocation1out(:,1),RegistedMatchedSampleLocation1out(:,2),'yo');hold on 146 | % plot(RegistedMatchedLocation2out(:,1),RegistedMatchedLocation2out(:,2),'g*'); 147 | % for i = 1:sum(inliers) 148 | % line([RegistedMatchedSampleLocation1out(i,1) RegistedMatchedLocation2out(i,1)],[RegistedMatchedSampleLocation1out(i,2) RegistedMatchedLocation2out(i,2)],'Color','k'); 149 | % end 150 | % 151 | % x =1; 152 | %} 153 | 154 | %} -------------------------------------------------------------------------------- /ParFeatureMatching_ParMatching_alpha3.m: -------------------------------------------------------------------------------- 1 | function [indexPairsParAll,ScoresParAll,RecordIndies] = ParFeatureMatching_ParMatching_alpha3(features1,features2,Location1Rect,Location2Rect,ThresholdD,I2,Qualified_Matched_Location1Rect,Qualified_Matched_Location2Rect) 2 | %{ 3 | 2018/09/11 4 | ParFeatureMatching_ParMatching_alpha3 5 | 1. Get dynamic searching reange for real HiRISE images 6 | 7 | 2018/04/12 8 | ParFeatureMatching_ParMatching_alpha2 9 | 1. Add i=1 and i = Match_Num 10 | %} 11 | Mdl_Location1Rect_Column = KDTreeSearcher(Location1Rect(:,2)); 12 | Mdl_Location2Rect_Column = KDTreeSearcher(Location2Rect(:,2)); 13 | 14 | Location1RectNum = size(Location1Rect,1); 15 | Allindex_L = 1:Location1RectNum; 16 | Allindex_L = Allindex_L'; 17 | ToltalNum_R = size(Location2Rect,1); 18 | Allindex_R = 1:ToltalNum_R; 19 | Allindex_R = Allindex_R'; 20 | % ThresholdD = 10; 21 | ColumnNum = size(I2,1); 22 | indexPairsParAll = uint32([]); 23 | ScoresParAll = []; 24 | RecordIndies = uint32([]); 25 | % RecordRef = false(Match_Num,1); 26 | 27 | %% ! here 28 | Top = max(Mdl_Location1Rect_Column.X);%(:,2) 29 | Bottom = min(Mdl_Location1Rect_Column.X); 30 | TopR = max(Mdl_Location2Rect_Column.X); 31 | BottomR = min(Mdl_Location2Rect_Column.X); 32 | 33 | Interval = ThresholdD; 34 | Interval_Half = Interval/2; 35 | 36 | 37 | %% 38 | SearchingLine_L = Top-Interval_Half:-Interval:Bottom+Interval_Half; 39 | SearchingLine_L_Top = SearchingLine_L + Interval_Half; 40 | SearchingLine_L_Bottom = SearchingLine_L - Interval_Half; 41 | SearchingLine_L_Top = [SearchingLine_L_Top SearchingLine_L_Bottom(end)]; 42 | SearchingLine_L_Bottom = [SearchingLine_L_Bottom Bottom]; 43 | SearchingLine_L = [SearchingLine_L (SearchingLine_L_Top(end) - (SearchingLine_L_Top(end)-SearchingLine_L_Bottom(end))/2)]; 44 | 45 | %% Get the nearest features to searching line 46 | SearchingLine_Num = length(SearchingLine_L); 47 | Matched_Location_Num = size(Qualified_Matched_Location1Rect,1); 48 | % SearchingLine_R = SearchingLine_L; 49 | 50 | SearchingLine_Matrix = repmat(SearchingLine_L,[Matched_Location_Num 1]); 51 | Matched_Location_L_Column_Matrix = repmat(Qualified_Matched_Location1Rect(:,2),[1 SearchingLine_Num]); 52 | Matched_Location_R_Column_Matrix = repmat(Qualified_Matched_Location2Rect(:,2),[1 SearchingLine_Num]); 53 | Distance_L_Matrix_ref = abs(Matched_Location_L_Column_Matrix - SearchingLine_Matrix); 54 | Distance_L_Matrix = Matched_Location_L_Column_Matrix - SearchingLine_Matrix; 55 | Distance_R_Matrix = Matched_Location_R_Column_Matrix - SearchingLine_Matrix; 56 | 57 | [~,Min_Dis_Num] = min(Distance_L_Matrix_ref); 58 | % [~,Sort_Dis_Num] = sort(Distance_L_Matrix_ref); 59 | Distance_L_Matrix_Min = zeros(1,SearchingLine_Num); 60 | Distance_R_Matrix_Min = zeros(1,SearchingLine_Num); 61 | for i = 1:SearchingLine_Num 62 | Distance_L_Matrix_Min(i) = Distance_L_Matrix(Min_Dis_Num(i),i); 63 | Distance_R_Matrix_Min(i) = Distance_R_Matrix(Min_Dis_Num(i),i); 64 | end 65 | %% 66 | % SearchingLine_R = SearchingLine_L; 67 | SearchingLine_R_Top = SearchingLine_L_Top + Interval; 68 | SearchingLine_R_Bottom = SearchingLine_L_Bottom - Interval; 69 | Lift = (Distance_L_Matrix_Min - Distance_R_Matrix_Min); 70 | LiftNegative = Lift; 71 | LiftPositive = Lift; 72 | LiftNegative(Lift > 0) = 0; 73 | LiftPositive(Lift < 0) = 0; 74 | SearchingLine_R_Bottom = SearchingLine_R_Bottom - LiftPositive; 75 | SearchingLine_R_Top = SearchingLine_R_Top - LiftNegative; 76 | 77 | Over_SearchingLine_R_Top = SearchingLine_R_Top > TopR; 78 | SearchingLine_R_Top(Over_SearchingLine_R_Top) = TopR; 79 | Over_SearchingLine_R_Bottom = SearchingLine_R_Bottom < BottomR; 80 | SearchingLine_R_Bottom(Over_SearchingLine_R_Bottom) = BottomR; 81 | %} 82 | 83 | SearchingLine_R_Bottom(end) = SearchingLine_R_Bottom(end) - 1; 84 | SearchingLine_L_Bottom(end) = SearchingLine_L_Bottom(end) - 1; 85 | SearchingLine_L_Top(1) = Top; 86 | SearchingLine_R_Top(1) = TopR; 87 | 88 | 89 | 90 | % for i = 1:SearchingLine_Num 91 | parfor (i = 1:SearchingLine_Num,4) 92 | % Curr_L_C = (1+2*ThresholdD)*i - ThresholdD; 93 | % Curr_L_T = Curr_L_C - ThresholdD -1; 94 | % Curr_L_B = Curr_L_C + ThresholdD; 95 | % 96 | % Curr_R_C = Curr_L_C; 97 | % Curr_R_T = Curr_R_C - 2*ThresholdD - 1; 98 | % Curr_R_B = Curr_R_C + 2*ThresholdD; 99 | 100 | Curr_L_idxB = (Mdl_Location1Rect_Column.X > SearchingLine_L_Bottom(i)) & (Mdl_Location1Rect_Column.X <= SearchingLine_L_Top(i)); 101 | Curr_L_idx = Allindex_L(Curr_L_idxB); 102 | 103 | Curr_R_idxB = (Mdl_Location2Rect_Column.X > SearchingLine_R_Bottom(i)) & (Mdl_Location2Rect_Column.X <= SearchingLine_R_Top(i)); 104 | Curr_R_idx = Allindex_R(Curr_R_idxB); 105 | 106 | if ~isempty(Curr_L_idx) 107 | Curr_features_L = features1(:,Curr_L_idx); 108 | Curr_features_R = features2(:,Curr_R_idx); 109 | [Curr_indexPairs_Temp, Curr_Scores] = vl_ubcmatch(Curr_features_L,Curr_features_R); 110 | if ~isempty(Curr_indexPairs_Temp) 111 | % if i==190 112 | % x = 1; 113 | % end 114 | Curr_indexPairs = [Curr_L_idx(Curr_indexPairs_Temp(1,:)) Curr_R_idx(Curr_indexPairs_Temp(2,:))]; 115 | Curr_RecordIndies = ones(size(Curr_indexPairs,1),1); 116 | Curr_RecordIndies = Curr_RecordIndies*i; 117 | indexPairsParAll = [indexPairsParAll;Curr_indexPairs]; 118 | ScoresParAll = [ScoresParAll Curr_Scores]; 119 | RecordIndies = [RecordIndies;Curr_RecordIndies]; 120 | 121 | %% For show 122 | % Left = min(Location1Rect(:,1)); 123 | % Right = max(Location1Rect(:,1)); 124 | % Curr_MatchedLocation1 = Location1Rect(Curr_indexPairs(:,1),:); 125 | % Curr_MatchedLocation2 = Location2Rect(Curr_indexPairs(:,2),:); 126 | % 127 | % figure, 128 | % line([Left;Right],[SearchingLine_L_Top(i);SearchingLine_L_Top(i)],'Color','r');hold on 129 | % line([Left;Right],[SearchingLine_L_Bottom(i);SearchingLine_L_Bottom(i)],'Color','k'); 130 | % 131 | % line([Left;Right],[SearchingLine_R_Top(i);SearchingLine_R_Top(i)],'Color','m'); 132 | % line([Left;Right],[SearchingLine_R_Bottom(i);SearchingLine_R_Bottom(i)],'Color','b'); 133 | % 134 | % plot(Location1Rect(Curr_L_idx,1),Location1Rect(Curr_L_idx,2),'r*'); 135 | % plot(Location2Rect(Curr_R_idx,1),Location2Rect(Curr_R_idx,2),'k*'); 136 | % 137 | % plot(Curr_MatchedLocation1(:,1),Curr_MatchedLocation1(:,2),'mo','MarkerSize',12); 138 | % plot(Curr_MatchedLocation2(:,1),Curr_MatchedLocation2(:,2),'bo','MarkerSize',12); 139 | % line([Curr_MatchedLocation1(:,1)';Curr_MatchedLocation2(:,1)'],[Curr_MatchedLocation1(:,2)';Curr_MatchedLocation2(:,2)'],'Color','g'); 140 | % x = 1; 141 | % RecordRef(i) = true; 142 | end 143 | end 144 | end 145 | %{ 146 | %% when i == 1 147 | Curr_L_C = (1+2*ThresholdD) - ThresholdD; 148 | Curr_L_T = Curr_L_C - ThresholdD - 1; 149 | Curr_L_B = Curr_L_C + ThresholdD; 150 | 151 | Curr_R_C = Curr_L_C; 152 | Curr_R_T = Curr_L_T; 153 | Curr_R_B = Curr_R_C + 2*ThresholdD; 154 | 155 | Curr_L_idxB = (Mdl_Location1Rect.X(:,2) <= Curr_L_B) & (Mdl_Location1Rect.X(:,2) >= Curr_L_T); 156 | Curr_L_idx = Allindex_L(Curr_L_idxB); 157 | 158 | Curr_R_idxB = (Mdl_Location2Rect.X(:,2) <= Curr_R_B) & (Mdl_Location2Rect.X(:,2) > Curr_R_T); 159 | Curr_R_idx = Allindex_R(Curr_R_idxB); 160 | 161 | if ~isempty(Curr_L_idx) 162 | Curr_features_L = features1(:,Curr_L_idx); 163 | Curr_features_R = features2(:,Curr_R_idx); 164 | [Curr_indexPairs_Temp, Curr_Scores] = vl_ubcmatch(Curr_features_L,Curr_features_R); 165 | if ~isempty(Curr_indexPairs_Temp) 166 | Curr_indexPairs = [Curr_L_idx(Curr_indexPairs_Temp(1,:)) Curr_R_idx(Curr_indexPairs_Temp(2,:))]; 167 | Curr_RecordIndies = ones(size(Curr_indexPairs,1),1); 168 | Curr_RecordIndies = Curr_RecordIndies*1; 169 | indexPairsParAll = [Curr_indexPairs;indexPairsParAll]; 170 | ScoresParAll = [Curr_Scores ScoresParAll]; 171 | RecordIndies = [Curr_RecordIndies;RecordIndies]; 172 | % RecordRef(1) = true; 173 | end 174 | end 175 | %% when i == Match_Num 176 | Curr_L_C = (1+2*ThresholdD)*Match_Num - ThresholdD; 177 | Curr_L_T = Curr_L_C - ThresholdD - 1; 178 | Curr_L_B = ColumnNum; 179 | 180 | Curr_R_C = Curr_L_C; 181 | Curr_R_T = Curr_R_C - 2*ThresholdD - 1; 182 | Curr_R_B = ColumnNum; 183 | 184 | Curr_L_idxB = (Mdl_Location1Rect.X(:,2) <= Curr_L_B) & (Mdl_Location1Rect.X(:,2) > Curr_L_T); 185 | Curr_L_idx = Allindex_L(Curr_L_idxB); 186 | 187 | Curr_R_idxB = (Mdl_Location2Rect.X(:,2) <= Curr_R_B) & (Mdl_Location2Rect.X(:,2) > Curr_R_T); 188 | Curr_R_idx = Allindex_R(Curr_R_idxB); 189 | 190 | if ~isempty(Curr_L_idx) 191 | Curr_features_L = features1(:,Curr_L_idx); 192 | Curr_features_R = features2(:,Curr_R_idx); 193 | [Curr_indexPairs_Temp, Curr_Scores] = vl_ubcmatch(Curr_features_L,Curr_features_R); 194 | if ~isempty(Curr_indexPairs_Temp) 195 | Curr_indexPairs = [Curr_L_idx(Curr_indexPairs_Temp(1,:)) Curr_R_idx(Curr_indexPairs_Temp(2,:))]; 196 | Curr_RecordIndies = ones(size(Curr_indexPairs,1),1); 197 | Curr_RecordIndies = Curr_RecordIndies*Match_Num; 198 | indexPairsParAll = [indexPairsParAll;Curr_indexPairs]; 199 | ScoresParAll = [ScoresParAll Curr_Scores]; 200 | RecordIndies = [RecordIndies;Curr_RecordIndies]; 201 | % RecordRef(Match_Num) = true; 202 | end 203 | end 204 | %} 205 | 206 | %{ 207 | k = uint32(1); 208 | RecordIndiesRef = RecordIndies; 209 | RecordIndiesNew = []; 210 | while ~isempty(RecordIndiesRef) 211 | RecordIndiesRef(1) 212 | end 213 | %% ParFeatureMatching_ParMatching_alpha2 214 | Curr_indexPairsNum = size(Curr_indexPairs,1); 215 | Curr_RecordIndies(1) = k; 216 | Curr_RecordIndies(2) = k + Curr_indexPairsNum - 1; 217 | RecordIndies = [RecordIndies;Curr_RecordIndies]; 218 | k = k + Curr_indexPairsNum; 219 | %} -------------------------------------------------------------------------------- /ParFeatureMatching_RemoveOutliers_alpha2_1.m: -------------------------------------------------------------------------------- 1 | function inliersPar = ParFeatureMatching_RemoveOutliers_alpha2_1(Location1,Location2,indexPairsPar,RecordIndies,method) 2 | 3 | %{ 4 | 2018/04/07 5 | ParFeatureMatching_Model_RemoveOutliers_alpha1 6 | 1. remove outliers by 4 methods 7 | 8 | 2018/04/12 9 | ParFeatureMatching_RemoveOutliers_alpha1 10 | 1. Add parfor 11 | 12 | method 1: LLTA 13 | method 2: LLTR 14 | method 3: LLTV 15 | method 4: SOCBV 16 | method 5: WGTM 17 | method 6: RANSAC 18 | method 7: GTM 19 | %} 20 | ParInNumber = (RecordIndies(:,2) - RecordIndies(:,1)) + 1; 21 | ThresholdNumber = 300; 22 | % RecordIndiesNum = size(RecordIndies,1); 23 | ParInWrong = (ParInNumber) < ThresholdNumber; 24 | % IfallWrong = false; 25 | % ParInRight = ~ParInWrong; 26 | % RecordIndiesNew = RecordIndies; 27 | %{ 28 | if any(ParInWrong) 29 | ParInWrongNumber = find(ParInWrong); 30 | for j = 1:length(ParInWrongNumber) 31 | Curr_Num = ParInWrongNumber(j); 32 | NextRight = find(ParInRight(Curr_Num:RecordIndiesNum),1); 33 | if ~isempty(NextRight) 34 | NextRight = NextRight + Curr_Num - 1; 35 | if RecordIndies(Curr_Num,1) < RecordIndiesNew(NextRight,1) 36 | RecordIndiesNew(NextRight,1) = RecordIndies(Curr_Num,1); 37 | end 38 | else 39 | NextRight = find(ParInRight(1:Curr_Num),1,'last'); 40 | if ~isempty(NextRight) 41 | % NextRight = Curr_Num - NextRight + 1; 42 | RecordIndiesNew(NextRight,2) = RecordIndies(Curr_Num,2); 43 | else 44 | %% all wrong 45 | RecordIndiesNew = [RecordIndies(1,1) RecordIndies(RecordIndiesNum,2)]; 46 | IfallWrong = true; 47 | break 48 | end 49 | end 50 | 51 | end 52 | if ~IfallWrong 53 | RecordIndiesNew(ParInWrong,:) = []; 54 | end 55 | end 56 | %} 57 | 58 | %% 59 | 60 | 61 | 62 | % RecordIndiesNew = RecordIndies; 63 | % ParInNumberNew = ParInNumber; 64 | if any(ParInWrong) 65 | % ParInWrongNumber = find(ParInWrong); 66 | while any(ParInWrong) 67 | 68 | Curr_Num = find(ParInWrong,1); 69 | Curr_Toltal_Num = ParInNumber(Curr_Num); 70 | CaseNum = false; 71 | if Curr_Num+1 < length(ParInNumber) 72 | for i = Curr_Num+1:length(ParInNumber) 73 | Curr_Toltal_Num = Curr_Toltal_Num + ParInNumber(i); 74 | if Curr_Toltal_Num >= ThresholdNumber 75 | Curr_Next = i; 76 | CaseNum = true; 77 | break 78 | end 79 | % if i == length(ParInNumber) 80 | % 81 | % end 82 | end 83 | end 84 | 85 | if CaseNum 86 | % RecordIndiesNew(Curr_Num,2) = RecordIndies(Curr_Next,2); 87 | % RecordIndiesNew(Curr_Num+1:Curr_Next,:) = []; 88 | % ParInNumberNew(Curr_Num) = Curr_Toltal_Num; 89 | % ParInNumberNew(Curr_Num+1:Curr_Next) = []; 90 | ParInWrong(Curr_Num:Curr_Next) = false; 91 | ParInWrong(Curr_Num+1:Curr_Next) = []; 92 | 93 | ParInNumber(Curr_Num) = Curr_Toltal_Num; 94 | RecordIndies(Curr_Num,2) = RecordIndies(Curr_Next,2); 95 | RecordIndies(Curr_Num+1:Curr_Next,:) = []; 96 | ParInNumber(Curr_Num+1:Curr_Next) = []; 97 | 98 | x = 1; 99 | else 100 | x =1; 101 | RecordIndies(Curr_Num-1,2) = RecordIndies(end,2); 102 | ParInNumber(Curr_Num-1) = ParInNumber(Curr_Num-1) + Curr_Toltal_Num; 103 | RecordIndies(Curr_Num:end,:) = []; 104 | ParInNumber(Curr_Num:end) = []; 105 | 106 | ParInWrong(Curr_Num:end) = false; 107 | ParInWrong(Curr_Num:end) = []; 108 | end 109 | x = 1; 110 | 111 | 112 | 113 | end 114 | 115 | 116 | 117 | end 118 | RecordIndiesNew = RecordIndies; 119 | ParInNumberNew = ParInNumber; 120 | 121 | 122 | 123 | %% 124 | %inliersPar = logical([]); 125 | TraverNum = size(RecordIndiesNew,1); 126 | inliersPar = false(TraverNum,1); 127 | ParNum = zeros(TraverNum,1); 128 | inliersParCell = cell(TraverNum,1); 129 | inliersParIndices = zeros(TraverNum,1); 130 | 131 | 132 | MatchedLocation = cell(TraverNum,1); 133 | 134 | for i = 1:TraverNum 135 | Curr_indexPairs = indexPairsPar(RecordIndiesNew(i,1):RecordIndiesNew(i,2),:); 136 | MatchedLocation{i,1} = [Location1(Curr_indexPairs(:,1),:) Location2(Curr_indexPairs(:,2),:)]; 137 | ParNum(i) = RecordIndiesNew(i,2)-RecordIndiesNew(i,1)+1; 138 | % MatchedLocation{i,2} = Location2(Curr_indexPairs(:,2),:); 139 | end 140 | % for i = 1:TraverNum 141 | parfor (i = 1:TraverNum,4) 142 | % Curr_indexPairs = indexPairsPar(RecordIndiesNew(i,1):RecordIndiesNew(i,2),:); 143 | % MatchedLocation1 = Location1(Curr_indexPairs(:,1),:); 144 | % MatchedLocation2 = Location2(Curr_indexPairs(:,2),:); 145 | 146 | % figure,plot(MatchedLocation1(:,1),MatchedLocation1(:,2),'r*');hold on 147 | % plot(MatchedLocation2(:,1),MatchedLocation2(:,2),'b+'); 148 | % line([MatchedLocation1(:,1)';MatchedLocation2(:,1)'],[MatchedLocation1(:,2)';MatchedLocation2(:,2)'],'Color','y'); 149 | % x = 1; 150 | 151 | inliers = Other_Matching_All_alpha3(MatchedLocation{i,1},method); 152 | 153 | % figure,plot(MatchedLocation1(inliers,1),MatchedLocation1(inliers,2),'r*');hold on 154 | % plot(MatchedLocation2(inliers,1),MatchedLocation2(inliers,2),'b+'); 155 | % line([MatchedLocation1(inliers,1)';MatchedLocation2(inliers,1)'],[MatchedLocation1(inliers,2)';MatchedLocation2(inliers,2)'],'Color','b'); 156 | 157 | % x = 1; 158 | Curr_inliersRecord = false(ParNum(i),1); 159 | Curr_inliersRecord(inliers) = true; 160 | inliersParCell{i} = Curr_inliersRecord; 161 | inliersParIndices(i) = i; 162 | end 163 | 164 | for j = 1:TraverNum 165 | Current_j = inliersParIndices(j); 166 | inliersPar(RecordIndiesNew(Current_j,1):RecordIndiesNew(Current_j,2)) = inliersParCell{Current_j}; 167 | end 168 | 169 | %{ 170 | for i = 1:TraverNum 171 | % parfor (i = 1:TraverNum,4) 172 | Curr_indexPairs = indexPairsPar(RecordIndiesNew(i,1):RecordIndiesNew(i,2),:); 173 | inliers = Other_Matching_All_alpha1(Location1,Location2,Curr_indexPairs,method); 174 | 175 | Curr_inliersRecord = false(RecordIndiesNew(i,2)-RecordIndiesNew(i,1)+1,1); 176 | Curr_inliersRecord(inliers) = true; 177 | 178 | inliersParCell{i} = Curr_inliersRecord; 179 | end 180 | for j = 1:TraverNum 181 | inliersPar(RecordIndiesNew(j,1):RecordIndiesNew(j,2)) = inliersParCell{j}; 182 | end 183 | %} 184 | % 185 | 186 | % for i = 1:TraverNum 187 | % % parfor (i = 1:TraverNum,4) 188 | % 189 | % Curr_indexPairs = indexPairsPar(RecordIndiesNew(i,1):RecordIndiesNew(i,2),:); 190 | % inliers = Other_Matching_All_alpha1(Location1,Location2,Curr_indexPairs,method); 191 | % 192 | % Curr_inliersRecord = false(RecordIndiesNew(i,2)-RecordIndiesNew(i,1)+1,1); 193 | % Curr_inliersRecord(inliers) = true; 194 | % inliersPar(RecordIndiesNew(i,1):RecordIndiesNew(i,2)) = Curr_inliersRecord; 195 | % end 196 | %} 197 | % if ~isempty(inliersPar) 198 | % inliersAll = false(size(Location1,1),1); 199 | % inliersAll(indexPairsPar(inliersPar,1)) = true; 200 | % end 201 | 202 | -------------------------------------------------------------------------------- /ParFeatureMatching_alpha7.m: -------------------------------------------------------------------------------- 1 | function [indexPairsPar,RecordIndiesNew,tform1,tform2,IndicesInitialRANSAC,indexPairsInitialRANSAC,inliersInitialRANSAC,GoodClassidx,SearchingRange,RealSearchingRange] =ParFeatureMatching_alpha7(features1,features2,validBlobs1,validBlobs2,I1,I2) 2 | %{ 3 | 2018/09/11 4 | ParFeatureMatching_alpha7 5 | 1. For getting numerous matching areas 6 | 7 | 2018/09/10 8 | ParFeatureMatching_alpha7_checkUniformAndSR 9 | 1. Check if the searching range program could be work in the real images. 10 | 2. Find good sampling with accordant transmation angle by k-means 11 | 12 | 2018/09/02 13 | ParFeatureMatching_alpha5_checkUniformAndSR 14 | 1. Check if the searching range program could be work in the real images. 15 | 16 | 17 | 2018/04/17 18 | ParFeatureMatching_alpha5 19 | 1. ParFeatureMatching_LimitInliersDifferSTD_alpha1 => 20 | ParFeatureMatching_LimitInliersDifferSTD_alpha2 21 | Dynamic P 22 | 23 | 2018/04/14 24 | ParFeatureMatching_alpha4 25 | 1. ParFeatureMatching_FindGoodEpipolar_alpha1 = > ParFeatureMatching_FindGoodEpipolar_alpha2 26 | 2. For uniform distribution Add block 27 | 28 | 29 | 2018/04/14 30 | ParFeatureMatching_alpha3_debug 31 | 1. For debuging thresholdD = 10 32 | 33 | 34 | 2018/04/08 35 | ParFeatureMatching_alpha2 36 | 1. ParMatching for real stereo images 37 | 2. Add limit of iteration like ParFeatureMatching_FindPar_alpha1 38 | 39 | 2018/04/12 40 | ParFeatureMatching_alpha3 41 | 1. Add ParFeatureMatching_LimitInliersDifferSTD_alpha1 42 | 2. ParFeatureMatching_ParMatching_alpha1 => ParFeatureMatching_ParMatching_alpha2 43 | Add i=1 and i = Match_Num 44 | 3. Update RecordIndies 45 | 46 | %} 47 | 48 | SamplingNum = 1000; 49 | features1Num = size(features1,2); 50 | %% 51 | 52 | 53 | Location1 = double(validBlobs1.Location); 54 | Location2 = double(validBlobs2.Location); 55 | RandomNum = 100; 56 | IdealMeanRatios = zeros(1,RandomNum); 57 | RealMeanRatios = zeros(1,RandomNum); 58 | IfGoods = zeros(1,RandomNum); 59 | % LengthRatios = zeros(1,RandomNum); 60 | % WidthRatios = zeros(1,RandomNum); 61 | IfGoodRatios = zeros(1,RandomNum); 62 | 63 | % WrongSampledLocation1 = cell(1,1); 64 | % WrongMatchedLocation1 = cell(1,1); 65 | % WrongNum = 1; 66 | 67 | 68 | IterationNum = 300; 69 | Curr_IterationNum = 1; 70 | QualifiedSampling = false; 71 | while ~QualifiedSampling && (Curr_IterationNum <= IterationNum) 72 | IndicesInitialRANSAC = randsample(features1Num, SamplingNum); 73 | % SampledLocation1 = Location1(IndicesInitialRANSAC,:); 74 | [indexPairsInitialRANSAC,inliersInitialRANSAC,IfUniform] = ParFeatureMatching_FindGoodEpipolar_checkUniform_alpha1(features1,features2,validBlobs1,validBlobs2,I2,IndicesInitialRANSAC); 75 | if IfUniform 76 | %% Here!!! 77 | Matched_Location1 = Location1(IndicesInitialRANSAC(indexPairsInitialRANSAC(inliersInitialRANSAC,1)),:); 78 | Matched_Location2 = Location2(indexPairsInitialRANSAC(inliersInitialRANSAC,2),:); 79 | x = 1; 80 | [GoodClassidx,tform1,tform2,QualifiedSampling,Qualified_Matched_Location1,Qualified_Matched_Location2,SearchingRange,RealSearchingRange,k,EpiLines1ab,EpiLines2ab] = ParFeatureMatching_FindGoodEmission_alpha2(Matched_Location1,Matched_Location2,size(I2),Location1); 81 | x = 1; 82 | end 83 | end 84 | 85 | %% 86 | Location1Rect = transformPointsForward(tform1, Location1); 87 | Location2Rect = transformPointsForward(tform2, Location2); 88 | 89 | Qualified_Matched_Location1Rect = transformPointsForward(tform1, Qualified_Matched_Location1); 90 | Qualified_Matched_Location2Rect = transformPointsForward(tform2, Qualified_Matched_Location2); 91 | 92 | % figure,hold on 93 | % plot(Qualified_Matched_Location1Rect(:,1),Qualified_Matched_Location1Rect(:,2),'r*');hold on 94 | % plot(Qualified_Matched_Location2Rect(:,1),Qualified_Matched_Location2Rect(:,2),'b*'); 95 | % line([Qualified_Matched_Location1Rect(:,1)';Qualified_Matched_Location2Rect(:,1)'],[Qualified_Matched_Location1Rect(:,2)';Qualified_Matched_Location2Rect(:,2)'],'Color','g'); 96 | 97 | % Diff = abs(Qualified_Matched_Location1Rect(:,2) - Qualified_Matched_Location2Rect(:,2)); 98 | % WrongIdx = Diff>=SearchingRange; 99 | % Matched_Location1Rect(WrongIdx,:) = []; 100 | % Matched_Location2Rect(WrongIdx,:) = []; 101 | % 102 | % figure,hold on 103 | % plot(Matched_Location1Rect(:,1),Matched_Location1Rect(:,2),'r*');hold on 104 | % plot(Matched_Location2Rect(:,1),Matched_Location2Rect(:,2),'b*'); 105 | % line([Matched_Location1Rect(:,1)';Matched_Location2Rect(:,1)'],[Matched_Location1Rect(:,2)';Matched_Location2Rect(:,2)'],'Color','g'); 106 | 107 | [indexPairsPar,~,RecordIndies] = ParFeatureMatching_ParMatching_alpha3(features1,features2,Location1Rect,Location2Rect,RealSearchingRange,I2,Qualified_Matched_Location1Rect,Qualified_Matched_Location2Rect); 108 | 109 | 110 | MatchedLocation1Temp = Location1(indexPairsPar(:,1),:); 111 | MatchedLocation2Temp = Location2(indexPairsPar(:,2),:); 112 | [indexPairsPar,RecordIndies] = SIFT_RemoveSameMatching_alpha1(MatchedLocation1Temp,MatchedLocation2Temp,RecordIndies,indexPairsPar); 113 | 114 | %% RecordIndiesNew 115 | % RecordIndiesNum = length(RecordIndies); 116 | ValidRecordRef = unique(RecordIndies); 117 | ValidRecordRefL = length(ValidRecordRef); 118 | RecordIndiesNew = zeros(ValidRecordRefL,2); 119 | 120 | %% j == 1 121 | RecordIndiesNew(1,1) = 1; 122 | RecordIndiesNew(1,2) = RecordIndiesNew(1,1) + find(RecordIndies(RecordIndiesNew(1,1):end) ~= ValidRecordRef(1),1) - 2; 123 | for j = 2:ValidRecordRefL-1 124 | RecordIndiesNew(j,1) = RecordIndiesNew(j-1,2) + 1; 125 | RecordIndiesNew(j,2) = RecordIndiesNew(j,1) + find(RecordIndies(RecordIndiesNew(j,1):end) ~= ValidRecordRef(j),1) - 2; 126 | end 127 | RecordIndiesNew(ValidRecordRefL,1) = RecordIndiesNew(ValidRecordRefL-1,2) + 1; 128 | RecordIndiesNew(ValidRecordRefL,2) = length(RecordIndies); 129 | %% 130 | 131 | -------------------------------------------------------------------------------- /RANSAC_Norm8Point.m: -------------------------------------------------------------------------------- 1 | function f = RANSAC_Norm8Point(Location1, Location2) 2 | % Normalize the points 3 | num = size(Location1, 2); 4 | [Location1, Trans1] = vision.internal.normalizePoints(Location1, 2, 'double'); 5 | [Location2, Trans2] = vision.internal.normalizePoints(Location2, 2, 'double'); 6 | 7 | % Compute the constraint matrix 8 | A = double(zeros(num, 9)); 9 | for idx = 1: num 10 | A(idx,:) = [... 11 | Location1(1,idx)*Location2(1,idx), Location1(2,idx)*Location2(1,idx), Location2(1,idx), ... 12 | Location1(1,idx)*Location2(2,idx), Location1(2,idx)*Location2(2,idx), Location2(2,idx), ... 13 | Location1(1,idx), Location1(2,idx), 1]; 14 | end 15 | 16 | % Find out the eigen-vector corresponding to the smallest eigen-value. 17 | [~, ~, vA] = svd(A, 0); 18 | f = reshape(vA(:, end), 3, 3)'; 19 | 20 | % Enforce rank-2 constraint 21 | [u, s, v] = svd(f); 22 | s(end) = 0; 23 | f = u * s * v'; 24 | 25 | % Transform the fundamental matrix back to its original scale. 26 | f = Trans2' * f * Trans1; 27 | 28 | % Normalize the fundamental matrix. 29 | f = f / norm(f); 30 | if f(end) < 0 31 | f = -f; 32 | end -------------------------------------------------------------------------------- /RANSAC_Norm8Point_alpha2.m: -------------------------------------------------------------------------------- 1 | function f = RANSAC_Norm8Point_alpha2(Location1, Location2) 2 | %{ 3 | 2018/04/11 4 | RANSAC_Norm8Point_alpha2 5 | 1. Add 6 | 7 | %} 8 | if size(Location1,1) > size(Location1,2) 9 | Location1 = Location1'; 10 | Location2 = Location2'; 11 | end 12 | 13 | if size(Location1,1) < 3 14 | Location1(3,:) = 1; 15 | Location1(3,:) = 1; 16 | end 17 | % Normalize the points 18 | num = size(Location1, 2); 19 | [Location1, Trans1] = vision.internal.normalizePoints(Location1, 2, 'double'); 20 | [Location2, Trans2] = vision.internal.normalizePoints(Location2, 2, 'double'); 21 | 22 | % Compute the constraint matrix 23 | A = double(zeros(num, 9)); 24 | for idx = 1: num 25 | A(idx,:) = [... 26 | Location1(1,idx)*Location2(1,idx), Location1(2,idx)*Location2(1,idx), Location2(1,idx), ... 27 | Location1(1,idx)*Location2(2,idx), Location1(2,idx)*Location2(2,idx), Location2(2,idx), ... 28 | Location1(1,idx), Location1(2,idx), 1]; 29 | end 30 | 31 | % Find out the eigen-vector corresponding to the smallest eigen-value. 32 | [~, ~, vA] = svd(A, 0); 33 | f = reshape(vA(:, end), 3, 3)'; 34 | 35 | % Enforce rank-2 constraint 36 | [u, s, v] = svd(f); 37 | s(end) = 0; 38 | f = u * s * v'; 39 | 40 | % Transform the fundamental matrix back to its original scale. 41 | f = Trans2' * f * Trans1; 42 | 43 | % Normalize the fundamental matrix. 44 | f = f / norm(f); 45 | if f(end) < 0 46 | f = -f; 47 | end -------------------------------------------------------------------------------- /RANSAC_alpha1.m: -------------------------------------------------------------------------------- 1 | function [Best_F, inliers] = RANSAC_alpha1(Location1, Location2, Trials_N, Threshold) 2 | 3 | if size(Location1,1) > size(Location1,2) 4 | Location1 = Location1'; 5 | Location2 = Location2'; 6 | end 7 | 8 | if size(Location1,1) < 3 9 | Location1(3,:) = 1; 10 | Location2(3,:) = 1; 11 | end 12 | 13 | Location_N = size(Location1,2); 14 | inliers = false(1, Location_N); 15 | Sample_N = 8; 16 | DistType = 'Algebraic';%'sampson''Algebraic' 17 | 18 | Best_F = []; 19 | %integerClass = 'int32'; 20 | % Confidence % For update MaxTrials_N 21 | if Location_N > Sample_N 22 | MaxTrials_N = Trials_N; 23 | CurTrials_N = int32(0); 24 | BestInliers_N = int32(0); 25 | % logOneMinusConf = log(1 - Confidence); % For update MaxTrials_N 26 | % oneOverNPts = double(1 / Location_N); % For update MaxTrials_N 27 | 28 | while CurTrials_N < MaxTrials_N 29 | Indices = randsample(Location_N, Sample_N); 30 | Current_F = RANSAC_Norm8Point(Location1(:,Indices), Location2(:,Indices)); 31 | Current_Distance = Calculate_Dist_alpha1(DistType, Location1, Location2, Current_F); 32 | 33 | %[curInliers, curNInliers] = findInliers(Current_Distance, Sample_N, Threshold); 34 | %% Find inliers 35 | CurIinliers = Current_Distance <= Threshold; 36 | CurInliers_N = int32(sum(CurIinliers)); 37 | 38 | if BestInliers_N < CurInliers_N 39 | BestInliers_N = CurInliers_N; 40 | inliers = CurIinliers; 41 | % Update the number of trials 42 | % maxNTrials = updateNumTrials(oneOverNPts, logOneMinusConf, ... 43 | % outputClass, integerClass, curNInliers, maxNTrials); 44 | end 45 | CurTrials_N = CurTrials_N + 1; 46 | end 47 | 48 | if BestInliers_N >= 8 49 | Best_F = RANSAC_Norm8Point(Location1(:, inliers), Location2(:, inliers)); 50 | else 51 | Best_F = []; 52 | end 53 | 54 | else 55 | % error 56 | end -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FastDenseFeatureMatchingModel 2 | The source codes for the paper: A Fast Dense feature-matching Model for Cross-Track Pushbroom Satellite Imagery 3 | 4 | main program: FD_all_alpha1.m 5 | please decompress the vlfeat-0.9.20.rar firstly 6 | -------------------------------------------------------------------------------- /SIFT_RemoveSameMatching_Sub_alpha1.m: -------------------------------------------------------------------------------- 1 | function ToBeRemovedNodesSet = SIFT_RemoveSameMatching_Sub_alpha1(MatchedLocation,Scores) 2 | %{ 3 | 2016/03/25 4 | SIFT_RemoveSameMatching_Sub_alpha1 5 | 1. For same matching caused by SIFT 6 | 2. The subprogram of SIFT_RemoveSameMatching_alpha1 7 | 8 | %} 9 | 10 | 11 | 12 | 13 | [MatchedLocationU,LocationU2O,LocationO2U] = unique(MatchedLocation,'rows','stable'); 14 | 15 | MatchedLocationL = size(MatchedLocation,1); 16 | RecordNum = false(MatchedLocationL,1); 17 | RecordNum(LocationU2O) = true; 18 | EqualMatchedLocationNodes = find(RecordNum == false); % Original Order 19 | 20 | EqualNumbers = LocationU2O( LocationO2U(EqualMatchedLocationNodes) ); % Original Order 21 | 22 | ToBeRemovedNodesSet = []; 23 | while ~isempty(EqualNumbers), 24 | SameEqualNumbers = EqualNumbers == EqualNumbers(1); 25 | ToBeRemovedNodes = [EqualNumbers(1);EqualMatchedLocationNodes( SameEqualNumbers )]; 26 | [~,RightNodesOrder] = min( Scores(ToBeRemovedNodes) ); 27 | ToBeRemovedNodes(RightNodesOrder) =[]; 28 | 29 | ToBeRemovedNodesSet = [ToBeRemovedNodesSet;ToBeRemovedNodes]; 30 | EqualNumbers( SameEqualNumbers ) = []; 31 | EqualMatchedLocationNodes( SameEqualNumbers ) = []; 32 | end -------------------------------------------------------------------------------- /SIFT_RemoveSameMatching_alpha1.m: -------------------------------------------------------------------------------- 1 | function [indexPairs,Scores] = SIFT_RemoveSameMatching_alpha1(MatchedLocation1,MatchedLocation2,Scores,indexPairs) 2 | %{ 3 | 2016/03/25 4 | SIFT_RemoveSameMatching_alpha1 5 | 1. For same matching caused by SIFT 6 | 7 | %} 8 | 9 | ToBeRemovedNodesSet1 = SIFT_RemoveSameMatching_Sub_alpha1(MatchedLocation1,Scores); 10 | 11 | 12 | indexPairs(ToBeRemovedNodesSet1,:) = []; 13 | MatchedLocation2(ToBeRemovedNodesSet1,:) = []; 14 | Scores(ToBeRemovedNodesSet1) = []; 15 | 16 | ToBeRemovedNodesSet2 = SIFT_RemoveSameMatching_Sub_alpha1(MatchedLocation2,Scores); 17 | indexPairs(ToBeRemovedNodesSet2,:) = []; 18 | Scores(ToBeRemovedNodesSet2) = []; -------------------------------------------------------------------------------- /Slope20180301_L.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/Slope20180301_L.jpg -------------------------------------------------------------------------------- /Slope20180301_R.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/Slope20180301_R.jpg -------------------------------------------------------------------------------- /Slope20180301_SIFTandOne2One.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/Slope20180301_SIFTandOne2One.mat -------------------------------------------------------------------------------- /vlfeat-0.9.20.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20.rar -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/encodeImage.m: -------------------------------------------------------------------------------- 1 | function descrs = encodeImage(encoder, im, varargin) 2 | % ENCODEIMAGE Apply an encoder to an image 3 | % DESCRS = ENCODEIMAGE(ENCODER, IM) applies the ENCODER 4 | % to image IM, returning a corresponding code vector PSI. 5 | % 6 | % IM can be an image, the path to an image, or a cell array of 7 | % the same, to operate on multiple images. 8 | % 9 | % ENCODEIMAGE(ENCODER, IM, CACHE) utilizes the specified CACHE 10 | % directory to store encodings for the given images. The cache 11 | % is used only if the images are specified as file names. 12 | % 13 | % See also: TRAINENCODER(). 14 | 15 | % Author: Andrea Vedaldi 16 | 17 | % Copyright (C) 2013 Andrea Vedaldi 18 | % All rights reserved. 19 | % 20 | % This file is part of the VLFeat library and is made available under 21 | % the terms of the BSD license (see the COPYING file). 22 | 23 | opts.cacheDir = [] ; 24 | opts.cacheChunkSize = 512 ; 25 | opts = vl_argparse(opts,varargin) ; 26 | 27 | if ~iscell(im), im = {im} ; end 28 | 29 | % break the computation into cached chunks 30 | startTime = tic ; 31 | descrs = cell(1, numel(im)) ; 32 | numChunks = ceil(numel(im) / opts.cacheChunkSize) ; 33 | 34 | for c = 1:numChunks 35 | n = min(opts.cacheChunkSize, numel(im) - (c-1)*opts.cacheChunkSize) ; 36 | chunkPath = fullfile(opts.cacheDir, sprintf('chunk-%03d.mat',c)) ; 37 | if ~isempty(opts.cacheDir) && exist(chunkPath) 38 | fprintf('%s: loading descriptors from %s\n', mfilename, chunkPath) ; 39 | load(chunkPath, 'data') ; 40 | else 41 | range = (c-1)*opts.cacheChunkSize + (1:n) ; 42 | fprintf('%s: processing a chunk of %d images (%3d of %3d, %5.1fs to go)\n', ... 43 | mfilename, numel(range), ... 44 | c, numChunks, toc(startTime) / (c - 1) * (numChunks - c + 1)) ; 45 | data = processChunk(encoder, im(range)) ; 46 | if ~isempty(opts.cacheDir) 47 | save(chunkPath, 'data') ; 48 | end 49 | end 50 | descrs{c} = data ; 51 | clear data ; 52 | end 53 | descrs = cat(2,descrs{:}) ; 54 | 55 | % -------------------------------------------------------------------- 56 | function psi = processChunk(encoder, im) 57 | % -------------------------------------------------------------------- 58 | psi = cell(1,numel(im)) ; 59 | if numel(im) > 1 & matlabpool('size') > 1 60 | parfor i = 1:numel(im) 61 | psi{i} = encodeOne(encoder, im{i}) ; 62 | end 63 | else 64 | % avoiding parfor makes debugging easier 65 | for i = 1:numel(im) 66 | psi{i} = encodeOne(encoder, im{i}) ; 67 | end 68 | end 69 | psi = cat(2, psi{:}) ; 70 | 71 | % -------------------------------------------------------------------- 72 | function psi = encodeOne(encoder, im) 73 | % -------------------------------------------------------------------- 74 | 75 | im = encoder.readImageFn(im) ; 76 | 77 | features = encoder.extractorFn(im) ; 78 | 79 | imageSize = size(im) ; 80 | psi = {} ; 81 | for i = 1:size(encoder.subdivisions,2) 82 | minx = encoder.subdivisions(1,i) * imageSize(2) ; 83 | miny = encoder.subdivisions(2,i) * imageSize(1) ; 84 | maxx = encoder.subdivisions(3,i) * imageSize(2) ; 85 | maxy = encoder.subdivisions(4,i) * imageSize(1) ; 86 | 87 | ok = ... 88 | minx <= features.frame(1,:) & features.frame(1,:) < maxx & ... 89 | miny <= features.frame(2,:) & features.frame(2,:) < maxy ; 90 | 91 | descrs = encoder.projection * bsxfun(@minus, ... 92 | features.descr(:,ok), ... 93 | encoder.projectionCenter) ; 94 | if encoder.renormalize 95 | descrs = bsxfun(@times, descrs, 1./max(1e-12, sqrt(sum(descrs.^2)))) ; 96 | end 97 | 98 | w = size(im,2) ; 99 | h = size(im,1) ; 100 | frames = features.frame(1:2,:) ; 101 | frames = bsxfun(@times, bsxfun(@minus, frames, [w;h]/2), 1./[w;h]) ; 102 | 103 | descrs = extendDescriptorsWithGeometry(encoder.geometricExtension, frames, descrs) ; 104 | 105 | switch encoder.type 106 | case 'bovw' 107 | [words,distances] = vl_kdtreequery(encoder.kdtree, encoder.words, ... 108 | descrs, ... 109 | 'MaxComparisons', 100) ; 110 | z = vl_binsum(zeros(encoder.numWords,1), 1, double(words)) ; 111 | z = sqrt(z) ; 112 | 113 | case 'fv' 114 | z = vl_fisher(descrs, ... 115 | encoder.means, ... 116 | encoder.covariances, ... 117 | encoder.priors, ... 118 | 'Improved') ; 119 | case 'vlad' 120 | [words,distances] = vl_kdtreequery(encoder.kdtree, encoder.words, ... 121 | descrs, ... 122 | 'MaxComparisons', 15) ; 123 | assign = zeros(encoder.numWords, numel(words), 'single') ; 124 | assign(sub2ind(size(assign), double(words), 1:numel(words))) = 1 ; 125 | z = vl_vlad(descrs, ... 126 | encoder.words, ... 127 | assign, ... 128 | 'SquareRoot', ... 129 | 'NormalizeComponents') ; 130 | end 131 | z = z / max(sqrt(sum(z.^2)), 1e-12) ; 132 | psi{i} = z(:) ; 133 | end 134 | psi = cat(1, psi{:}) ; 135 | 136 | % -------------------------------------------------------------------- 137 | function psi = getFromCache(name, cache) 138 | % -------------------------------------------------------------------- 139 | [drop, name] = fileparts(name) ; 140 | cachePath = fullfile(cache, [name '.mat']) ; 141 | if exist(cachePath, 'file') 142 | data = load(cachePath) ; 143 | psi = data.psi ; 144 | else 145 | psi = [] ; 146 | end 147 | 148 | % -------------------------------------------------------------------- 149 | function storeToCache(name, cache, psi) 150 | % -------------------------------------------------------------------- 151 | [drop, name] = fileparts(name) ; 152 | cachePath = fullfile(cache, [name '.mat']) ; 153 | vl_xmkdir(cache) ; 154 | data.psi = psi ; 155 | save(cachePath, '-STRUCT', 'data') ; 156 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/experiments.m: -------------------------------------------------------------------------------- 1 | function experiments() 2 | % EXPERIMENTS Run image classification experiments 3 | % The experimens download a number of benchmark datasets in the 4 | % 'data/' subfolder. Make sure that there are several GBs of 5 | % space available. 6 | % 7 | % By default, experiments run with a lite option turned on. This 8 | % quickly runs all of them on tiny subsets of the actual data. 9 | % This is used only for testing; to run the actual experiments, 10 | % set the lite variable to false. 11 | % 12 | % Running all the experiments is a slow process. Using parallel 13 | % MATLAB and several cores/machiens is suggested. 14 | 15 | % Author: Andrea Vedaldi 16 | 17 | % Copyright (C) 2013 Andrea Vedaldi 18 | % All rights reserved. 19 | % 20 | % This file is part of the VLFeat library and is made available under 21 | % the terms of the BSD license (see the COPYING file). 22 | 23 | lite = true ; 24 | clear ex ; 25 | 26 | ex(1).prefix = 'fv-aug' ; 27 | ex(1).trainOpts = {'C', 10} ; 28 | ex(1).datasets = {'fmd', 'scene67'} ; 29 | ex(1).seed = 1 ; 30 | ex(1).opts = {... 31 | 'type', 'fv', ... 32 | 'numWords', 256, ... 33 | 'layouts', {'1x1'}, ... 34 | 'geometricExtension', 'xy', ... 35 | 'numPcaDimensions', 80, ... 36 | 'extractorFn', @(x) getDenseSIFT(x, ... 37 | 'step', 4, ... 38 | 'scales', 2.^(1:-.5:-3))}; 39 | 40 | ex(2) = ex(1) ; 41 | ex(2).datasets = {'caltech101'} ; 42 | ex(2).opts{end} = @(x) getDenseSIFT(x, ... 43 | 'step', 4, ... 44 | 'scales', 2.^(0:-.5:-3)) ; 45 | 46 | ex(3) = ex(1) ; 47 | ex(3).datasets = {'voc07'} ; 48 | ex(3).C = 1 ; 49 | 50 | ex(4) = ex(1) ; 51 | ex(4).prefix = 'vlad-aug' ; 52 | ex(4).opts = {... 53 | 'type', 'vlad', ... 54 | 'numWords', 256, ... 55 | 'layouts', {'1x1'}, ... 56 | 'geometricExtension', 'xy', ... 57 | 'numPcaDimensions', 100, ... 58 | 'whitening', true, ... 59 | 'whiteningRegul', 0.01, ... 60 | 'renormalize', true, ... 61 | 'extractorFn', @(x) getDenseSIFT(x, ... 62 | 'step', 4, ... 63 | 'scales', 2.^(1:-.5:-3))}; 64 | ex(5) = ex(4) ; 65 | ex(5).datasets = {'caltech101'} ; 66 | ex(5).opts{end} = ex(2).opts{end} ; 67 | 68 | ex(6) = ex(4) ; 69 | ex(6).datasets = {'voc07'} ; 70 | ex(6).C = 1 ; 71 | 72 | ex(7) = ex(1) ; 73 | ex(7).prefix = 'bovw-aug' ; 74 | ex(7).opts = {... 75 | 'type', 'bovw', ... 76 | 'numWords', 4096, ... 77 | 'layouts', {'1x1'}, ... 78 | 'geometricExtension', 'xy', ... 79 | 'numPcaDimensions', 100, ... 80 | 'whitening', true, ... 81 | 'whiteningRegul', 0.01, ... 82 | 'renormalize', true, ... 83 | 'extractorFn', @(x) getDenseSIFT(x, ... 84 | 'step', 4, ... 85 | 'scales', 2.^(1:-.5:-3))}; 86 | 87 | ex(8) = ex(7) ; 88 | ex(8).datasets = {'caltech101'} ; 89 | ex(8).opts{end} = ex(2).opts{end} ; 90 | 91 | ex(9) = ex(7) ; 92 | ex(9).datasets = {'voc07'} ; 93 | ex(9).C = 1 ; 94 | 95 | ex(10).prefix = 'fv' ; 96 | ex(10).trainOpts = {'C', 10} ; 97 | ex(10).datasets = {'fmd', 'scene67'} ; 98 | ex(10).seed = 1 ; 99 | ex(10).opts = {... 100 | 'type', 'fv', ... 101 | 'numWords', 256, ... 102 | 'layouts', {'1x1'}, ... 103 | 'geometricExtension', 'none', ... 104 | 'numPcaDimensions', 80, ... 105 | 'extractorFn', @(x) getDenseSIFT(x, ... 106 | 'step', 4, ... 107 | 'scales', 2.^(1:-.5:-3))}; 108 | 109 | ex(11) = ex(10) ; 110 | ex(11).datasets = {'caltech101'} ; 111 | ex(11).opts{end} = @(x) getDenseSIFT(x, ... 112 | 'step', 4, ... 113 | 'scales', 2.^(0:-.5:-3)) ; 114 | 115 | ex(12) = ex(10) ; 116 | ex(12).datasets = {'voc07'} ; 117 | ex(12).C = 1 ; 118 | 119 | 120 | ex(13).prefix = 'fv-sp' ; 121 | ex(13).trainOpts = {'C', 10} ; 122 | ex(13).datasets = {'fmd', 'scene67'} ; 123 | ex(13).seed = 1 ; 124 | ex(13).opts = {... 125 | 'type', 'fv', ... 126 | 'numWords', 256, ... 127 | 'layouts', {'1x1', '3x1'}, ... 128 | 'geometricExtension', 'none', ... 129 | 'numPcaDimensions', 80, ... 130 | 'extractorFn', @(x) getDenseSIFT(x, ... 131 | 'step', 4, ... 132 | 'scales', 2.^(1:-.5:-3))}; 133 | 134 | ex(14) = ex(13) ; 135 | ex(14).datasets = {'caltech101'} ; 136 | ex(14).opts{6} = {'1x1', '2x2'} ; 137 | ex(14).opts{end} = @(x) getDenseSIFT(x, ... 138 | 'step', 4, ... 139 | 'scales', 2.^(0:-.5:-3)) ; 140 | 141 | ex(15) = ex(13) ; 142 | ex(15).datasets = {'voc07'} ; 143 | ex(15).C = 1 ; 144 | 145 | 146 | if lite, tag = 'lite' ; 147 | else, tag = 'ex' ; end 148 | 149 | for i=1:numel(ex) 150 | for j=1:numel(ex(i).datasets) 151 | dataset = ex(i).datasets{j} ; 152 | if ~isfield(ex(i), 'trainOpts') || ~iscell(ex(i).trainOpts) 153 | ex(i).trainOpts = {} ; 154 | end 155 | traintest(... 156 | 'prefix', [tag '-' dataset '-' ex(i).prefix], ... 157 | 'seed', ex(i).seed, ... 158 | 'dataset', char(dataset), ... 159 | 'datasetDir', fullfile('data', dataset), ... 160 | 'lite', lite, ... 161 | ex(i).trainOpts{:}, ... 162 | 'encoderParams', ex(i).opts) ; 163 | end 164 | end 165 | 166 | % print HTML table 167 | pf('\n') ; 168 | ph('method', 'VOC07', 'Caltech 101', 'Scene 67', 'FMD') ; 169 | pr('FV', ... 170 | ge([tag '-voc07-fv'],'ap11'), ... 171 | ge([tag '-caltech101-fv']), ... 172 | ge([tag '-scene67-fv']), ... 173 | ge([tag '-fmd-fv'])) ; 174 | pr('FV + aug.', ... 175 | ge([tag '-voc07-fv-aug'],'ap11'), ... 176 | ge([tag '-caltech101-fv-aug']), ... 177 | ge([tag '-scene67-fv-aug']), ... 178 | ge([tag '-fmd-fv-aug'])) ; 179 | pr('FV + s.p.', ... 180 | ge([tag '-voc07-fv-sp'],'ap11'), ... 181 | ge([tag '-caltech101-fv-sp']), ... 182 | ge([tag '-scene67-fv-sp']), ... 183 | ge([tag '-fmd-fv-sp'])) ; 184 | %pr('VLAD', ... 185 | % ge([tag '-voc07-vlad'],'ap11'), ... 186 | % ge([tag '-caltech101-vlad']), ... 187 | % ge([tag '-scene67-vlad']), ... 188 | % ge([tag '-fmd-vlad'])) ; 189 | pr('VLAD + aug.', ... 190 | ge([tag '-voc07-vlad-aug'],'ap11'), ... 191 | ge([tag '-caltech101-vlad-aug']), ... 192 | ge([tag '-scene67-vlad-aug']), ... 193 | ge([tag '-fmd-vlad-aug'])) ; 194 | %pr('VLAD+sp', ... 195 | % ge([tag '-voc07-vlad-sp'],'ap11'), ... 196 | % ge([tag '-caltech101-vlad-sp']), ... 197 | % ge([tag '-scene67-vlad-sp']), ... 198 | % ge([tag '-fmd-vlad-sp'])) ; 199 | %pr('BOVW', ... 200 | % ge([tag '-voc07-bovw'],'ap11'), ... 201 | % ge([tag '-caltech101-bovw']), ... 202 | % ge([tag '-scene67-bovw']), ... 203 | % ge([tag '-fmd-bovw'])) ; 204 | pr('BOVW + aug.', ... 205 | ge([tag '-voc07-bovw-aug'],'ap11'), ... 206 | ge([tag '-caltech101-bovw-aug']), ... 207 | ge([tag '-scene67-bovw-aug']), ... 208 | ge([tag '-fmd-bovw-aug'])) ; 209 | %pr('BOVW+sp', ... 210 | % ge([tag '-voc07-bovw-sp'],'ap11'), ... 211 | % ge([tag '-caltech101-bovw-sp']), ... 212 | % ge([tag '-scene67-bovw-sp']), ... 213 | % ge([tag '-fmd-bovw-sp'])) ; 214 | pf('
\n'); 215 | 216 | function pf(str) 217 | fprintf(str) ; 218 | 219 | function str = ge(name, format) 220 | if nargin == 1, format = 'acc'; end 221 | data = load(fullfile('data', name, 'result.mat')) ; 222 | switch format 223 | case 'acc' 224 | str = sprintf('%.2f%% Acc', mean(diag(data.confusion)) * 100) ; 225 | case 'ap11' 226 | str = sprintf('%.2f%% mAP', mean(data.ap11) * 100) ; 227 | end 228 | 229 | function pr(varargin) 230 | fprintf('') ; 231 | for i=1:numel(varargin), fprintf('%s',varargin{i}) ; end 232 | fprintf('\n') ; 233 | 234 | function ph(varargin) 235 | fprintf('') ; 236 | for i=1:numel(varargin), fprintf('%s',varargin{i}) ; end 237 | fprintf('\n') ; 238 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/extendDescriptorsWithGeometry.m: -------------------------------------------------------------------------------- 1 | function descrs = extendDescriptorsWithGeometry(type, frames, descrs) 2 | % EXTENDDESCRIPTORSWITHGEOMETRY Extend feature descriptors with geometric components 3 | % DESCRS = EXTENDDESCRIPTORSWITHGEOMETRY(TYPE, FRAMES, DESCRS) 4 | % extends the descriptorss DESCRS with either nothing (TYPE = 5 | % 'none') or XY (TYPE = 'xy') from the FRAMES matrix. Note that, 6 | % for this to make sense, DESCRS and FRAMES should be properly normalized. 7 | 8 | % Author: Andrea Vedaldi 9 | 10 | % Copyright (C) 2013 Andrea Vedaldi 11 | % All rights reserved. 12 | % 13 | % This file is part of the VLFeat library and is made available under 14 | % the terms of the BSD license (see the COPYING file). 15 | 16 | 17 | switch lower(type) 18 | case 'none' 19 | case 'xy' 20 | z = frames(1:2,:) ; 21 | descrs = cat(1, descrs, z) ; 22 | otherwise 23 | error('Uknown geometric extension ''%s''.', type) ; 24 | end 25 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/getDenseSIFT.m: -------------------------------------------------------------------------------- 1 | function features = getDenseSIFT(im, varargin) 2 | % GETDENSESIFT Extract dense SIFT features 3 | % FEATURES = GETDENSESIFT(IM) extract dense SIFT features from 4 | % image IM. 5 | 6 | % Author: Andrea Vedaldi 7 | 8 | % Copyright (C) 2013 Andrea Vedaldi 9 | % All rights reserved. 10 | % 11 | % This file is part of the VLFeat library and is made available under 12 | % the terms of the BSD license (see the COPYING file). 13 | 14 | opts.scales = logspace(log10(1), log10(.25), 5) ; 15 | opts.contrastthreshold = 0 ; 16 | opts.step = 3 ; 17 | opts.rootSift = false ; 18 | opts.normalizeSift = true ; 19 | opts.binSize = 8 ; 20 | opts.geometry = [4 4 8] ; 21 | opts.sigma = 0 ; 22 | opts = vl_argparse(opts, varargin) ; 23 | 24 | dsiftOpts = {'norm', 'fast', 'floatdescriptors', ... 25 | 'step', opts.step, ... 26 | 'size', opts.binSize, ... 27 | 'geometry', opts.geometry} ; 28 | 29 | if size(im,3)>1, im = rgb2gray(im) ; end 30 | im = im2single(im) ; 31 | im = vl_imsmooth(im, opts.sigma) ; 32 | 33 | for si = 1:numel(opts.scales) 34 | im_ = imresize(im, opts.scales(si)) ; 35 | 36 | [frames{si}, descrs{si}] = vl_dsift(im_, dsiftOpts{:}) ; 37 | 38 | % root SIFT 39 | if opts.rootSift 40 | descrs{si} = sqrt(descrs{si}) ; 41 | end 42 | if opts.normalizeSift 43 | descrs{si} = snorm(descrs{si}) ; 44 | end 45 | 46 | % zero low contrast descriptors 47 | info.contrast{si} = frames{si}(3,:) ; 48 | kill = info.contrast{si} < opts.contrastthreshold ; 49 | descrs{si}(:,kill) = 0 ; 50 | 51 | % store frames 52 | frames{si}(1:2,:) = (frames{si}(1:2,:)-1) / opts.scales(si) + 1 ; 53 | frames{si}(3,:) = opts.binSize / opts.scales(si) / 3 ; 54 | end 55 | 56 | features.frame = cat(2, frames{:}) ; 57 | features.descr = cat(2, descrs{:}) ; 58 | features.contrast = cat(2, info.contrast{:}) ; 59 | 60 | function x = snorm(x) 61 | x = bsxfun(@times, x, 1./max(1e-5,sqrt(sum(x.^2,1)))) ; 62 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/readImage.m: -------------------------------------------------------------------------------- 1 | function [im, scale] = readImage(imagePath) 2 | % READIMAGE Read and standardize image 3 | % [IM, SCALE] = READIMAGE(IMAGEPATH) reads the specified image file, 4 | % converts the result to SINGLE class, and rescales the image 5 | % to have a maximum height of 480 pixels, returing the corresponding 6 | % scaling factor SCALE. 7 | % 8 | % READIMAGE(IM) where IM is already an image applies only the 9 | % standardization to it. 10 | 11 | % Author: Andrea Vedaldi 12 | 13 | % Copyright (C) 2013 Andrea Vedaldi 14 | % All rights reserved. 15 | % 16 | % This file is part of the VLFeat library and is made available under 17 | % the terms of the BSD license (see the COPYING file). 18 | 19 | if ischar(imagePath) 20 | try 21 | im = imread(imagePath) ; 22 | catch 23 | error('Corrupted image %s', imagePath) ; 24 | end 25 | else 26 | im = imagePath ; 27 | end 28 | 29 | im = im2single(im) ; 30 | 31 | scale = 1 ; 32 | if (size(im,1) > 480) 33 | scale = 480 / size(im,1) ; 34 | im = imresize(im, scale) ; 35 | im = min(max(im,0),1) ; 36 | end 37 | 38 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/setupCaltech256.m: -------------------------------------------------------------------------------- 1 | function imdb = setupCaltech256(datasetDir, varargin) 2 | % SETUPCALTECH256 Setup Caltech 256 and 101 datasets 3 | % This is similar to SETUPGENERIC(), with modifications to setup 4 | % Caltech-101 and Caltech-256 according to the standard 5 | % evaluation protocols. Specific options include: 6 | % 7 | % Variant:: 'caltech256' 8 | % Either 'caltech101' or 'caltech256'. 9 | % 10 | % AutoDownload:: true 11 | % Automatically download the data from the Internet if not 12 | % found at DATASETDIR. 13 | % 14 | % See:: SETUPGENERIC(). 15 | 16 | % Author: Andrea Vedaldi 17 | 18 | % Copyright (C) 2013 Andrea Vedaldi 19 | % All rights reserved. 20 | % 21 | % This file is part of the VLFeat library and is made available under 22 | % the terms of the BSD license (see the COPYING file). 23 | 24 | opts.lite = false ; 25 | opts.numTrain = 30 ; 26 | opts.numTest = 25 ; 27 | opts.seed = 1 ; 28 | opts.variant = 'caltech256' ; 29 | opts.autoDownload = true ; 30 | opts = vl_argparse(opts, varargin) ; 31 | 32 | % Download and unpack 33 | vl_xmkdir(datasetDir) ; 34 | switch opts.variant 35 | case 'caltech101' 36 | name = '101_ObjectCategories' ; 37 | checkClassName = 'airplanes' ; 38 | url = 'http://www.vision.caltech.edu/Image_Datasets/Caltech101/101_ObjectCategories.tar.gz' ; 39 | numClasses = 102 ; 40 | case 'caltech256' 41 | name = '256_ObjectCategories' ; 42 | checkClassName = '001.ak47' ; 43 | url = 'http://www.vision.caltech.edu/Image_Datasets/Caltech256/256_ObjectCategories.tar' ; 44 | numClasses = 257 ; 45 | otherwise 46 | error('Uknown dataset variant ''%s''.', opts.variant) ; 47 | end 48 | 49 | if exist(fullfile(datasetDir, checkClassName), 'file') 50 | % ok 51 | elseif exist(fullfile(datasetDir, name, checkClassName), 'file') 52 | datasetDir = fullfile(datasetDir, name) ; 53 | elseif opts.autoDownload 54 | fprintf('Downloading %s data to ''%s''. This will take a while.', opts.variant, datasetDir) ; 55 | untar(url, datasetDir) ; 56 | datasetDir = fullfile(datasetDir, name) ; 57 | else 58 | error('Could not find %s dataset in ''%s''', opts.variant, datasetDir) ; 59 | end 60 | 61 | % Read classes 62 | imdb = setupGeneric(datasetDir, ... 63 | 'numTrain', opts.numTrain, 'numVal', 0, 'numTest', opts.numTest, ... 64 | 'expectedNumClasses', numClasses, ... 65 | 'seed', opts.seed, 'lite', opts.lite) ; 66 | 67 | % In Caltech 256 background is not evaluated 68 | switch opts.variant 69 | case 'caltech101' 70 | case 'caltech256' 71 | imdb.images.set(imdb.images.class == 257) = 0 ; 72 | ok = find(imdb.images.set ~= 0) ; 73 | imdb.images.id = imdb.images.id(ok) ; 74 | imdb.images.name = imdb.images.name(ok) ; 75 | imdb.images.set = imdb.images.set(ok) ; 76 | imdb.images.class = imdb.images.class(ok) ; 77 | end 78 | 79 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/setupFMD.m: -------------------------------------------------------------------------------- 1 | function imdb = setupFMD(datasetDir, varargin) 2 | % SETUPSCENE67 Setup Flickr Material Dataset 3 | % This is similar to SETUPCALTECH101(), with modifications to setup 4 | % the Flickr Material Dataset accroding to the standard 5 | % evaluation protocols. 6 | % 7 | % See: SETUPCALTECH101(). 8 | 9 | % Author: Andrea Vedaldi 10 | 11 | % Copyright (C) 2013 Andrea Vedaldi 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | opts.lite = false ; 18 | opts.seed = 1 ; 19 | opts.numTrain = 50 ; 20 | opts.numTest = 50 ; 21 | opts.autoDownload = true ; 22 | opts = vl_argparse(opts, varargin) ; 23 | 24 | % Download and unpack 25 | vl_xmkdir(datasetDir) ; 26 | if exist(fullfile(datasetDir, 'image', 'wood')) 27 | % ok 28 | elseif opts.autoDownload 29 | url = 'http://people.csail.mit.edu/celiu/CVPR2010/FMD/FMD.zip' ; 30 | fprintf('Downloading FMD data to ''%s''. This will take a while.', datasetDir) ; 31 | unzip(url, datasetDir) ; 32 | else 33 | error('FMD not found in %s', datasetDir) ; 34 | end 35 | 36 | imdb = setupGeneric(fullfile(datasetDir,'image'), ... 37 | 'numTrain', opts.numTrain, 'numVal', 0, 'numTest', opts.numTest, ... 38 | 'expectedNumClasses', 10, ... 39 | 'seed', opts.seed, 'lite', opts.lite) ; 40 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/setupGeneric.m: -------------------------------------------------------------------------------- 1 | function imdb = setupGeneric(datasetDir, varargin) 2 | % SETUPGENERIC Setup a Caltech-101-like dataset 3 | % IMDB = SETUPGENERIC(DATASETDIR) initializes a IMDB structure 4 | % representing the dataset located at DATASETDIR. The dataset 5 | % is supposed to be organized similarly to Caltech-101, i.e. 6 | % to have one directory per image class, with a number of 7 | % image files in each directory. 8 | % 9 | % SETUPGENERIC(..., 'OPT', VAL, ...) accepts the following 10 | % options: 11 | % 12 | % Lite:: false 13 | % If set to TRUE, use at most 3 classes and at most 5 images 14 | % in each of TRAIN, VAL, and TEST. 15 | % 16 | % Seed:: 1 17 | % The random seed used to generate the partitions. 18 | % 19 | % NumTrain:: 50 20 | % Maximum number of training images per class. 21 | % 22 | % NumVal:: 0 23 | % Maximum number of validation images per class. 24 | % 25 | % NumTest:: 50 26 | % Maximum number of test images per class. 27 | % 28 | % ExpectedNumClasses:: [] 29 | % If set to a number, generate an error if the number 30 | % of classes found in DATASETDIR differs. This is only 31 | % used as a sanity check. 32 | % 33 | % IMDB is a structure with the following fields: 34 | % 35 | % IMDB.IMAGES:: 36 | % A structure of arrays representing the images in the 37 | % dataset. 38 | % 39 | % IMDB.IMAGES.ID:: 40 | % Vector of image numeric IDs. 41 | % 42 | % IMDB.IMAGES.NAME:: 43 | % Cell array with the image names. 44 | % 45 | % IMDB.IMAGES.SET:: 46 | % Vector of subset IDs for each image (train, val, test). 47 | % 48 | % IMDB.IMAGES.CLASS:: 49 | % Vector of class IDs for each image. 50 | % 51 | % IMDB.META:: 52 | % A substructure with meta information on the data. 53 | % 54 | % IMDB.META.CLASSES:: 55 | % Cell array of class names. 56 | % 57 | % IMDB.IMAGEDIR:: 58 | % Image directory. Join the image name to this directory to 59 | % access an image file. 60 | 61 | % Author: Andrea Vedaldi 62 | 63 | % Copyright (C) 2013 Andrea Vedaldi 64 | % All rights reserved. 65 | % 66 | % This file is part of the VLFeat library and is made available under 67 | % the terms of the BSD license (see the COPYING file). 68 | 69 | opts.lite = false ; 70 | opts.numTrain = 50 ; 71 | opts.numVal = 0 ; 72 | opts.numTest = 50 ; 73 | opts.seed = 1 ; 74 | opts.expectedNumClasses = [] ; 75 | opts = vl_argparse(opts, varargin) ; 76 | 77 | % Construct image database imdb structure 78 | imdb.meta.sets = {'train', 'val', 'test'} ; 79 | names = dir(datasetDir) ; 80 | names = {names([names.isdir]).name} ; 81 | names = setdiff(names, {'.', '..'}) ; 82 | imdb.meta.classes = names ; 83 | 84 | names = {} ; 85 | classes = {} ; 86 | for c = 1:numel(imdb.meta.classes) 87 | class = imdb.meta.classes{c} ; 88 | tmp = dir(fullfile(datasetDir, [class filesep '*.jpg'])) ; 89 | names{c} = strcat([class filesep], {tmp.name}) ; 90 | classes{c} = repmat(c, 1, numel(names{c})) ; 91 | end 92 | 93 | names = cat(2,names{:}) ; 94 | classes = cat(2,classes{:}) ; 95 | sets = zeros(1,numel(names)) ; 96 | ids = 1:numel(names) ; 97 | 98 | numClasses = numel(imdb.meta.classes) ; 99 | if ~isempty(opts.expectedNumClasses) && numClasses ~= opts.expectedNumClasses 100 | error('Expected %d classes in image database at %s.', opts.expectedNumClasses, datasetDir) ; 101 | end 102 | 103 | for c = 1:numClasses 104 | sel = find(classes == c) ; 105 | randn('state', opts.seed) ; 106 | rand('state', opts.seed) ; 107 | selTrain = vl_colsubset(sel, opts.numTrain) ; 108 | selVal = vl_colsubset(setdiff(sel, selTrain), opts.numVal) ; 109 | selTest = vl_colsubset(setdiff(sel, [selTrain selVal]), opts.numTest) ; 110 | sets(selTrain) = 1 ; 111 | sets(selVal) = 2 ; 112 | sets(selTest) = 3 ; 113 | end 114 | 115 | ok = find(sets ~= 0) ; 116 | imdb.images.id = ids(ok) ; 117 | imdb.images.name = names(ok) ; 118 | imdb.images.set = sets(ok) ; 119 | imdb.images.class = classes(ok) ; 120 | imdb.imageDir = datasetDir ; 121 | 122 | if opts.lite 123 | ok = {} ; 124 | for c = 1:3 125 | ok{end+1} = vl_colsubset(find(imdb.images.class == c & imdb.images.set == 1), 5) ; 126 | ok{end+1} = vl_colsubset(find(imdb.images.class == c & imdb.images.set == 2), 5) ; 127 | ok{end+1} = vl_colsubset(find(imdb.images.class == c & imdb.images.set == 3), 5) ; 128 | end 129 | ok = cat(2, ok{:}) ; 130 | imdb.meta.classes = imdb.meta.classes(1:3) ; 131 | imdb.images.id = imdb.images.id(ok) ; 132 | imdb.images.name = imdb.images.name(ok) ; 133 | imdb.images.set = imdb.images.set(ok) ; 134 | imdb.images.class = imdb.images.class(ok) ; 135 | end 136 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/setupScene67.m: -------------------------------------------------------------------------------- 1 | function imdb = setupScene67(datasetDir, varargin) 2 | % SETUPSCENE67 Setup MIT Scene 67 dataset 3 | % This is similar to SETUPGENERIC(), with modifications to setup 4 | % MIT Scene 67 according to the standard evaluation protocols. The 5 | % function supports only the LITE option. 6 | % 7 | % See: SETUPGENERIC(). 8 | 9 | % Author: Andrea Vedaldi 10 | 11 | % Copyright (C) 2013 Andrea Vedaldi 12 | % All rights reserved. 13 | % 14 | % This file is part of the VLFeat library and is made available under 15 | % the terms of the BSD license (see the COPYING file). 16 | 17 | opts.lite = false ; 18 | opts = vl_argparse(opts, varargin) ; 19 | 20 | % Download and unpack 21 | vl_xmkdir(datasetDir) ; 22 | if exist(fullfile(datasetDir, 'Images', 'airport_inside')) 23 | % ok 24 | else 25 | url = 'http://groups.csail.mit.edu/vision/LabelMe/NewImages/indoorCVPR_09.tar' ; 26 | trainImagesUrl = 'http://web.mit.edu/torralba/www/TrainImages.txt' ; 27 | testImagesUrl = 'http://web.mit.edu/torralba/www/TestImages.txt' ; 28 | fprintf('Downloading MIT Scene 67 data to ''%s''. This will take a while.', datasetDir) ; 29 | urlwrite(trainImagesUrl, fullfile(datasetDir, 'TrainImages.txt')) ; 30 | urlwrite(testImagesUrl, fullfile(datasetDir, 'TestImages.txt')) ; 31 | untar(url, datasetDir) ; 32 | end 33 | 34 | % Construct image database imdb structure 35 | imdb.meta.sets = {'train', 'val', 'test'} ; 36 | 37 | trainNames = textread(fullfile(datasetDir, 'TrainImages.txt'),'%s','delimiter','\n') ; 38 | testNames = textread(fullfile(datasetDir, 'TestImages.txt'),'%s','delimiter','\n') ; 39 | names = [trainNames; testNames]' ; 40 | sets = [ones(1,numel(trainNames)), 3*ones(1,numel(testNames))] ; 41 | imdb.images.id = 1:numel(names) ; 42 | [imdb.images.name,perm] = sort(names) ; 43 | imdb.images.set = sets(perm) ; 44 | 45 | a = regexp(imdb.images.name, '^([^/]+)*/.*$', 'tokens') ; 46 | for i = 1:numel(names) 47 | a{i} = a{i}{1}{1} ; 48 | end 49 | [imdb.meta.classes, ~, imdb.images.class] = unique(a) ; 50 | imdb.images.class = imdb.images.class(:)' ; 51 | imdb.imageDir = fullfile(datasetDir, 'Images') ; 52 | 53 | if opts.lite 54 | ok = {} ; 55 | for c = 1:3 56 | ok{end+1} = vl_colsubset(find(imdb.images.class == c & imdb.images.set == 1), 5) ; 57 | ok{end+1} = vl_colsubset(find(imdb.images.class == c & imdb.images.set == 3), 5) ; 58 | end 59 | ok = cat(2, ok{:}) ; 60 | imdb.meta.classes = imdb.meta.classes(1:3) ; 61 | imdb.images.id = imdb.images.id(ok) ; 62 | imdb.images.name = imdb.images.name(ok) ; 63 | imdb.images.set = imdb.images.set(ok) ; 64 | imdb.images.class = imdb.images.class(ok) ; 65 | end 66 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/setupVoc.m: -------------------------------------------------------------------------------- 1 | function imdb = setupVoc(datasetDir, varargin) 2 | % SETUPVOC Setup PASCAL VOC data 3 | % IMDB = SETUPVOC(DATASETDIR, 'EDITION', '2007') setups the 4 | % PASCAL VOC 2007 data. This is similar to SETUPGENERIC(), but adapted 5 | % to the peculiarities of this dataset. In particular, the 6 | % difficult image flag and the fact that multiple labels apply to 7 | % each image are supported. 8 | % 9 | % Note that only the PASCAL VOC 2007 data comes with test images 10 | % and labels. For the other editions, setting up the test images 11 | % cannot be automatized due to restrictions in the distribution. 12 | % 13 | % See also: SETUPGENERIC(). 14 | 15 | % Author: Andrea Vedaldi 16 | 17 | % Copyright (C) 2013 Andrea Vedaldi 18 | % All rights reserved. 19 | % 20 | % This file is part of the VLFeat library and is made available under 21 | % the terms of the BSD license (see the COPYING file). 22 | 23 | opts.edition = '2007' ; 24 | opts.autoDownload = true ; 25 | opts.lite = false ; 26 | opts = vl_argparse(opts, varargin) ; 27 | 28 | switch opts.edition 29 | case '2007' 30 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtrainval_06-Nov-2007.tar', ... 31 | 'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2007/VOCtest_06-Nov-2007.tar'} ; 32 | case '2008' 33 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2008/VOCtrainval_14-Jul-2008.tar'} ; 34 | case '2009' 35 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2009/VOCtrainval_11-May-2009.tar'} ; 36 | case '2010' 37 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2010/VOCtrainval_03-May-2010.tar'} ; 38 | case '2011' 39 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2011/VOCtrainval_25-May-2011.tar'} ; 40 | case '2012' 41 | urls = {'http://pascallin.ecs.soton.ac.uk/challenges/VOC/voc2012/VOCtrainval_11-May-2012.tar'} ; 42 | otherwise 43 | error('Unknown PASCAL VOC edition ''%s''.', opts.edition) ; 44 | end 45 | 46 | % Download and unpack 47 | vl_xmkdir(datasetDir) ; 48 | if exist(fullfile(datasetDir, ['VOC' opts.edition], 'Annotations')) 49 | % ok 50 | elseif exist(fullfile(datasetDir, 'VOCdevkit', ['VOC' opts.edition], 'Annotations')) 51 | % ok 52 | datasetDir = fullfile(datasetDir, 'VOCdevkit') ; 53 | elseif opts.autoDownload 54 | for i = 1:length(urls) 55 | fprintf('Downloading VOC data ''%s'' to ''%s''. This will take a while.', urls{i}, datasetDir) ; 56 | untar(urls{i}, datasetDir) ; 57 | end 58 | datasetDir = fullfile(datasetDir, 'VOCdevkit') ; 59 | else 60 | error('VOC data not found in %s', datasetDir) ; 61 | end 62 | 63 | imdb.images.id = [] ; 64 | imdb.images.set = uint8([]) ; 65 | imdb.images.name = {} ; 66 | imdb.images.size = zeros(2,0) ; 67 | imdb.meta.sets = {'train', 'val', 'test'} ; 68 | imdb.meta.classes = {'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', ... 69 | 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', ... 70 | 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'} ; 71 | imdb.imageDir = fullfile(datasetDir, ['VOC', opts.edition], 'JPEGImages') ; 72 | 73 | % Get the list of images 74 | map = containers.Map() ; 75 | j = 0 ; 76 | for si = 1:numel(imdb.meta.sets) 77 | setName = imdb.meta.sets{si} ; 78 | annoPath = fullfile(datasetDir, ['VOC' opts.edition], ... 79 | 'ImageSets', 'Main', ... 80 | [setName '.txt']) ; 81 | fprintf('%s: reading %s\n', mfilename, annoPath) ; 82 | [names,labels] = textread(annoPath, '%s %f') ; 83 | for i=1:length(names) 84 | j = j + 1 ; 85 | map(names{i}) = j ; 86 | imdb.images.id(j) = j ; 87 | imdb.images.set(j) = si ; 88 | imdb.images.name{j} = [names{i} '.jpg'] ; 89 | %info = imfinfo(fullfile(imdb.imageDir, imdb.images.name{j})) ; 90 | %imdb.images.size(:,j) = [info.Width ; info.Height] ; 91 | %fprintf('\radded %s', imdb.images.name{j}) ; 92 | end 93 | end 94 | 95 | % Get class labels 96 | for ci = 1:length(imdb.meta.classes) 97 | imdb.classes.imageIds{ci} = [] ; 98 | imdb.classes.difficult{ci} = false(0) ; 99 | end 100 | for si = 1:numel(imdb.meta.sets) 101 | for ci = 1:length(imdb.meta.classes) 102 | setName = imdb.meta.sets{si} ; 103 | className = imdb.meta.classes{ci} ; 104 | annoPath = fullfile(datasetDir, ['VOC' opts.edition], ... 105 | 'ImageSets', 'Main', ... 106 | [className '_' setName '.txt']) ; 107 | fprintf('%s: reading %s\n', mfilename, annoPath) ; 108 | [names,labels] = textread(annoPath, '%s %f') ; 109 | for i = 1:numel(names) 110 | j = map(names{i}) ; 111 | if labels(i) >= 0 112 | imdb.classes.imageIds{ci}(end+1) = j ; 113 | imdb.classes.difficult{ci}(end+1) = (labels(i) == 0) ; 114 | end 115 | end 116 | end 117 | end 118 | 119 | if opts.lite 120 | ok = {} ; 121 | for c = 1:3 122 | trainIds = intersect(imdb.images.id(imdb.images.set == 1), imdb.classes.imageIds{c}) ; 123 | testIds = intersect(imdb.images.id(imdb.images.set == 3), imdb.classes.imageIds{c}) ; 124 | 125 | ok{end+1} = vl_colsubset(find(ismember(imdb.images.id, trainIds)), 5) ; 126 | ok{end+1} = vl_colsubset(find(ismember(imdb.images.id, testIds)), 5) ; 127 | end 128 | ok = unique(cat(2, ok{:})) ; 129 | imdb.meta.classes = imdb.meta.classes(1:3) ; 130 | imdb.classes.imageIds = imdb.classes.imageIds(1:3) ; 131 | imdb.classes.difficult = imdb.classes.difficult(1:3) ; 132 | imdb.images.id = imdb.images.id(ok) ; 133 | imdb.images.name = imdb.images.name(ok) ; 134 | imdb.images.set = imdb.images.set(ok) ; 135 | for c = 1:3 136 | ok = ismember(imdb.classes.imageIds{c}, imdb.images.id) ; 137 | imdb.classes.imageIds{c} = imdb.classes.imageIds{c}(ok) ; 138 | imdb.classes.difficult{c} = imdb.classes.difficult{c}(ok) ; 139 | end 140 | end 141 | 142 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/trainEncoder.m: -------------------------------------------------------------------------------- 1 | function encoder = trainEncoder(images, varargin) 2 | % TRAINENCODER Train image encoder: BoVW, VLAD, FV 3 | % ENCODER = TRAINENCOER(IMAGES) trains a BoVW encoder from the 4 | % specified list of images IMAGES. 5 | % 6 | % TRAINENCODER(..., 'OPT', VAL, ...) accepts the following options: 7 | % 8 | % Type:: 'bovw' 9 | % Bag of visual words ('bovw'), VLAD ('vlad') or Fisher Vector 10 | % ('fv'). 11 | % 12 | % numPcaDimension:: +inf 13 | % Use PCA to reduce the descriptor dimensionality to this 14 | % dimension. Use +inf to deactivate PCA. 15 | % 16 | % Whitening:: false 17 | % Set to true to divide the principal components by the 18 | % corresponding standard deviation s_i. 19 | % 20 | % WhiteningRegul:: 0 21 | % When using whitening, divide by s_max * WhiteningRegul + s_i 22 | % instead of s_i alone. 23 | % 24 | % Renormalize:: false 25 | % If true, descriptors are L2 normalized after PCA or 26 | % whitening. 27 | % 28 | % 29 | % Subdivisions:: [] 30 | % A list of spatial subdivisions. Each column is a rectangle 31 | % [XMIN YMIN XMAX YMAX]. The spatial subdivisions are 32 | % 33 | % Layouts:: {'1x1'} 34 | % A list of strings representing regular spatial subdivisions 35 | % in the format MxN, where M is the number of vertical 36 | % subdivisions and N the number of horizontal ones. For 37 | % example {'1x1', 2x2'} uses 5 partitions: the whole image and 38 | % four quadrants. The subdivisions are appended to the ones 39 | % specified by the SUBDIVISIONS option. 40 | % 41 | % ReadImageFn:: @readImage 42 | % The function used to load an image. 43 | % 44 | % ExtractorFn:: @getDenseSIFT 45 | % The function used to extract the feature frames and 46 | % descriptors from an image. 47 | 48 | % Author: Andrea Vedaldi 49 | 50 | % Copyright (C) 2013 Andrea Vedaldi 51 | % All rights reserved. 52 | % 53 | % This file is part of the VLFeat library and is made available under 54 | % the terms of the BSD license (see the COPYING file). 55 | 56 | opts.type = 'bovw' ; 57 | opts.numWords = [] ; 58 | opts.seed = 1 ; 59 | opts.numPcaDimensions = +inf ; 60 | opts.whitening = false ; 61 | opts.whiteningRegul = 0 ; 62 | opts.numSamplesPerWord = [] ; 63 | opts.renormalize = false ; 64 | opts.layouts = {'1x1'} ; 65 | opts.geometricExtension = 'none' ; 66 | opts.subdivisions = zeros(4,0) ; 67 | opts.readImageFn = @readImage ; 68 | opts.extractorFn = @getDenseSIFT ; 69 | opts.lite = false ; 70 | opts = vl_argparse(opts, varargin) ; 71 | 72 | for i = 1:numel(opts.layouts) 73 | t = sscanf(opts.layouts{i},'%dx%d') ; 74 | m = t(1) ; 75 | n = t(2) ; 76 | [x,y] = meshgrid(... 77 | linspace(0,1,n+1), ... 78 | linspace(0,1,m+1)) ; 79 | x1 = x(1:end-1,1:end-1) ; 80 | y1 = y(1:end-1,1:end-1) ; 81 | x2 = x(2:end,2:end) ; 82 | y2 = y(2:end,2:end) ; 83 | opts.subdivisions = cat(2, opts.subdivisions, ... 84 | [x1(:)' ; 85 | y1(:)' ; 86 | x2(:)' ; 87 | y2(:)'] ) ; 88 | end 89 | 90 | if isempty(opts.numWords) 91 | switch opts.type 92 | case {'bovw'} 93 | opts.numWords = 1024 ; 94 | case {'fv'} 95 | opts.numWords = 64 ; 96 | opts.numPcaDimensions = 80 ; 97 | case {'vlad'} 98 | opts.numWords = 64 ; 99 | opts.numPcaDimensions = 100 ; 100 | opts.whitening = true ; 101 | opts.whiteninRegul = 0.01 ; 102 | otherwise 103 | assert(false) ; 104 | end 105 | end 106 | 107 | if isempty(opts.numSamplesPerWord) 108 | switch opts.type 109 | case {'bovw'} 110 | opts.numSamplesPerWord = 200 ; 111 | case {'vlad','fv'} 112 | opts.numSamplesPerWord = 1000 ; 113 | otherwise 114 | assert(false) ; 115 | end 116 | if opts.lite 117 | opts.numSamplesPerWord = 10 ; 118 | end 119 | end 120 | 121 | disp(opts) ; 122 | 123 | encoder.type = opts.type ; 124 | encoder.subdivisions = opts.subdivisions ; 125 | encoder.readImageFn = opts.readImageFn ; 126 | encoder.extractorFn = opts.extractorFn ; 127 | encoder.numWords = opts.numWords ; 128 | encoder.renormalize = opts.renormalize ; 129 | encoder.geometricExtension = opts.geometricExtension ; 130 | 131 | %% Step 0: obtain sample image descriptors 132 | numImages = numel(images) ; 133 | numDescrsPerImage = ceil(opts.numWords * opts.numSamplesPerWord / numImages) ; 134 | parfor i = 1:numImages 135 | fprintf('%s: reading: %s\n', mfilename, images{i}) ; 136 | im = encoder.readImageFn(images{i}) ; 137 | w = size(im,2) ; 138 | h = size(im,1) ; 139 | features = encoder.extractorFn(im) ; 140 | randn('state',0) ; 141 | rand('state',0) ; 142 | sel = vl_colsubset(1:size(features.descr,2), single(numDescrsPerImage)) ; 143 | descrs{i} = features.descr(:,sel) ; 144 | frames{i} = features.frame(:,sel) ; 145 | frames{i} = bsxfun(@times, bsxfun(@minus, frames{i}(1:2,:), [w;h]/2), 1./[w;h]) ; 146 | end 147 | descrs = cat(2, descrs{:}) ; 148 | frames = cat(2, frames{:}) ; 149 | 150 | %% Step 1 (optional): learn PCA projection 151 | if opts.numPcaDimensions < inf || opts.whitening 152 | fprintf('%s: learning PCA rotation/projection\n', mfilename) ; 153 | encoder.projectionCenter = mean(descrs,2) ; 154 | x = bsxfun(@minus, descrs, encoder.projectionCenter) ; 155 | X = x*x' / size(x,2) ; 156 | [V,D] = eig(X) ; 157 | d = diag(D) ; 158 | [d,perm] = sort(d,'descend') ; 159 | d = d + opts.whiteningRegul * max(d) ; 160 | m = min(opts.numPcaDimensions, size(descrs,1)) ; 161 | V = V(:,perm) ; 162 | if opts.whitening 163 | encoder.projection = diag(1./sqrt(d(1:m))) * V(:,1:m)' ; 164 | else 165 | encoder.projection = V(:,1:m)' ; 166 | end 167 | clear X V D d ; 168 | else 169 | encoder.projection = 1 ; 170 | encoder.projectionCenter = 0 ; 171 | end 172 | descrs = encoder.projection * bsxfun(@minus, descrs, encoder.projectionCenter) ; 173 | if encoder.renormalize 174 | descrs = bsxfun(@times, descrs, 1./max(1e-12, sqrt(sum(descrs.^2)))) ; 175 | end 176 | 177 | 178 | %% Step 2 (optional): geometrically augment the features 179 | 180 | descrs = extendDescriptorsWithGeometry(opts.geometricExtension, frames, descrs) ; 181 | 182 | %% Step 3: learn a VQ or GMM vocabulary 183 | dimension = size(descrs,1) ; 184 | numDescriptors = size(descrs,2) ; 185 | 186 | switch encoder.type 187 | case {'bovw', 'vlad'} 188 | vl_twister('state', opts.seed) ; 189 | encoder.words = vl_kmeans(descrs, opts.numWords, 'verbose', 'algorithm', 'elkan') ; 190 | encoder.kdtree = vl_kdtreebuild(encoder.words, 'numTrees', 2) ; 191 | 192 | case {'fv'} ; 193 | vl_twister('state', opts.seed) ; 194 | if 1 195 | v = var(descrs')' ; 196 | [encoder.means, encoder.covariances, encoder.priors] = ... 197 | vl_gmm(descrs, opts.numWords, 'verbose', ... 198 | 'Initialization', 'kmeans', ... 199 | 'CovarianceBound', double(max(v)*0.0001), ... 200 | 'NumRepetitions', 1) ; 201 | else 202 | addpath lib/yael/matlab 203 | [a,b,c] = ... 204 | yael_gmm(descrs, opts.numWords, 'verbose', 2) ; 205 | encoder.priors = single(a) ; 206 | encoder.means = single(b) ; 207 | encoder.covariances = single(c) ; 208 | end 209 | end 210 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/recognition/traintest.m: -------------------------------------------------------------------------------- 1 | function recognition_demo(varargin) 2 | % RECOGNITION_DEMO Demonstrates using VLFeat for image classification 3 | 4 | if ~exist('vl_version') 5 | run(fullfile(fileparts(which(mfilename)), ... 6 | '..', '..', 'toolbox', 'vl_setup.m')) ; 7 | end 8 | 9 | opts.dataset = 'caltech101' ; 10 | opts.prefix = 'bovw' ; 11 | opts.encoderParams = {'type', 'bovw'} ; 12 | opts.seed = 1 ; 13 | opts.lite = true ; 14 | opts.C = 1 ; 15 | opts.kernel = 'linear' ; 16 | opts.dataDir = 'data'; 17 | for pass = 1:2 18 | opts.datasetDir = fullfile(opts.dataDir, opts.dataset) ; 19 | opts.resultDir = fullfile(opts.dataDir, opts.prefix) ; 20 | opts.imdbPath = fullfile(opts.resultDir, 'imdb.mat') ; 21 | opts.encoderPath = fullfile(opts.resultDir, 'encoder.mat') ; 22 | opts.modelPath = fullfile(opts.resultDir, 'model.mat') ; 23 | opts.diaryPath = fullfile(opts.resultDir, 'diary.txt') ; 24 | opts.cacheDir = fullfile(opts.resultDir, 'cache') ; 25 | opts = vl_argparse(opts,varargin) ; 26 | end 27 | 28 | % do not do anything if the result data already exist 29 | if exist(fullfile(opts.resultDir,'result.mat')), 30 | load(fullfile(opts.resultDir,'result.mat'), 'ap', 'confusion') ; 31 | fprintf('%35s mAP = %04.1f, mean acc = %04.1f\n', opts.prefix, ... 32 | 100*mean(ap), 100*mean(diag(confusion))) ; 33 | return ; 34 | end 35 | 36 | vl_xmkdir(opts.cacheDir) ; 37 | diary(opts.diaryPath) ; diary on ; 38 | disp('options:' ); disp(opts) ; 39 | 40 | % -------------------------------------------------------------------- 41 | % Get image database 42 | % -------------------------------------------------------------------- 43 | 44 | if exist(opts.imdbPath) 45 | imdb = load(opts.imdbPath); 46 | else 47 | switch opts.dataset 48 | case 'scene67', imdb = setupScene67(opts.datasetDir, 'lite', opts.lite) ; 49 | case 'caltech101', imdb = setupCaltech256(opts.datasetDir, 'lite', opts.lite, ... 50 | 'variant', 'caltech101', 'seed', opts.seed) ; 51 | case 'caltech256', imdb = setupCaltech256(opts.datasetDir, 'lite', opts.lite) ; 52 | case 'voc07', imdb = setupVoc(opts.datasetDir, 'lite', opts.lite, 'edition', '2007') ; 53 | case 'fmd', imdb = setupFMD(opts.datasetDir, 'lite', opts.lite) ; 54 | otherwise, error('Unknown dataset type.') ; 55 | end 56 | save(opts.imdbPath, '-struct', 'imdb') ; 57 | end 58 | 59 | % -------------------------------------------------------------------- 60 | % Train encoder and encode images 61 | % -------------------------------------------------------------------- 62 | 63 | if exist(opts.encoderPath) 64 | encoder = load(opts.encoderPath) ; 65 | else 66 | numTrain = 5000 ; 67 | if opts.lite, numTrain = 10 ; end 68 | train = vl_colsubset(find(imdb.images.set <= 2), numTrain, 'uniform') ; 69 | encoder = trainEncoder(fullfile(imdb.imageDir,imdb.images.name(train)), ... 70 | opts.encoderParams{:}, ... 71 | 'lite', opts.lite) ; 72 | save(opts.encoderPath, '-struct', 'encoder') ; 73 | diary off ; 74 | diary on ; 75 | end 76 | 77 | descrs = encodeImage(encoder, fullfile(imdb.imageDir, imdb.images.name), ... 78 | 'cacheDir', opts.cacheDir) ; 79 | diary off ; 80 | diary on ; 81 | 82 | % -------------------------------------------------------------------- 83 | % Train and evaluate models 84 | % -------------------------------------------------------------------- 85 | 86 | if isfield(imdb.images, 'class') 87 | classRange = unique(imdb.images.class) ; 88 | else 89 | classRange = 1:numel(imdb.classes.imageIds) ; 90 | end 91 | numClasses = numel(classRange) ; 92 | 93 | % apply kernel maps 94 | switch opts.kernel 95 | case 'linear' 96 | case 'hell' 97 | descrs = sign(descrs) .* sqrt(abs(descrs)) ; 98 | case 'chi2' 99 | descrs = vl_homkermap(descrs,1,'kchi2') ; 100 | otherwise 101 | assert(false) ; 102 | end 103 | descrs = bsxfun(@times, descrs, 1./sqrt(sum(descrs.^2))) ; 104 | 105 | % train and test 106 | train = find(imdb.images.set <= 2) ; 107 | test = find(imdb.images.set == 3) ; 108 | lambda = 1 / (opts.C*numel(train)) ; 109 | par = {'Solver', 'sdca', 'Verbose', ... 110 | 'BiasMultiplier', 1, ... 111 | 'Epsilon', 0.001, ... 112 | 'MaxNumIterations', 100 * numel(train)} ; 113 | 114 | scores = cell(1, numel(classRange)) ; 115 | ap = zeros(1, numel(classRange)) ; 116 | ap11 = zeros(1, numel(classRange)) ; 117 | w = cell(1, numel(classRange)) ; 118 | b = cell(1, numel(classRange)) ; 119 | for c = 1:numel(classRange) 120 | if isfield(imdb.images, 'class') 121 | y = 2 * (imdb.images.class == classRange(c)) - 1 ; 122 | else 123 | y = - ones(1, numel(imdb.images.id)) ; 124 | [~,loc] = ismember(imdb.classes.imageIds{classRange(c)}, imdb.images.id) ; 125 | y(loc) = 1 - imdb.classes.difficult{classRange(c)} ; 126 | end 127 | if all(y <= 0), continue ; end 128 | 129 | [w{c},b{c}] = vl_svmtrain(descrs(:,train), y(train), lambda, par{:}) ; 130 | scores{c} = w{c}' * descrs + b{c} ; 131 | 132 | [~,~,info] = vl_pr(y(test), scores{c}(test)) ; 133 | ap(c) = info.ap ; 134 | ap11(c) = info.ap_interp_11 ; 135 | fprintf('class %s AP %.2f; AP 11 %.2f\n', imdb.meta.classes{classRange(c)}, ... 136 | ap(c) * 100, ap11(c)*100) ; 137 | end 138 | scores = cat(1,scores{:}) ; 139 | 140 | diary off ; 141 | diary on ; 142 | 143 | % confusion matrix (can be computed only if each image has only one label) 144 | if isfield(imdb.images, 'class') 145 | [~,preds] = max(scores, [], 1) ; 146 | confusion = zeros(numClasses) ; 147 | for c = 1:numClasses 148 | sel = find(imdb.images.class == classRange(c) & imdb.images.set == 3) ; 149 | tmp = accumarray(preds(sel)', 1, [numClasses 1]) ; 150 | tmp = tmp / max(sum(tmp),1e-10) ; 151 | confusion(c,:) = tmp(:)' ; 152 | end 153 | else 154 | confusion = NaN ; 155 | end 156 | 157 | % save results 158 | save(opts.modelPath, 'w', 'b') ; 159 | save(fullfile(opts.resultDir,'result.mat'), ... 160 | 'scores', 'ap', 'ap11', 'confusion', 'classRange', 'opts') ; 161 | 162 | % figures 163 | meanAccuracy = sprintf('mean accuracy: %f\n', mean(diag(confusion))); 164 | mAP = sprintf('mAP: %.2f %%; mAP 11: %.2f', mean(ap) * 100, mean(ap11) * 100) ; 165 | 166 | figure(1) ; clf ; 167 | imagesc(confusion) ; axis square ; 168 | title([opts.prefix ' - ' meanAccuracy]) ; 169 | vl_printsize(1) ; 170 | print('-dpdf', fullfile(opts.resultDir, 'result-confusion.pdf')) ; 171 | print('-djpeg', fullfile(opts.resultDir, 'result-confusion.jpg')) ; 172 | 173 | figure(2) ; clf ; bar(ap * 100) ; 174 | title([opts.prefix ' - ' mAP]) ; 175 | ylabel('AP %%') ; xlabel('class') ; 176 | grid on ; 177 | vl_printsize(1) ; 178 | ylim([0 100]) ; 179 | print('-dpdf', fullfile(opts.resultDir,'result-ap.pdf')) ; 180 | 181 | disp(meanAccuracy) ; 182 | disp(mAP) ; 183 | diary off ; 184 | 185 | end 186 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/apps/sift_mosaic.m: -------------------------------------------------------------------------------- 1 | function mosaic = sift_mosaic(im1, im2) 2 | % SIFT_MOSAIC Demonstrates matching two images using SIFT and RANSAC 3 | % 4 | % SIFT_MOSAIC demonstrates matching two images based on SIFT 5 | % features and RANSAC and computing their mosaic. 6 | % 7 | % SIFT_MOSAIC by itself runs the algorithm on two standard test 8 | % images. Use SIFT_MOSAIC(IM1,IM2) to compute the mosaic of two 9 | % custom images IM1 and IM2. 10 | 11 | % AUTORIGHTS 12 | 13 | if nargin == 0 14 | im1 = imread(fullfile(vl_root, 'data', 'river1.jpg')) ; 15 | im2 = imread(fullfile(vl_root, 'data', 'river2.jpg')) ; 16 | end 17 | 18 | % make single 19 | im1 = im2single(im1) ; 20 | im2 = im2single(im2) ; 21 | 22 | % make grayscale 23 | if size(im1,3) > 1, im1g = rgb2gray(im1) ; else im1g = im1 ; end 24 | if size(im2,3) > 1, im2g = rgb2gray(im2) ; else im2g = im2 ; end 25 | 26 | % -------------------------------------------------------------------- 27 | % SIFT matches 28 | % -------------------------------------------------------------------- 29 | 30 | [f1,d1] = vl_sift(im1g) ; 31 | [f2,d2] = vl_sift(im2g) ; 32 | 33 | [matches, scores] = vl_ubcmatch(d1,d2) ; 34 | 35 | numMatches = size(matches,2) ; 36 | 37 | X1 = f1(1:2,matches(1,:)) ; X1(3,:) = 1 ; 38 | X2 = f2(1:2,matches(2,:)) ; X2(3,:) = 1 ; 39 | 40 | % -------------------------------------------------------------------- 41 | % RANSAC with homography model 42 | % -------------------------------------------------------------------- 43 | 44 | clear H score ok ; 45 | for t = 1:100 46 | % estimate homograpyh 47 | subset = vl_colsubset(1:numMatches, 4) ; 48 | A = [] ; 49 | for i = subset 50 | A = cat(1, A, kron(X1(:,i)', vl_hat(X2(:,i)))) ; 51 | end 52 | [U,S,V] = svd(A) ; 53 | H{t} = reshape(V(:,9),3,3) ; 54 | 55 | % score homography 56 | X2_ = H{t} * X1 ; 57 | du = X2_(1,:)./X2_(3,:) - X2(1,:)./X2(3,:) ; 58 | dv = X2_(2,:)./X2_(3,:) - X2(2,:)./X2(3,:) ; 59 | ok{t} = (du.*du + dv.*dv) < 6*6 ; 60 | score(t) = sum(ok{t}) ; 61 | end 62 | 63 | [score, best] = max(score) ; 64 | H = H{best} ; 65 | ok = ok{best} ; 66 | 67 | % -------------------------------------------------------------------- 68 | % Optional refinement 69 | % -------------------------------------------------------------------- 70 | 71 | function err = residual(H) 72 | u = H(1) * X1(1,ok) + H(4) * X1(2,ok) + H(7) ; 73 | v = H(2) * X1(1,ok) + H(5) * X1(2,ok) + H(8) ; 74 | d = H(3) * X1(1,ok) + H(6) * X1(2,ok) + 1 ; 75 | du = X2(1,ok) - u ./ d ; 76 | dv = X2(2,ok) - v ./ d ; 77 | err = sum(du.*du + dv.*dv) ; 78 | end 79 | 80 | if exist('fminsearch') == 2 81 | H = H / H(3,3) ; 82 | opts = optimset('Display', 'none', 'TolFun', 1e-8, 'TolX', 1e-8) ; 83 | H(1:8) = fminsearch(@residual, H(1:8)', opts) ; 84 | else 85 | warning('Refinement disabled as fminsearch was not found.') ; 86 | end 87 | 88 | % -------------------------------------------------------------------- 89 | % Show matches 90 | % -------------------------------------------------------------------- 91 | 92 | dh1 = max(size(im2,1)-size(im1,1),0) ; 93 | dh2 = max(size(im1,1)-size(im2,1),0) ; 94 | 95 | figure(1) ; clf ; 96 | subplot(2,1,1) ; 97 | imagesc([padarray(im1,dh1,'post') padarray(im2,dh2,'post')]) ; 98 | o = size(im1,2) ; 99 | line([f1(1,matches(1,:));f2(1,matches(2,:))+o], ... 100 | [f1(2,matches(1,:));f2(2,matches(2,:))]) ; 101 | title(sprintf('%d tentative matches', numMatches)) ; 102 | axis image off ; 103 | 104 | subplot(2,1,2) ; 105 | imagesc([padarray(im1,dh1,'post') padarray(im2,dh2,'post')]) ; 106 | o = size(im1,2) ; 107 | line([f1(1,matches(1,ok));f2(1,matches(2,ok))+o], ... 108 | [f1(2,matches(1,ok));f2(2,matches(2,ok))]) ; 109 | title(sprintf('%d (%.2f%%) inliner matches out of %d', ... 110 | sum(ok), ... 111 | 100*sum(ok)/numMatches, ... 112 | numMatches)) ; 113 | axis image off ; 114 | 115 | drawnow ; 116 | 117 | % -------------------------------------------------------------------- 118 | % Mosaic 119 | % -------------------------------------------------------------------- 120 | 121 | box2 = [1 size(im2,2) size(im2,2) 1 ; 122 | 1 1 size(im2,1) size(im2,1) ; 123 | 1 1 1 1 ] ; 124 | box2_ = inv(H) * box2 ; 125 | box2_(1,:) = box2_(1,:) ./ box2_(3,:) ; 126 | box2_(2,:) = box2_(2,:) ./ box2_(3,:) ; 127 | ur = min([1 box2_(1,:)]):max([size(im1,2) box2_(1,:)]) ; 128 | vr = min([1 box2_(2,:)]):max([size(im1,1) box2_(2,:)]) ; 129 | 130 | [u,v] = meshgrid(ur,vr) ; 131 | im1_ = vl_imwbackward(im2double(im1),u,v) ; 132 | 133 | z_ = H(3,1) * u + H(3,2) * v + H(3,3) ; 134 | u_ = (H(1,1) * u + H(1,2) * v + H(1,3)) ./ z_ ; 135 | v_ = (H(2,1) * u + H(2,2) * v + H(2,3)) ./ z_ ; 136 | im2_ = vl_imwbackward(im2double(im2),u_,v_) ; 137 | 138 | mass = ~isnan(im1_) + ~isnan(im2_) ; 139 | im1_(isnan(im1_)) = 0 ; 140 | im2_(isnan(im2_)) = 0 ; 141 | mosaic = (im1_ + im2_) ./ mass ; 142 | 143 | figure(2) ; clf ; 144 | imagesc(mosaic) ; axis image off ; 145 | title('Mosaic') ; 146 | 147 | if nargout == 0, clear mosaic ; end 148 | 149 | end 150 | -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/aib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/aib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/libvl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/libvl.so -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/mser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/mser -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/sift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/sift -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_gauss_elimination: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_gauss_elimination -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_getopt_long: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_getopt_long -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_gmm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_gmm -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_heap-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_heap-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_host: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_host -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_imopv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_imopv -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_kmeans: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_kmeans -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_liop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_liop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_mathop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_mathop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_mathop_abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_mathop_abs -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_nan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_nan -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_qsort-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_qsort-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_rand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_rand -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_sqrti: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_sqrti -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_stringop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_stringop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_svd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_svd2 -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_threads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_threads -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnx86/test_vec_comp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnx86/test_vec_comp -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/aib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/aib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/libvl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/libvl.so -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/mser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/mser -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/sift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/sift -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_gauss_elimination: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_gauss_elimination -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_getopt_long: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_getopt_long -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_gmm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_gmm -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_heap-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_heap-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_host: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_host -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_imopv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_imopv -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_kmeans: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_kmeans -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_liop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_liop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_mathop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_mathop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_mathop_abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_mathop_abs -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_nan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_nan -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_qsort-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_qsort-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_rand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_rand -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_sqrti: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_sqrti -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_stringop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_stringop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_svd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_svd2 -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_threads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_threads -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/glnxa64/test_vec_comp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/glnxa64/test_vec_comp -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/aib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/aib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/libvl.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/libvl.dylib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/mser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/mser -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/sift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/sift -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_gauss_elimination: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_gauss_elimination -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_getopt_long: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_getopt_long -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_gmm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_gmm -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_heap-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_heap-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_host: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_host -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_imopv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_imopv -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_kmeans: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_kmeans -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_liop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_liop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_mathop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_mathop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_mathop_abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_mathop_abs -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_nan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_nan -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_qsort-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_qsort-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_rand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_rand -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_sqrti: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_sqrti -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_stringop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_stringop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_svd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_svd2 -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_threads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_threads -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci/test_vec_comp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci/test_vec_comp -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/aib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/aib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/libvl.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/libvl.dylib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/mser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/mser -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/sift: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/sift -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_gauss_elimination: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_gauss_elimination -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_getopt_long: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_getopt_long -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_gmm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_gmm -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_heap-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_heap-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_host: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_host -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_imopv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_imopv -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_kmeans: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_kmeans -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_liop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_liop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_mathop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_mathop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_mathop_abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_mathop_abs -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_nan: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_nan -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_qsort-def: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_qsort-def -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_rand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_rand -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_sqrti: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_sqrti -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_stringop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_stringop -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_svd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_svd2 -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_threads: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_threads -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/maci64/test_vec_comp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/maci64/test_vec_comp -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/aib.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/aib.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/mser.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/mser.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/msvcr100.dll -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/sift.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/sift.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_gauss_elimination.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_gauss_elimination.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_getopt_long.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_getopt_long.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_gmm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_gmm.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_heap-def.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_heap-def.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_host.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_imopv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_imopv.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_kmeans.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_kmeans.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_liop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_liop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_mathop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_mathop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_mathop_abs.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_mathop_abs.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_nan.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_nan.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_qsort-def.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_qsort-def.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_rand.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_rand.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_sqrti.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_sqrti.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_stringop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_stringop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_svd2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_svd2.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_threads.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_threads.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/test_vec_comp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/test_vec_comp.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/vl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/vl.dll -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win32/vl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win32/vl.lib -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/aib.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/aib.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/mser.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/mser.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/msvcr100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/msvcr100.dll -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/sift.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/sift.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_gauss_elimination.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_gauss_elimination.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_getopt_long.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_getopt_long.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_gmm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_gmm.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_heap-def.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_heap-def.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_host.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_imopv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_imopv.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_kmeans.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_kmeans.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_liop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_liop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_mathop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_mathop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_mathop_abs.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_mathop_abs.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_nan.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_nan.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_qsort-def.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_qsort-def.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_rand.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_rand.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_sqrti.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_sqrti.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_stringop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_stringop.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_svd2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_svd2.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_threads.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_threads.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/test_vec_comp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/test_vec_comp.exe -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/vl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/vl.dll -------------------------------------------------------------------------------- /vlfeat-0.9.20/bin/win64/vl.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WenliangDu/FastDenseFeatureMatchingModel/6cfdfec159ed8341a61276a9db0a2e113258ba95/vlfeat-0.9.20/bin/win64/vl.lib --------------------------------------------------------------------------------