├── Code ├── Eval │ ├── CalMAE.m │ ├── CalPR.m │ ├── DrawPRCurve.m │ ├── EvalSalImage.m │ ├── EvalSalResult.m │ ├── Test.m │ ├── WFb.m │ ├── normalize.m │ ├── prec_rec.m │ └── vec.m ├── External │ ├── LSC │ │ ├── 01.jpg │ │ ├── 01label.bmp │ │ ├── 01result │ │ ├── 02.jpg │ │ ├── 02label.bmp │ │ ├── 02result │ │ ├── 02result.bmp │ │ ├── 03.jpg │ │ ├── 04.jpg │ │ ├── DisplayLabel.m │ │ ├── DisplaySuperpixel.m │ │ ├── DoSuperpixel.h │ │ ├── EnforceConnectivity.h │ │ ├── Initialize.h │ │ ├── LSC.h │ │ ├── LSC_demo.m │ │ ├── LSC_mex.cpp │ │ ├── LSC_mex.mexa64 │ │ ├── LSC_mex.mexmaci64 │ │ ├── LSC_mex.mexw64 │ │ ├── Mscowb1.jpg │ │ ├── Mscowb1label.bmp │ │ ├── Mscowb1result │ │ ├── Mscowb2.jpg │ │ ├── RGB2Lab.m │ │ ├── Seeds.h │ │ ├── countSuperpixel.h │ │ ├── myrgb2lab.h │ │ ├── point.h │ │ ├── preEnforceConnectivity.h │ │ ├── readme.txt │ │ ├── supp273.pdf │ │ ├── test.jpg │ │ ├── testlabel.bmp │ │ └── testresult │ ├── RPCA │ │ └── exact_alm_rpca │ │ │ └── exact_alm_rpca │ │ │ ├── PROPACK │ │ │ ├── Afunc.m │ │ │ ├── AtAfunc.m │ │ │ ├── Atransfunc.m │ │ │ ├── Cfunc.m │ │ │ ├── bdsqr.m │ │ │ ├── bdsqr.mexglx │ │ │ ├── bdsqr.mexsg │ │ │ ├── bdsqr.mexsg64 │ │ │ ├── bdsqr.mexsol │ │ │ ├── bdsqr.mexw32 │ │ │ ├── bdsqr_mex.c │ │ │ ├── compute_int.m │ │ │ ├── dbdqr.f │ │ │ ├── helio.mat │ │ │ ├── lanbpro.doc │ │ │ ├── lanbpro.m │ │ │ ├── lanbpro.txt │ │ │ ├── laneig.doc │ │ │ ├── laneig.m │ │ │ ├── laneig.txt │ │ │ ├── lanpro.doc │ │ │ ├── lanpro.m │ │ │ ├── lanpro.txt │ │ │ ├── lansvd.doc │ │ │ ├── lansvd.m │ │ │ ├── lansvd.txt │ │ │ ├── mminfo.m │ │ │ ├── mmread.m │ │ │ ├── mmwrite.m │ │ │ ├── pythag.m │ │ │ ├── refinebounds.m │ │ │ ├── reorth.f │ │ │ ├── reorth.m │ │ │ ├── reorth.mexglx │ │ │ ├── reorth.mexsg │ │ │ ├── reorth.mexsg64 │ │ │ ├── reorth.mexsol │ │ │ ├── reorth_mex.c │ │ │ ├── test.m │ │ │ ├── testtqlb.m │ │ │ ├── tqlb.f │ │ │ ├── tqlb.m │ │ │ ├── tqlb.mexglx │ │ │ ├── tqlb.mexsg │ │ │ ├── tqlb.mexsg64 │ │ │ ├── tqlb.mexsol │ │ │ ├── tqlb_mex.c │ │ │ └── update_gbound.m │ │ │ ├── choosvd.m │ │ │ └── exact_alm_rpca.m │ ├── SLIC_mex │ │ ├── SLIC.cpp │ │ ├── SLIC.h │ │ ├── SLIC_mex.cpp │ │ ├── SLIC_mex.mexa64 │ │ ├── SLIC_mex.mexmaci64 │ │ ├── SLIC_mex.mexw64 │ │ └── test.m │ ├── as_rpca │ │ ├── as_rpca.m │ │ └── test.m │ ├── pdeal.c │ ├── pdeal.mexglx │ ├── pdeal.mexmaci64 │ ├── pdeal.mexw32 │ ├── pdeal.mexw64 │ ├── posdeal2.m │ └── reassign.m ├── Ka2distance_demo.m ├── SLIC │ ├── Rgb2Lab.h │ ├── SLIC.cpp │ ├── SLIC.h │ ├── SLIC_mex.cpp │ ├── SLIC_mex.mexw32 │ ├── SLIC_mex.mexw64 │ ├── compile.m │ └── image │ │ ├── ImageConcept.h │ │ └── ImageSimple.h ├── avg_sm.m ├── compute_sigma_new.m ├── cosdata │ ├── gt │ │ └── pair │ │ │ └── pair105 │ │ │ ├── 1 │ │ │ ├── 1a.bmp │ │ │ └── 1b.bmp │ │ │ ├── 10 │ │ │ ├── 10a.bmp │ │ │ └── 10b.bmp │ │ │ └── 100 │ │ │ ├── 100a.bmp │ │ │ └── 100b.bmp │ └── images │ │ └── pair │ │ └── pair105 │ │ ├── 1 │ │ ├── 1a.bmp │ │ ├── 1a.jpg │ │ ├── 1b.bmp │ │ └── 1b.jpg │ │ ├── 10 │ │ ├── 10a.bmp │ │ ├── 10a.jpg │ │ ├── 10b.bmp │ │ └── 10b.jpg │ │ └── 100 │ │ ├── 100a.bmp │ │ ├── 100a.jpg │ │ ├── 100b.bmp │ │ └── 100b.jpg ├── create_feature_space.m ├── cvx-w64 │ └── cvx │ │ └── README.txt ├── demo.m ├── do_kmeans.c ├── do_kmeans.mexmaci64 ├── do_kmeans.mexw32 ├── do_kmeans.mexw64 ├── gaborfilterVikas.m ├── getneighbor_demo.m ├── nearest_posdef.m ├── normalize.m ├── read_maps.m ├── rgb2lab.m ├── sacs_accv14_thes.m ├── set_A_new.m ├── set_B.m ├── set_affinity.m ├── set_w.m ├── sp_make_dir.m ├── submaps │ └── pair │ │ └── pair105 │ │ ├── 1 │ │ ├── 1a_Achanta.bmp │ │ ├── 1a_CA.png │ │ ├── 1a_COV.png │ │ ├── 1a_CoC.png │ │ ├── 1a_Cor.png │ │ ├── 1a_DSR.png │ │ ├── 1a_FES.png │ │ ├── 1a_Fu.png │ │ ├── 1a_GMR.png │ │ ├── 1a_Hou.bmp │ │ ├── 1a_Itti.bmp │ │ ├── 1a_LMR.png │ │ ├── 1a_MC.png │ │ ├── 1a_PCA.png │ │ ├── 1a_RBD.png │ │ ├── 1a_SEG.png │ │ ├── 1a_SF.png │ │ ├── 1a_SR.png │ │ ├── 1a_SUN.png │ │ ├── 1a_SWD.png │ │ ├── 1a_SeR.png │ │ ├── 1a_SpC.png │ │ ├── 1a_color.bmp │ │ ├── 1a_patch.bmp │ │ ├── 1b_Achanta.bmp │ │ ├── 1b_CA.png │ │ ├── 1b_COV.png │ │ ├── 1b_CoC.png │ │ ├── 1b_Cor.png │ │ ├── 1b_DSR.png │ │ ├── 1b_FES.png │ │ ├── 1b_Fu.png │ │ ├── 1b_GMR.png │ │ ├── 1b_Hou.bmp │ │ ├── 1b_Itti.bmp │ │ ├── 1b_LMR.png │ │ ├── 1b_MC.png │ │ ├── 1b_PCA.png │ │ ├── 1b_RBD.png │ │ ├── 1b_SEG.png │ │ ├── 1b_SF.png │ │ ├── 1b_SR.png │ │ ├── 1b_SUN.png │ │ ├── 1b_SWD.png │ │ ├── 1b_SeR.png │ │ ├── 1b_SpC.png │ │ ├── 1b_color.bmp │ │ └── 1b_patch.bmp │ │ ├── 10 │ │ ├── 10a_Achanta.bmp │ │ ├── 10a_CA.png │ │ ├── 10a_COV.png │ │ ├── 10a_CoC.png │ │ ├── 10a_Cor.png │ │ ├── 10a_DSR.png │ │ ├── 10a_FES.png │ │ ├── 10a_Fu.png │ │ ├── 10a_GMR.png │ │ ├── 10a_HDCT.png │ │ ├── 10a_Hou.bmp │ │ ├── 10a_Itti.bmp │ │ ├── 10a_LMR.png │ │ ├── 10a_MC.png │ │ ├── 10a_PCA.png │ │ ├── 10a_RBD.png │ │ ├── 10a_SEG.png │ │ ├── 10a_SF.png │ │ ├── 10a_SR.png │ │ ├── 10a_SUN.png │ │ ├── 10a_SWD.png │ │ ├── 10a_SeR.png │ │ ├── 10a_SpC.png │ │ ├── 10a_color.bmp │ │ ├── 10a_patch.bmp │ │ ├── 10b_Achanta.bmp │ │ ├── 10b_CA.png │ │ ├── 10b_COV.png │ │ ├── 10b_CoC.png │ │ ├── 10b_Cor.png │ │ ├── 10b_DSR.png │ │ ├── 10b_FES.png │ │ ├── 10b_Fu.png │ │ ├── 10b_GMR.png │ │ ├── 10b_HDCT.png │ │ ├── 10b_Hou.bmp │ │ ├── 10b_Itti.bmp │ │ ├── 10b_LMR.png │ │ ├── 10b_MC.png │ │ ├── 10b_PCA.png │ │ ├── 10b_RBD.png │ │ ├── 10b_SEG.png │ │ ├── 10b_SF.png │ │ ├── 10b_SR.png │ │ ├── 10b_SUN.png │ │ ├── 10b_SWD.png │ │ ├── 10b_SeR.png │ │ ├── 10b_SpC.png │ │ ├── 10b_color.bmp │ │ └── 10b_patch.bmp │ │ └── 100 │ │ ├── 100a_Achanta.bmp │ │ ├── 100a_CA.png │ │ ├── 100a_COV.png │ │ ├── 100a_CoC.png │ │ ├── 100a_Cor.png │ │ ├── 100a_DSR.png │ │ ├── 100a_FES.png │ │ ├── 100a_Fu.png │ │ ├── 100a_GMR.png │ │ ├── 100a_HDCT.png │ │ ├── 100a_Hou.bmp │ │ ├── 100a_Itti.bmp │ │ ├── 100a_LMR.png │ │ ├── 100a_MC.png │ │ ├── 100a_PCA.png │ │ ├── 100a_RBD.png │ │ ├── 100a_SEG.png │ │ ├── 100a_SF.png │ │ ├── 100a_SR.png │ │ ├── 100a_SUN.png │ │ ├── 100a_SWD.png │ │ ├── 100a_SeR.png │ │ ├── 100a_SpC.png │ │ ├── 100a_color.bmp │ │ ├── 100a_patch.bmp │ │ ├── 100b_Achanta.bmp │ │ ├── 100b_CA.png │ │ ├── 100b_COV.png │ │ ├── 100b_CoC.png │ │ ├── 100b_Cor.png │ │ ├── 100b_DSR.png │ │ ├── 100b_FES.png │ │ ├── 100b_Fu.png │ │ ├── 100b_GMR.png │ │ ├── 100b_HDCT.png │ │ ├── 100b_Hou.bmp │ │ ├── 100b_Itti.bmp │ │ ├── 100b_LMR.png │ │ ├── 100b_MC.png │ │ ├── 100b_PCA.png │ │ ├── 100b_RBD.png │ │ ├── 100b_SEG.png │ │ ├── 100b_SF.png │ │ ├── 100b_SR.png │ │ ├── 100b_SUN.png │ │ ├── 100b_SWD.png │ │ ├── 100b_SeR.png │ │ ├── 100b_SpC.png │ │ ├── 100b_color.bmp │ │ └── 100b_patch.bmp └── test │ └── pair │ └── pair105 │ └── icassp17 │ ├── 1 │ ├── 1a_1.png │ └── 1b_1.png │ ├── 10 │ ├── 10a_1.png │ └── 10b_1.png │ └── 100 │ ├── 100a_1.png │ └── 100b_1.png ├── ICASSP17_CSLA_PAPER.pdf ├── ICASSP17_CSLA_POSTER.pdf └── README.md /Code/Eval/CalMAE.m: -------------------------------------------------------------------------------- 1 | function [MAE, AllMAE]= CalMAE(SalMapList, MaskList) 2 | NumImgs = length(MaskList); 3 | AllMAE = zeros(1, NumImgs, 'single'); 4 | for i = 1:NumImgs 5 | AllMAE(i) = mean(abs(im2single(vec(SalMapList{i})) - single(vec(MaskList{i})))); 6 | end 7 | MAE = mean(AllMAE); 8 | end -------------------------------------------------------------------------------- /Code/Eval/CalPR.m: -------------------------------------------------------------------------------- 1 | function [precision, recall, fpr] = CalPR(smapImg, gtImg, targetIsFg, targetIsHigh) 2 | % Code Author: Wangjiang Zhu 3 | % Email: wangjiang88119@gmail.com 4 | % Date: 3/24/2014 5 | smapImg = smapImg(:,:,1); 6 | smapImg = normalize(smapImg); 7 | if ~islogical(gtImg) 8 | gtImg = gtImg(:,:,1) > 128; 9 | end 10 | if any(size(smapImg) ~= size(gtImg)) 11 | error('saliency map and ground truth mask have different size'); 12 | end 13 | 14 | if ~targetIsFg 15 | gtImg = ~gtImg; 16 | end 17 | 18 | 19 | gtPxlNum = sum(gtImg(:)); 20 | if 0 == gtPxlNum 21 | error('no foreground region is labeled'); 22 | end 23 | 24 | targetHist = histc(smapImg(gtImg), 0:255); 25 | nontargetHist = histc(smapImg(~gtImg), 0:255); 26 | 27 | if targetIsHigh 28 | targetHist = flipud(targetHist); 29 | nontargetHist = flipud(nontargetHist); 30 | end 31 | targetHist = cumsum( targetHist ); 32 | nontargetHist = cumsum( nontargetHist ); 33 | 34 | precision = targetHist ./ (targetHist + nontargetHist); 35 | if any(isnan(precision)) 36 | warning('there exists NAN in precision, this is because of your saliency map do not have a full range specified by cutThreshes\n'); 37 | end 38 | recall = targetHist / gtPxlNum; 39 | fpr = nontargetHist / sum(gtImg(:) == 0); 40 | -------------------------------------------------------------------------------- /Code/Eval/DrawPRCurve.m: -------------------------------------------------------------------------------- 1 | function [AP,AUC,mF,wf] = DrawPRCurve(SalMapList, MaskList) 2 | NumImages = length(SalMapList); 3 | 4 | AllPrec = zeros(NumImages, 256, 'single'); 5 | AllRecall = zeros(NumImages, 256, 'single'); 6 | AllFP = zeros(NumImages, 256, 'single'); 7 | ALLFMEASURE = zeros(NumImages,1, 'single'); 8 | 9 | for k = 1:NumImages 10 | [AllPrec(k, :), AllRecall(k, :), AllFP(k,:)] = CalPR(normalize(SalMapList{k}), MaskList{k}, true, true); 11 | f_measure = WFb(im2double(SalMapList{k}),logical(MaskList{k})); 12 | ALLFMEASURE(k,1) = f_measure; 13 | end 14 | FMeasure = (1 + 0.3) * AllPrec .* AllRecall ./ (0.3 * AllPrec + AllRecall + eps); 15 | mF = mean(FMeasure, 2); 16 | wf = mean(ALLFMEASURE); 17 | 18 | MeanRecall = mean(AllRecall, 1); 19 | MeanPrec = mean(AllPrec , 1); 20 | MeanFP = mean(AllFP, 1); 21 | AP = trapz([0,MeanRecall],[MeanPrec(1),MeanPrec]); 22 | AUC = trapz([0 MeanFP],[MeanRecall(end) MeanRecall]); 23 | 24 | end -------------------------------------------------------------------------------- /Code/Eval/EvalSalImage.m: -------------------------------------------------------------------------------- 1 | function [MAE, AP, AUC, mF, wf] = EvalSalImage(SalMap, MaskList) 2 | MAE = CalMAE(SalMap, MaskList); 3 | [AP, AUC, mFList, wf] = DrawPRCurve(SalMap, MaskList); 4 | mF = mean(mFList); 5 | end 6 | 7 | function [MAE, AllMAE]= CalMAE(SalMapList, MaskList) 8 | NumImgs = length(MaskList); 9 | AllMAE = zeros(1, NumImgs, 'single'); 10 | for i = 1:NumImgs 11 | AllMAE(i) = mean(abs(im2single(vec(SalMapList{i})) - single(vec(MaskList{i})))); 12 | end 13 | MAE = mean(AllMAE); 14 | end 15 | 16 | function V = vec(V) 17 | V = V(:); 18 | end 19 | 20 | function [AP,AUC,mF,wf] = DrawPRCurve(SalMapList, MaskList) 21 | NumImages = length(SalMapList); 22 | 23 | AllPrec = zeros(NumImages, 256, 'single'); 24 | AllRecall = zeros(NumImages, 256, 'single'); 25 | AllFP = zeros(NumImages, 256, 'single'); 26 | ALLFMEASURE = zeros(NumImages,1, 'single'); 27 | 28 | for k = 1:NumImages 29 | [AllPrec(k, :), AllRecall(k, :), AllFP(k,:)] = CalPR(normalize(SalMapList{k}), MaskList{k}, true, true); 30 | f_measure = WFb(im2double(SalMapList{k}),logical(MaskList{k})); 31 | ALLFMEASURE(k,1) = f_measure; 32 | end 33 | FMeasure = (1 + 0.3) * AllPrec .* AllRecall ./ (0.3 * AllPrec + AllRecall + eps); 34 | mF = mean(FMeasure, 2); 35 | wf = mean(ALLFMEASURE); 36 | 37 | MeanRecall = mean(AllRecall, 1); 38 | MeanPrec = mean(AllPrec , 1); 39 | MeanFP = mean(AllFP, 1); 40 | AP = trapz([0,MeanRecall],[MeanPrec(1),MeanPrec]); 41 | AUC = trapz([0 MeanFP],[MeanRecall(1) MeanRecall]); 42 | 43 | end 44 | 45 | function [Q]= WFb(FG,GT) 46 | % WFb Compute the Weighted F-beta measure (as proposed in "How to Evaluate 47 | % Foreground Maps?" [Margolin et. al - CVPR'14]) 48 | % Usage: 49 | % Q = FbW(FG,GT) 50 | % Input: 51 | % FG - Binary/Non binary foreground map with values in the range [0 1]. Type: double. 52 | % GT - Binary ground truth. Type: logical. 53 | % Output: 54 | % Q - The Weighted F-beta score 55 | 56 | %Check input 57 | if (~isa( FG, 'double' )) 58 | error('FG should be of type: double'); 59 | end 60 | if ((max(FG(:))>1) || min(FG(:))<0) 61 | error('FG should be in the range of [0 1]'); 62 | end 63 | if (~islogical(GT)) 64 | error('GT should be of type: logical'); 65 | end 66 | 67 | dGT = double(GT); %Use double for computations. 68 | 69 | 70 | E = abs(FG-dGT); 71 | % [Ef, Et, Er] = deal(abs(FG-GT)); 72 | 73 | [Dst,IDXT] = bwdist(dGT); 74 | %Pixel dependency 75 | K = fspecial('gaussian',7,5); 76 | Et = E; 77 | Et(~GT)=Et(IDXT(~GT)); %To deal correctly with the edges of the foreground region 78 | EA = imfilter(Et,K); 79 | MIN_E_EA = E; 80 | MIN_E_EA(GT & EA1) || min(FG(:))<0) 17 | error('FG should be in the range of [0 1]'); 18 | end 19 | if (~islogical(GT)) 20 | error('GT should be of type: logical'); 21 | end 22 | 23 | dGT = double(GT); %Use double for computations. 24 | 25 | 26 | E = abs(FG-dGT); 27 | % [Ef, Et, Er] = deal(abs(FG-GT)); 28 | 29 | [Dst,IDXT] = bwdist(dGT); 30 | %Pixel dependency 31 | K = fspecial('gaussian',7,5); 32 | Et = E; 33 | Et(~GT)=Et(IDXT(~GT)); %To deal correctly with the edges of the foreground region 34 | EA = imfilter(Et,K); 35 | MIN_E_EA = E; 36 | MIN_E_EA(GT & EA 5 | #include"preEnforceConnectivity.h" 6 | #include 7 | #include"EnforceConnectivity.h" 8 | #include"point.h" 9 | using namespace std; 10 | 11 | 12 | //Perform weighted kmeans iteratively in the ten dimensional feature space. 13 | 14 | void DoSuperpixel( 15 | float** L1, 16 | float** L2, 17 | float** a1, 18 | float** a2, 19 | float** b1, 20 | float** b2, 21 | float** x1, 22 | float** x2, 23 | float** y1, 24 | float** y2, 25 | double** W, 26 | unsigned short int* label, 27 | point* seedArray, 28 | int seedNum, 29 | int nRows, 30 | int nCols, 31 | int StepX, 32 | int StepY, 33 | int iterationNum, 34 | int thresholdCoef 35 | ) 36 | { 37 | //Pre-treatment 38 | double** dist=new double*[nRows]; 39 | for(int i=0;i=nRows-1)?nRows-1:x+StepX/4; 74 | int maxY=(y+StepY/4>=nCols-1)?nCols-1:y+StepY/4; 75 | int Count=0; 76 | for(int j=minX;j<=maxX;j++) 77 | for(int k=minY;k<=maxY;k++) 78 | { 79 | Count++; 80 | centerL1[i]+=L1[j][k]; 81 | centerL2[i]+=L2[j][k]; 82 | centera1[i]+=a1[j][k]; 83 | centera2[i]+=a2[j][k]; 84 | centerb1[i]+=b1[j][k]; 85 | centerb2[i]+=b2[j][k]; 86 | centerx1[i]+=x1[j][k]; 87 | centerx2[i]+=x2[j][k]; 88 | centery1[i]+=y1[j][k]; 89 | centery2[i]+=y2[j][k]; 90 | } 91 | centerL1[i]/=Count; 92 | centerL2[i]/=Count; 93 | centera1[i]/=Count; 94 | centera2[i]/=Count; 95 | centerb1[i]/=Count; 96 | centerb2[i]/=Count; 97 | centerx1[i]/=Count; 98 | centerx2[i]/=Count; 99 | centery1[i]/=Count; 100 | centery2[i]/=Count; 101 | } 102 | 103 | 104 | 105 | //K-means 106 | for(int iteration=0;iteration<=iterationNum;iteration++) 107 | { 108 | for(int i=0;i=nRows-1)?nRows-1:x+StepX; 123 | maxY=(y+(StepY)>=nCols-1)?nCols-1:y+StepY; 124 | for(int m=minX;m<=maxX;m++) 125 | for(int n=minY;n<=maxY;n++) 126 | { 127 | D= (L1[m][n]-centerL1[i])*(L1[m][n]-centerL1[i])+ 128 | (L2[m][n]-centerL2[i])*(L2[m][n]-centerL2[i])+ 129 | (a1[m][n]-centera1[i])*(a1[m][n]-centera1[i])+ 130 | (a2[m][n]-centera2[i])*(a2[m][n]-centera2[i])+ 131 | (b1[m][n]-centerb1[i])*(b1[m][n]-centerb1[i])+ 132 | (b2[m][n]-centerb2[i])*(b2[m][n]-centerb2[i])+ 133 | (x1[m][n]-centerx1[i])*(x1[m][n]-centerx1[i])+ 134 | (x2[m][n]-centerx2[i])*(x2[m][n]-centerx2[i])+ 135 | (y1[m][n]-centery1[i])*(y1[m][n]-centery1[i])+ 136 | (y2[m][n]-centery2[i])*(y2[m][n]-centery2[i]); 137 | if(D 5 | using namespace std; 6 | 7 | //map pixels into ten dimensional feature space 8 | 9 | const double PI=3.1415926; 10 | void Initialize( 11 | unsigned char* L, 12 | unsigned char* a, 13 | unsigned char* b, 14 | float** L1, 15 | float** L2, 16 | float** a1, 17 | float** a2, 18 | float** b1, 19 | float** b2, 20 | float** x1, 21 | float** x2, 22 | float** y1, 23 | float** y2, 24 | double** W, 25 | int nRows, 26 | int nCols, 27 | int StepX, 28 | int StepY, 29 | float Color, 30 | float Distance 31 | ) 32 | { 33 | float thetaL,thetaa,thetab,thetax,thetay; 34 | for(int i=0;i 2 | #include 3 | #include"LSC.h" 4 | 5 | 6 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) 7 | { 8 | unsigned char* R,* G,* B; 9 | int SuperpixelNum; 10 | int nRows;int nCols; 11 | double ratio; 12 | unsigned short* label; 13 | unsigned short* output; 14 | 15 | unsigned char* img; 16 | 17 | if(nrhs==2||nrhs==3) 18 | { 19 | if(mxGetNumberOfDimensions(prhs[0])!=3) 20 | mexErrMsgTxt("The input image must be in CIERGB form"); 21 | if(mxGetClassID(prhs[0])!=mxUINT8_CLASS) 22 | mexErrMsgTxt("The input image must be in CIERGB form"); 23 | nRows=mxGetM(prhs[0]); 24 | nCols=mxGetN(prhs[0])/3; 25 | 26 | img=(unsigned char*)mxGetPr(prhs[0]); 27 | SuperpixelNum=int(((double*)(mxGetPr(prhs[1])))[0]); 28 | 29 | if(nrhs==3) 30 | ratio=((double*)(mxGetPr(prhs[2])))[0]; 31 | else 32 | ratio=0.1; 33 | 34 | } 35 | else if(nrhs>3) 36 | mexErrMsgTxt("Too many inputs!"); 37 | else if(nrhs<2) 38 | mexErrMsgTxt("Too few inputs!"); 39 | 40 | 41 | int pixel=nRows*nCols; 42 | R=new unsigned char[pixel]; 43 | G=new unsigned char[pixel]; 44 | B=new unsigned char[pixel]; 45 | label=new unsigned short[pixel]; 46 | 47 | for(int i=0;i Lab -> RGB is approximately 7 | % 10^-5. RGB values can be either between 0 and 1 or between 0 and 255. 8 | % By Mark Ruzon from C code by Yossi Rubner, 23 September 1997. 9 | % Updated for MATLAB 5 28 January 1998. 10 | 11 | if (nargin == 1) 12 | B = double(R(:,:,3)); 13 | G = double(R(:,:,2)); 14 | R = double(R(:,:,1)); 15 | end 16 | 17 | if ((max(max(R)) > 1.0) | (max(max(G)) > 1.0) | (max(max(B)) > 1.0)) 18 | R = R./255; 19 | G = G./255; 20 | B = B./255; 21 | end 22 | 23 | RT = double(R <= 0.04045); 24 | r = (RT.*R)./12.92 + (((~RT.*R)+0.055)./1.055).^2.4; 25 | 26 | GT = double(G <= 0.04045); 27 | g = (GT.*G)./12.92 + (((~GT.*G)+0.055)./1.055).^2.4; 28 | 29 | BT = double(B <= 0.04045); 30 | b = (BT.*B)./12.92 + (((~BT.*B)+0.055)./1.055).^2.4; 31 | 32 | 33 | [M, N] = size(R); 34 | s = M*N; 35 | 36 | % Set a threshold 37 | T = 0.008856; 38 | 39 | RGB = [reshape(r,1,s); reshape(g,1,s); reshape(b,1,s)]; 40 | 41 | % RGB to XYZ 42 | MAT = [0.412453 0.357580 0.180423; 43 | 0.212671 0.715160 0.072169; 44 | 0.019334 0.119193 0.950227]; 45 | XYZ = MAT * RGB; 46 | 47 | X = XYZ(1,:) / 0.950456; 48 | Y = XYZ(2,:); 49 | Z = XYZ(3,:) / 1.088754; 50 | 51 | XT = X > T; 52 | YT = Y > T; 53 | ZT = Z > T; 54 | 55 | % Y3 = Y.^(1/3); 56 | fX = XT .* X.^(1/3) + (~XT) .* (7.787 .* X + 16/116); 57 | fY = YT .* Y.^(1/3) + (~YT) .* (7.787 .* Y + 16/116); 58 | fZ = ZT .* Z.^(1/3) + (~ZT) .* (7.787 .* Z + 16/116); 59 | 60 | % Compute L 61 | L = YT .* (116 * Y.^(1/3) - 16.0) + (~YT) .* (903.3 * Y); 62 | % Compute a and b 63 | a = 500 * (fX - fY)+128+0.5; 64 | b = 200 * (fY - fZ)+128+0.5; 65 | 66 | L = reshape(L, M, N); 67 | a = reshape(a, M, N); 68 | b = reshape(b, M, N); 69 | 70 | % if ((nargout == 1) | (nargout == 0)) 71 | % L = cat(3,L,a,b); 72 | % end -------------------------------------------------------------------------------- /Code/External/LSC/Seeds.h: -------------------------------------------------------------------------------- 1 | #ifndef SEEDS 2 | #define SEEDS 3 | 4 | #include 5 | #include 6 | #include"point.h" 7 | using namespace std; 8 | 9 | //Initialize the seeds 10 | 11 | int Seeds(int nRows,int nCols,int Row_num,int Col_num,int Row_step,int Col_step,int seed_num,point* point_array) 12 | { 13 | int Row_remain=nRows-Row_step*Row_num; 14 | int Col_remain=nCols-Col_step*Col_num; 15 | int t1=1,t2=1; 16 | int count=0; 17 | int centerx,centery; 18 | for(int i=0;i=nRows-1)?nRows-1:centerx; 26 | centery=(centery>=nCols-1)?nCols-1:centery; 27 | if(t2 5 | #include 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | class Point 11 | { 12 | public: 13 | int x; 14 | int y; 15 | Point(int X=0,int Y=0) 16 | { 17 | x=X; 18 | y=Y; 19 | } 20 | }; 21 | 22 | int countSuperpixel(unsigned short int* label,int nRows,int nCols) 23 | { 24 | Point P; 25 | queue Q; 26 | int L; 27 | int labelNum=0; 28 | int x,y,maxX,minX,maxY,minY; 29 | bool** mask=new bool*[nRows]; 30 | for(int i=0;i=nRows-1)?nRows-1:x+1; 56 | maxY=(y+1>=nCols-1)?nCols-1:y+1; 57 | for(int m=minX;m<=maxX;m++) 58 | for(int n=minY;n<=maxY;n++) 59 | { 60 | if(label[m*nCols+n]==L&&mask[m][n]==false) 61 | { 62 | P.x=m;P.y=n; 63 | mask[m][n]=true; 64 | label[m*nCols+n]=labelNum; 65 | Q.push(P); 66 | } 67 | } 68 | } 69 | } 70 | } 71 | for(int i=0;i 5 | 6 | // Change from RGB colour space to LAB colour space 7 | 8 | void RGB2XYZ(unsigned char sR,unsigned char sG,unsigned char sB,double& X,double& Y,double& Z) 9 | { 10 | double R = sR/255.0; 11 | double G = sG/255.0; 12 | double B = sB/255.0; 13 | 14 | double r, g, b; 15 | 16 | if(R <= 0.04045) r = R/12.92; 17 | else r = pow((R+0.055)/1.055,2.4); 18 | if(G <= 0.04045) g = G/12.92; 19 | else g = pow((G+0.055)/1.055,2.4); 20 | if(B <= 0.04045) b = B/12.92; 21 | else b = pow((B+0.055)/1.055,2.4); 22 | 23 | X = r*0.412453 + g*0.357580 + b*0.180423; 24 | Y = r*0.212671 + g*0.715160 + b*0.072169; 25 | Z = r*0.019334 + g*0.119193 + b*0.950227; 26 | } 27 | 28 | void RGB2LAB(const unsigned char& sR, const unsigned char& sG, const unsigned char& sB, unsigned char& lval, unsigned char& aval, unsigned char& bval) 29 | { 30 | double X, Y, Z; 31 | RGB2XYZ(sR, sG, sB, X, Y, Z); 32 | 33 | double epsilon = 0.008856; //actual CIE standard 34 | double kappa = 903.3; //actual CIE standard 35 | 36 | double Xr = 0.950456; //reference white 37 | double Yr = 1.0; //reference white 38 | double Zr = 1.088754; //reference white 39 | 40 | double xr = X/Xr; 41 | double yr = Y/Yr; 42 | double zr = Z/Zr; 43 | 44 | double fx, fy, fz; 45 | if(xr > epsilon) fx = pow(xr, 1.0/3.0); 46 | else fx = (kappa*xr + 16.0)/116.0; 47 | if(yr > epsilon) fy = pow(yr, 1.0/3.0); 48 | else fy = (kappa*yr + 16.0)/116.0; 49 | if(zr > epsilon) fz = pow(zr, 1.0/3.0); 50 | else fz = (kappa*zr + 16.0)/116.0; 51 | 52 | lval = (unsigned char)((116.0*fy-16.0)/100*255+0.5); 53 | aval = (unsigned char)(500.0*(fx-fy)+128+0.5); 54 | bval = (unsigned char)(200.0*(fy-fz)+128+0.5); 55 | } 56 | 57 | void myrgb2lab(unsigned char* r,unsigned char* g,unsigned char* b, 58 | unsigned char* L,unsigned char* A,unsigned char* B, 59 | int nRows,int nCols 60 | ) 61 | { 62 | for(int i=0;i 5 | #include 6 | using namespace std; 7 | 8 | //Enforce Connectivity by merging very small superpixels with their neighbors 9 | 10 | void preEnforceConnectivity(unsigned short int* label, int nRows,int nCols) 11 | { 12 | const int dx8[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; 13 | const int dy8[8] = { 0, -1, -1, -1, 0, 1, 1, 1}; 14 | int adj=0; 15 | int Bond=20; 16 | bool **mask=new bool* [nRows]; 17 | for(int i=0;i xLoc; 24 | vector yLoc; 25 | for(int i=0;i=0&&x<=nRows-1&&y>=0&&y<=nCols-1) 36 | { 37 | if(mask[x][y]==1&&label[x*nCols+y]!=L) 38 | adj=label[x*nCols+y];break; 39 | } 40 | } 41 | mask[i][j]=1; 42 | xLoc.insert(xLoc.end(),i); 43 | yLoc.insert(yLoc.end(),j); 44 | int indexMarker=0; 45 | while(indexMarker=nRows-1)?nRows-1:x+1; 51 | int minY=(y-1<=0)?0:y-1; 52 | int maxY=(y+1>=nCols-1)?nCols-1:y+1; 53 | for(int m=minX;m<=maxX;m++) 54 | for(int n=minY;n<=maxY;n++) 55 | { 56 | if(mask[m][n]==0&&label[m*nCols+n]==L) 57 | { 58 | mask[m][n]=1; 59 | xLoc.insert(xLoc.end(),m); 60 | yLoc.insert(yLoc.end(),n); 61 | } 62 | } 63 | } 64 | if(indexMarker 8 | #include 9 | #include "mex.h" 10 | 11 | /* Templates for FORTRAN routines: */ 12 | void dbdqr_(int *n, double *d, double *e, double *c1, double *c2); 13 | void dbdsqr_(char *uplo, int *n, int *ncvt, int *nru, int *ncc, 14 | double *d, double *e, double *vt, int *ldt, double *u, 15 | int *ldu, double *c, int *ldc, double *work, int *info); 16 | 17 | /* Here comes the gateway function to be called by Matlab: */ 18 | void mexFunction(int nlhs, mxArray *plhs[], 19 | int nrhs, const mxArray *prhs[]) 20 | { 21 | int m, n, i, info, zero=0, one=1; 22 | double *d,*e,dummy, *wrk, *bnd; 23 | 24 | if (nrhs != 2) 25 | mexErrMsgTxt("bdsqr requires two input arguments"); 26 | else if (nlhs != 2) 27 | mexErrMsgTxt("bdsqr requires two output arguments"); 28 | 29 | m = mxGetM(prhs[0]); /* get the dimensions of the input */ 30 | n = mxGetN(prhs[0]); 31 | /* make sure input input vectors are same length */ 32 | if (m != mxGetM(prhs[1]) ) 33 | mexErrMsgTxt("alpha and beta must have the same size"); 34 | /* make sure input is m x 1 */ 35 | if ( n != 1 || mxGetN(prhs[1]) != 1 || n != mxGetN(prhs[1])) 36 | mexErrMsgTxt("alpha and beta must be a m x 1 vectors"); 37 | 38 | /* Create/allocate return arguments */ 39 | for (i=0; i<2; i++) { 40 | plhs[i]=mxCreateDoubleMatrix(m,1,mxREAL); 41 | } 42 | 43 | e = mxCalloc(m,sizeof(double)); 44 | wrk = mxCalloc(4*m-4,sizeof(double)); 45 | d = mxGetPr(plhs[0]); 46 | memcpy(d,mxGetPr(prhs[0]), m*sizeof(double)); 47 | memcpy(e,mxGetPr(prhs[1]), m*sizeof(double)); 48 | bnd = mxGetPr(plhs[1]); 49 | for (i=0; i 0) 63 | mexWarnMsgTxt("DBDSQR: singular values did not converge"); 64 | 65 | /* Free work arrays */ 66 | mxFree(e); 67 | mxFree(wrk); 68 | } 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/compute_int.m: -------------------------------------------------------------------------------- 1 | function int = compute_int(mu,j,delta,eta,LL,strategy,extra) 2 | %COMPUTE_INT: Determine which Lanczos vectors to reorthogonalize against. 3 | % 4 | % int = compute_int(mu,eta,LL,strategy,extra)) 5 | % 6 | % Strategy 0: Orthogonalize vectors v_{i-r-extra},...,v_{i},...v_{i+s+extra} 7 | % with nu>eta, where v_{i} are the vectors with mu>delta. 8 | % Strategy 1: Orthogonalize all vectors v_{r-extra},...,v_{s+extra} where 9 | % v_{r} is the first and v_{s} the last Lanczos vector with 10 | % mu > eta. 11 | % Strategy 2: Orthogonalize all vectors with mu > eta. 12 | % 13 | % Notice: The first LL vectors are excluded since the new Lanczos 14 | % vector is already orthogonalized against them in the main iteration. 15 | 16 | % Rasmus Munk Larsen, DAIMI, 1998. 17 | 18 | if (delta= ETA.') 20 | end 21 | switch strategy 22 | case 0 23 | I0 = find(abs(mu(1:j))>=delta); 24 | if length(I0)==0 25 | [mm,I0] = max(abs(mu(1:j))); 26 | end 27 | int = zeros(j,1); 28 | for i = 1:length(I0) 29 | for r=I0(i):-1:1 30 | if abs(mu(r))0 47 | int(1:LL) = 0; 48 | end 49 | int = find(int); 50 | case 1 51 | int=find(abs(mu(1:j))>eta); 52 | int = max(LL+1,min(int)-extra):min(max(int)+extra,j); 53 | case 2 54 | int=find(abs(mu(1:j))>=eta); 55 | end 56 | int = int(:); -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/dbdqr.f: -------------------------------------------------------------------------------- 1 | 2 | subroutine dbdqr(n, D, E, c1, c2) 3 | implicit none 4 | integer n 5 | double precision D(*),E(*),c1,c2 6 | 7 | integer i 8 | double precision cs,sn,r 9 | 10 | if (n.lt.2) return 11 | do i=1,n-1 12 | call dlartg(d(i),e(i),cs,sn,r) 13 | d(i) = r 14 | e(i) = sn*d(i+1) 15 | d(i+1) = cs*d(i+1) 16 | enddo 17 | call dlartg(d(n),e(n),cs,sn,r) 18 | d(n) = r 19 | e(n) = 0.0 20 | c1 = sn 21 | c2 = cs 22 | end 23 | 24 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/helio.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/helio.mat -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lanbpro.doc: -------------------------------------------------------------------------------- 1 | LANBPRO Lanczos bidiagonalization with partial reorthogonalization. 2 | 3 | LANBPRO computes the Lanczos bidiagonalization of a real 4 | matrix using the with partial reorthogonalization. 5 | 6 | [U_k,B_k,V_k,R,ierr,work] = LANBPRO(A,K,R0,OPTIONS,U_old,B_old,V_old) 7 | [U_k,B_k,V_k,R,ierr,work] = LANBPRO('Afun','Atransfun',M,N,K,R0, ... 8 | OPTIONS,U_old,B_old,V_old) 9 | 10 | Computes K steps of the Lanczos bidiagonalization algorithm with partial 11 | reorthogonalization (BPRO) with M-by-1 starting vector R0, producing a 12 | lower bidiagonal K-by-K matrix B_k, an N-by-K matrix V_k, an M-by-K 13 | matrix U_k and a M-by-1 vector such that 14 | A*V_k = U_k*B_k + R 15 | Partial reorthogonalization is used to keep the columns of V_K and U_k 16 | semiorthogonal: 17 | MAX(DIAG((EYE(K) - V_K'*V_K))) <= OPTIONS.delta 18 | and 19 | MAX(DIAG((EYE(K) - U_K'*U_K))) <= OPTIONS.delta. 20 | 21 | B_k = LANBPRO(...) returns the bidiagonal matrix only. 22 | 23 | The first input argument is either a real matrix, or a string 24 | containing the name of an M-file which applies a linear operator 25 | to the columns of a given matrix. In the latter case, the second 26 | input must be the name of an M-file which applies the transpose of 27 | the same linear operator to the columns of a given matrix, 28 | and the third and fourth arguments must be M and N, the dimensions 29 | of then problem. 30 | 31 | The OPTIONS structure is used to control the reorthogonalization: 32 | OPTIONS.delta: Desired level of orthogonality 33 | (default = sqrt(eps/K)). 34 | OPTIONS.eta : Level of orthogonality after reorthogonalization 35 | (default = eps^(3/4)/sqrt(K)). 36 | OPTIONS.cgs : Flag for switching between different reorthogonalization 37 | algorithms: 38 | 0 = iterated modified Gram-Schmidt (default) 39 | 1 = iterated classical Gram-Schmidt 40 | OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local 41 | reorthogonalization is enforced. 42 | OPTIONS.onesided 43 | : If OPTIONS.onesided = 0 (default) then both the left 44 | (U) and right (V) Lanczos vectors are kept 45 | semiorthogonal. 46 | OPTIONS.onesided = 1 then only the columns of U are 47 | are reorthogonalized. 48 | OPTIONS.onesided = -1 then only the columns of V are 49 | are reorthogonalized. 50 | OPTIONS.waitbar 51 | : The progress of the algorithm is display graphically. 52 | 53 | If both R0, U_old, B_old, and V_old are provided, they must 54 | contain a partial Lanczos bidiagonalization of A on the form 55 | 56 | A V_old = U_old B_old + R0 . 57 | 58 | In this case the factorization is extended to dimension K x K by 59 | continuing the Lanczos bidiagonalization algorithm with R0 as a 60 | starting vector. 61 | 62 | The output array work contains information about the work used in 63 | reorthogonalizing the u- and v-vectors. 64 | work = [ RU PU ] 65 | [ RV PV ] 66 | where 67 | RU = Number of reorthogonalizations of U. 68 | PU = Number of inner products used in reorthogonalizing U. 69 | RV = Number of reorthogonalizations of V. 70 | PV = Number of inner products used in reorthogonalizing V. 71 | 72 | References: 73 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 74 | 75 | G. H. Golub & C. F. Van Loan, "Matrix Computations", 76 | 3. Ed., Johns Hopkins, 1996. Section 9.3.4. 77 | 78 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 79 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 80 | 81 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 82 | Math. Comp. 42 (1984), no. 165, 115--142. 83 | 84 | 85 | Rasmus Munk Larsen, DAIMI, 1998. 86 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lanbpro.txt: -------------------------------------------------------------------------------- 1 | LANBPRO Lanczos bidiagonalization with partial reorthogonalization. 2 | 3 | LANBPRO computes the Lanczos bidiagonalization of a real 4 | matrix using the with partial reorthogonalization. 5 | 6 | [U_k,B_k,V_k,R,ierr,work] = LANBPRO(A,K,R0,OPTIONS,U_old,B_old,V_old) 7 | [U_k,B_k,V_k,R,ierr,work] = LANBPRO('Afun','Atransfun',M,N,K,R0, ... 8 | OPTIONS,U_old,B_old,V_old) 9 | 10 | Computes K steps of the Lanczos bidiagonalization algorithm with partial 11 | reorthogonalization (BPRO) with M-by-1 starting vector R0, producing a 12 | lower bidiagonal K-by-K matrix B_k, an N-by-K matrix V_k, an M-by-K 13 | matrix U_k and a M-by-1 vector such that 14 | A*V_k = U_k*B_k + R 15 | Partial reorthogonalization is used to keep the columns of V_K and U_k 16 | semiorthogonal: 17 | MAX(DIAG((EYE(K) - V_K'*V_K))) <= OPTIONS.delta 18 | and 19 | MAX(DIAG((EYE(K) - U_K'*U_K))) <= OPTIONS.delta. 20 | 21 | B_k = LANBPRO(...) returns the bidiagonal matrix only. 22 | 23 | The first input argument is either a real matrix, or a string 24 | containing the name of an M-file which applies a linear operator 25 | to the columns of a given matrix. In the latter case, the second 26 | input must be the name of an M-file which applies the transpose of 27 | the same linear operator to the columns of a given matrix, 28 | and the third and fourth arguments must be M and N, the dimensions 29 | of then problem. 30 | 31 | The OPTIONS structure is used to control the reorthogonalization: 32 | OPTIONS.delta: Desired level of orthogonality 33 | (default = sqrt(eps/K)). 34 | OPTIONS.eta : Level of orthogonality after reorthogonalization 35 | (default = eps^(3/4)/sqrt(K)). 36 | OPTIONS.cgs : Flag for switching between different reorthogonalization 37 | algorithms: 38 | 0 = iterated modified Gram-Schmidt (default) 39 | 1 = iterated classical Gram-Schmidt 40 | OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local 41 | reorthogonalization is enforced. 42 | OPTIONS.onesided 43 | : If OPTIONS.onesided = 0 (default) then both the left 44 | (U) and right (V) Lanczos vectors are kept 45 | semiorthogonal. 46 | OPTIONS.onesided = 1 then only the columns of U are 47 | are reorthogonalized. 48 | OPTIONS.onesided = -1 then only the columns of V are 49 | are reorthogonalized. 50 | OPTIONS.waitbar 51 | : The progress of the algorithm is display graphically. 52 | 53 | If both R0, U_old, B_old, and V_old are provided, they must 54 | contain a partial Lanczos bidiagonalization of A on the form 55 | 56 | A V_old = U_old B_old + R0 . 57 | 58 | In this case the factorization is extended to dimension K x K by 59 | continuing the Lanczos bidiagonalization algorithm with R0 as a 60 | starting vector. 61 | 62 | The output array work contains information about the work used in 63 | reorthogonalizing the u- and v-vectors. 64 | work = [ RU PU ] 65 | [ RV PV ] 66 | where 67 | RU = Number of reorthogonalizations of U. 68 | PU = Number of inner products used in reorthogonalizing U. 69 | RV = Number of reorthogonalizations of V. 70 | PV = Number of inner products used in reorthogonalizing V. 71 | 72 | References: 73 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 74 | 75 | G. H. Golub & C. F. Van Loan, "Matrix Computations", 76 | 3. Ed., Johns Hopkins, 1996. Section 9.3.4. 77 | 78 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 79 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 80 | 81 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 82 | Math. Comp. 42 (1984), no. 165, 115--142. 83 | 84 | 85 | Rasmus Munk Larsen, DAIMI, 1998. 86 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/laneig.doc: -------------------------------------------------------------------------------- 1 | LANEIG Compute a few eigenvalues and eigenvectors. 2 | LANEIG solves the eigenvalue problem A*v=lambda*v, when A is 3 | real and symmetric using the Lanczos algorithm with partial 4 | reorthogonalization (PRO). 5 | 6 | [V,D] = LANEIG(A) 7 | [V,D] = LANEIG('Afun',N) 8 | 9 | The first input argument is either a real symmetric matrix, or a 10 | string containing the name of an M-file which applies a linear 11 | operator to the columns of a given matrix. In the latter case, 12 | the second input argument must be N, the order of the problem. 13 | 14 | The full calling sequence is 15 | 16 | [V,D,ERR] = LANEIG(A,K,SIGMA,OPTIONS) 17 | [V,D,ERR] = LANEIG('Afun',N,K,SIGMA,OPTIONS) 18 | 19 | On exit ERR contains the computed error bounds. K is the number of 20 | eigenvalues desired and SIGMA is numerical shift or a two letter string 21 | which specifies which part of the spectrum should be computed: 22 | 23 | SIGMA Specified eigenvalues 24 | 25 | 'AL' Algebraically Largest 26 | 'AS' Algebraically Smallest 27 | 'LM' Largest Magnitude (default) 28 | 'SM' Smallest Magnitude (does not work when A is an m-file) 29 | 'BE' Both Ends. Computes k/2 eigenvalues 30 | from each end of the spectrum (one more 31 | from the high end if k is odd.) 32 | 33 | The OPTIONS structure specifies certain parameters in the algorithm. 34 | 35 | Field name Parameter Default 36 | 37 | OPTIONS.tol Convergence tolerance 16*eps 38 | OPTIONS.lanmax Dimension of the Lanczos basis. 39 | OPTIONS.v0 Starting vector for the Lanczos rand(n,1)-0.5 40 | iteration. 41 | OPTIONS.delta Level of orthogonality among the sqrt(eps/K) 42 | Lanczos vectors. 43 | OPTIONS.eta Level of orthogonality after 10*eps^(3/4) 44 | reorthogonalization. 45 | OPTIONS.cgs reorthogonalization method used 0 46 | '0' : iterated modified Gram-Schmidt 47 | '1' : iterated classical Gram-Schmidt 48 | OPTIONS.elr If equal to 1 then extended local 1 49 | reorthogonalization is enforced. 50 | 51 | See also LANPRO, EIGS, EIG. 52 | 53 | References: 54 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 55 | 56 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 57 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 58 | 59 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 60 | Math. Comp. 42 (1984), no. 165, 115--142. 61 | 62 | Rasmus Munk Larsen, DAIMI, 1998 63 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/laneig.txt: -------------------------------------------------------------------------------- 1 | LANEIG Compute a few eigenvalues and eigenvectors. 2 | LANEIG solves the eigenvalue problem A*v=lambda*v, when A is 3 | real and symmetric using the Lanczos algorithm with partial 4 | reorthogonalization (PRO). 5 | 6 | [V,D] = LANEIG(A) 7 | [V,D] = LANEIG('Afun',N) 8 | 9 | The first input argument is either a real symmetric matrix, or a 10 | string containing the name of an M-file which applies a linear 11 | operator to the columns of a given matrix. In the latter case, 12 | the second input argument must be N, the order of the problem. 13 | 14 | The full calling sequence is 15 | 16 | [V,D,ERR] = LANEIG(A,K,SIGMA,OPTIONS) 17 | [V,D,ERR] = LANEIG('Afun',N,K,SIGMA,OPTIONS) 18 | 19 | On exit ERR contains the computed error bounds. K is the number of 20 | eigenvalues desired and SIGMA is numerical shift or a two letter string 21 | which specifies which part of the spectrum should be computed: 22 | 23 | SIGMA Specified eigenvalues 24 | 25 | 'AL' Algebraically Largest 26 | 'AS' Algebraically Smallest 27 | 'LM' Largest Magnitude (default) 28 | 'SM' Smallest Magnitude (does not work when A is an m-file) 29 | 'BE' Both Ends. Computes k/2 eigenvalues 30 | from each end of the spectrum (one more 31 | from the high end if k is odd.) 32 | 33 | The OPTIONS structure specifies certain parameters in the algorithm. 34 | 35 | Field name Parameter Default 36 | 37 | OPTIONS.tol Convergence tolerance 16*eps 38 | OPTIONS.lanmax Dimension of the Lanczos basis. 39 | OPTIONS.v0 Starting vector for the Lanczos rand(n,1)-0.5 40 | iteration. 41 | OPTIONS.delta Level of orthogonality among the sqrt(eps/K) 42 | Lanczos vectors. 43 | OPTIONS.eta Level of orthogonality after 10*eps^(3/4) 44 | reorthogonalization. 45 | OPTIONS.cgs reorthogonalization method used 0 46 | '0' : iterated modified Gram-Schmidt 47 | '1' : iterated classical Gram-Schmidt 48 | OPTIONS.elr If equal to 1 then extended local 1 49 | reorthogonalization is enforced. 50 | 51 | See also LANPRO, EIGS, EIG. 52 | 53 | References: 54 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 55 | 56 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 57 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 58 | 59 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 60 | Math. Comp. 42 (1984), no. 165, 115--142. 61 | 62 | Rasmus Munk Larsen, DAIMI, 1998 63 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lanpro.doc: -------------------------------------------------------------------------------- 1 | LANPRO Lanczos tridiagonalization with partial reorthogonalization 2 | LANPRO computes the Lanczos tridiagonalization of a real symmetric 3 | matrix using the symmetric Lanczos algorithm with partial 4 | reorthogonalization. 5 | 6 | [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO(A,K,R0,OPTIONS,Q_old,T_old) 7 | [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO('Afun',N,K,R0,OPTIONS,Q_old,T_old) 8 | 9 | Computes K steps of the Lanczos algorithm with starting vector R0, 10 | and returns the K x K tridiagonal T_K, the N x K matrix Q_K 11 | with semiorthonormal columns and the residual vector R such that 12 | 13 | A*Q_K = Q_K*T_K + R . 14 | 15 | Partial reorthogonalization is used to keep the columns of Q_K 16 | semiorthogonal: 17 | MAX(DIAG((eye(k) - Q_K'*Q_K))) <= OPTIONS.delta. 18 | 19 | 20 | The first input argument is either a real symmetric matrix, a struct with 21 | components A.L and A.U or a string containing the name of an M-file which 22 | applies a linear operator to the columns of a given matrix. In the latter 23 | case, the second input argument must be N, the order of the problem. 24 | 25 | If A is a struct with components A.L and A.U, such that 26 | L*U = (A - sigma*I), a shift-and-invert Lanczos iteration is performed 27 | 28 | The OPTIONS structure is used to control the reorthogonalization: 29 | OPTIONS.delta: Desired level of orthogonality 30 | (default = sqrt(eps/K)). 31 | OPTIONS.eta : Level of orthogonality after reorthogonalization 32 | (default = eps^(3/4)/sqrt(K)). 33 | OPTIONS.cgs : Flag for switching between different reorthogonalization 34 | algorithms: 35 | 0 = iterated modified Gram-Schmidt (default) 36 | 1 = iterated classical Gram-Schmidt 37 | OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local 38 | reorthogonalization is enforced. 39 | OPTIONS.Y : The lanczos vectors are reorthogonalized against 40 | the columns of the matrix OPTIONS.Y. 41 | 42 | If both R0, Q_old and T_old are provided, they must contain 43 | a partial Lanczos tridiagonalization of A on the form 44 | 45 | A Q_old = Q_old T_old + R0 . 46 | 47 | In this case the factorization is extended to dimension K x K by 48 | continuing the Lanczos algorithm with R0 as starting vector. 49 | 50 | On exit ANORM contains an approximation to ||A||_2. 51 | IERR = 0 : K steps were performed succesfully. 52 | IERR > 0 : K steps were performed succesfully, but the algorithm 53 | switched to full reorthogonalization after IERR steps. 54 | IERR < 0 : Iteration was terminated after -IERR steps because an 55 | invariant subspace was found, and 3 deflation attempts 56 | were unsuccessful. 57 | On exit WORK(1) contains the number of reorthogonalizations performed, and 58 | WORK(2) contains the number of inner products performed in the 59 | reorthogonalizations. 60 | 61 | See also LANEIG, REORTH, COMPUTE_INT 62 | 63 | References: 64 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 65 | 66 | G. H. Golub & C. F. Van Loan, "Matrix Computations", 67 | 3. Ed., Johns Hopkins, 1996. Chapter 9. 68 | 69 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 70 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 71 | 72 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 73 | Math. Comp. 42 (1984), no. 165, 115--142. 74 | 75 | Rasmus Munk Larsen, DAIMI, 1998 76 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lanpro.txt: -------------------------------------------------------------------------------- 1 | LANPRO Lanczos tridiagonalization with partial reorthogonalization 2 | LANPRO computes the Lanczos tridiagonalization of a real symmetric 3 | matrix using the symmetric Lanczos algorithm with partial 4 | reorthogonalization. 5 | 6 | [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO(A,K,R0,OPTIONS,Q_old,T_old) 7 | [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO('Afun',N,K,R0,OPTIONS,Q_old,T_old) 8 | 9 | Computes K steps of the Lanczos algorithm with starting vector R0, 10 | and returns the K x K tridiagonal T_K, the N x K matrix Q_K 11 | with semiorthonormal columns and the residual vector R such that 12 | 13 | A*Q_K = Q_K*T_K + R . 14 | 15 | Partial reorthogonalization is used to keep the columns of Q_K 16 | semiorthogonal: 17 | MAX(DIAG((eye(k) - Q_K'*Q_K))) <= OPTIONS.delta. 18 | 19 | 20 | The first input argument is either a real symmetric matrix, a struct with 21 | components A.L and A.U or a string containing the name of an M-file which 22 | applies a linear operator to the columns of a given matrix. In the latter 23 | case, the second input argument must be N, the order of the problem. 24 | 25 | If A is a struct with components A.L and A.U, such that 26 | L*U = (A - sigma*I), a shift-and-invert Lanczos iteration is performed 27 | 28 | The OPTIONS structure is used to control the reorthogonalization: 29 | OPTIONS.delta: Desired level of orthogonality 30 | (default = sqrt(eps/K)). 31 | OPTIONS.eta : Level of orthogonality after reorthogonalization 32 | (default = eps^(3/4)/sqrt(K)). 33 | OPTIONS.cgs : Flag for switching between different reorthogonalization 34 | algorithms: 35 | 0 = iterated modified Gram-Schmidt (default) 36 | 1 = iterated classical Gram-Schmidt 37 | OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local 38 | reorthogonalization is enforced. 39 | OPTIONS.Y : The lanczos vectors are reorthogonalized against 40 | the columns of the matrix OPTIONS.Y. 41 | 42 | If both R0, Q_old and T_old are provided, they must contain 43 | a partial Lanczos tridiagonalization of A on the form 44 | 45 | A Q_old = Q_old T_old + R0 . 46 | 47 | In this case the factorization is extended to dimension K x K by 48 | continuing the Lanczos algorithm with R0 as starting vector. 49 | 50 | On exit ANORM contains an approximation to ||A||_2. 51 | IERR = 0 : K steps were performed succesfully. 52 | IERR > 0 : K steps were performed succesfully, but the algorithm 53 | switched to full reorthogonalization after IERR steps. 54 | IERR < 0 : Iteration was terminated after -IERR steps because an 55 | invariant subspace was found, and 3 deflation attempts 56 | were unsuccessful. 57 | On exit WORK(1) contains the number of reorthogonalizations performed, and 58 | WORK(2) contains the number of inner products performed in the 59 | reorthogonalizations. 60 | 61 | See also LANEIG, REORTH, COMPUTE_INT 62 | 63 | References: 64 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 65 | 66 | G. H. Golub & C. F. Van Loan, "Matrix Computations", 67 | 3. Ed., Johns Hopkins, 1996. Chapter 9. 68 | 69 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 70 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 71 | 72 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 73 | Math. Comp. 42 (1984), no. 165, 115--142. 74 | 75 | Rasmus Munk Larsen, DAIMI, 1998 76 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lansvd.doc: -------------------------------------------------------------------------------- 1 | LANSVD Compute a few singular values and singular vectors. 2 | LANSVD computes singular triplets (u,v,sigma) such that 3 | A*u = sigma*v and A'*v = sigma*u. Only a few singular values 4 | and singular vectors are computed using the Lanczos 5 | bidiagonalization algorithm with partial reorthogonalization (BPRO). 6 | 7 | S = LANSVD(A) 8 | S = LANSVD('Afun','Atransfun',M,N) 9 | 10 | The first input argument is either a matrix or a 11 | string containing the name of an M-file which applies a linear 12 | operator to the columns of a given matrix. In the latter case, 13 | the second input must be the name of an M-file which applies the 14 | transpose of the same operator to the columns of a given matrix, 15 | and the third and fourth arguments must be M and N, the dimensions 16 | of the problem. 17 | 18 | [U,S,V] = LANSVD(A,K,'L',...) computes the K largest singular values. 19 | 20 | [U,S,V] = LANSVD(A,K,'S',...) computes the K smallest singular values. 21 | 22 | The full calling sequence is 23 | 24 | [U,S,V] = LANSVD(A,K,SIGMA,OPTIONS) 25 | [U,S,V] = LANSVD('Afun','Atransfun',M,N,K,SIGMA,OPTIONS) 26 | 27 | where K is the number of singular values desired and 28 | SIGMA is 'L' or 'S'. 29 | 30 | The OPTIONS structure specifies certain parameters in the algorithm. 31 | Field name Parameter Default 32 | 33 | OPTIONS.tol Convergence tolerance 16*eps 34 | OPTIONS.lanmax Dimension of the Lanczos basis. 35 | OPTIONS.p0 Starting vector for the Lanczos rand(n,1)-0.5 36 | iteration. 37 | OPTIONS.delta Level of orthogonality among the sqrt(eps/K) 38 | Lanczos vectors. 39 | OPTIONS.eta Level of orthogonality after 10*eps^(3/4) 40 | reorthogonalization. 41 | OPTIONS.cgs reorthogonalization method used 0 42 | '0' : iterated modified Gram-Schmidt 43 | '1' : iterated classical Gram-Schmidt 44 | OPTIONS.elr If equal to 1 then extended local 1 45 | reorthogonalization is enforced. 46 | 47 | See also LANBPRO, SVDS, SVD 48 | 49 | References: 50 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 51 | 52 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 53 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 54 | 55 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 56 | Math. Comp. 42 (1984), no. 165, 115--142. 57 | 58 | Rasmus Munk Larsen, DAIMI, 1998 59 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/lansvd.txt: -------------------------------------------------------------------------------- 1 | LANSVD Compute a few singular values and singular vectors. 2 | LANSVD computes singular triplets (u,v,sigma) such that 3 | A*u = sigma*v and A'*v = sigma*u. Only a few singular values 4 | and singular vectors are computed using the Lanczos 5 | bidiagonalization algorithm with partial reorthogonalization (BPRO). 6 | 7 | S = LANSVD(A) 8 | S = LANSVD('Afun','Atransfun',M,N) 9 | 10 | The first input argument is either a matrix or a 11 | string containing the name of an M-file which applies a linear 12 | operator to the columns of a given matrix. In the latter case, 13 | the second input must be the name of an M-file which applies the 14 | transpose of the same operator to the columns of a given matrix, 15 | and the third and fourth arguments must be M and N, the dimensions 16 | of the problem. 17 | 18 | [U,S,V] = LANSVD(A,K,'L',...) computes the K largest singular values. 19 | 20 | [U,S,V] = LANSVD(A,K,'S',...) computes the K smallest singular values. 21 | 22 | The full calling sequence is 23 | 24 | [U,S,V] = LANSVD(A,K,SIGMA,OPTIONS) 25 | [U,S,V] = LANSVD('Afun','Atransfun',M,N,K,SIGMA,OPTIONS) 26 | 27 | where K is the number of singular values desired and 28 | SIGMA is 'L' or 'S'. 29 | 30 | The OPTIONS structure specifies certain parameters in the algorithm. 31 | Field name Parameter Default 32 | 33 | OPTIONS.tol Convergence tolerance 16*eps 34 | OPTIONS.lanmax Dimension of the Lanczos basis. 35 | OPTIONS.p0 Starting vector for the Lanczos rand(n,1)-0.5 36 | iteration. 37 | OPTIONS.delta Level of orthogonality among the sqrt(eps/K) 38 | Lanczos vectors. 39 | OPTIONS.eta Level of orthogonality after 10*eps^(3/4) 40 | reorthogonalization. 41 | OPTIONS.cgs reorthogonalization method used 0 42 | '0' : iterated modified Gram-Schmidt 43 | '1' : iterated classical Gram-Schmidt 44 | OPTIONS.elr If equal to 1 then extended local 1 45 | reorthogonalization is enforced. 46 | 47 | See also LANBPRO, SVDS, SVD 48 | 49 | References: 50 | R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. 51 | 52 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 53 | Prentice-Hall, Englewood Cliffs, NJ, 1980. 54 | 55 | H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', 56 | Math. Comp. 42 (1984), no. 165, 115--142. 57 | 58 | Rasmus Munk Larsen, DAIMI, 1998 59 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/mminfo.m: -------------------------------------------------------------------------------- 1 | function [rows, cols, entries, rep, field, symm] = mminfo(filename) 2 | % 3 | % function [rows, cols, entries, rep, field, symmetry] = mminfo(filename) 4 | % 5 | % Reads the contents of the Matrix Market file 'filename' 6 | % and extracts size and storage information. 7 | % 8 | % In the case of coordinate matrices, entries refers to the 9 | % number of coordinate entries stored in the file. The number 10 | % of non-zero entries in the final matrix cannot be determined 11 | % until the data is read (and symmetrized, if necessary). 12 | % 13 | % In the case of array matrices, entries is the product 14 | % rows*cols, regardless of whether symmetry was used to 15 | % store the matrix efficiently. 16 | % 17 | % 18 | 19 | mmfile = fopen(filename,'r'); 20 | if ( mmfile == -1 ) 21 | disp(filename); 22 | error('File not found'); 23 | end; 24 | 25 | header = fgets(mmfile); 26 | if (header == -1 ) 27 | error('Empty file.') 28 | end 29 | 30 | % NOTE: If using a version of Matlab for which strtok is not 31 | % defined, substitute 'gettok' for 'strtok' in the 32 | % following lines, and download gettok.m from the 33 | % Matrix Market site. 34 | [head0,header] = strtok(header); % see note above 35 | [head1,header] = strtok(header); 36 | [rep,header] = strtok(header); 37 | [field,header] = strtok(header); 38 | [symm,header] = strtok(header); 39 | head1 = lower(head1); 40 | rep = lower(rep); 41 | field = lower(field); 42 | symm = lower(symm); 43 | if ( length(symm) == 0 ) 44 | disp('Not enough words in header line.') 45 | disp('Recognized format: ') 46 | disp('%%MatrixMarket matrix representation field symmetry') 47 | error('Check header line.') 48 | end 49 | if ( ~ strcmp(head0,'%%MatrixMarket') ) 50 | error('Not a valid MatrixMarket header.') 51 | end 52 | if ( ~ strcmp(head1,'matrix') ) 53 | disp(['This seems to be a MatrixMarket ',head1,' file.']); 54 | disp('This function only knows how to read MatrixMarket matrix files.'); 55 | disp(' '); 56 | error(' '); 57 | end 58 | 59 | % Read through comments, ignoring them 60 | 61 | commentline = fgets(mmfile); 62 | while length(commentline) > 0 & commentline(1) == '%', 63 | commentline = fgets(mmfile); 64 | end 65 | 66 | % Read size information, then branch according to 67 | % sparse or dense format 68 | 69 | if ( strcmp(rep,'coordinate')) % read matrix given in sparse 70 | % coordinate matrix format 71 | 72 | [sizeinfo,count] = sscanf(commentline,'%d%d%d'); 73 | while ( count == 0 ) 74 | commentline = fgets(mmfile); 75 | if (commentline == -1 ) 76 | error('End-of-file reached before size information was found.') 77 | end 78 | [sizeinfo,count] = sscanf(commentline,'%d%d%d'); 79 | if ( count > 0 & count ~= 3 ) 80 | error('Invalid size specification line.') 81 | end 82 | end 83 | rows = sizeinfo(1); 84 | cols = sizeinfo(2); 85 | entries = sizeinfo(3); 86 | 87 | elseif ( strcmp(rep,'array') ) % read matrix given in dense 88 | % array (column major) format 89 | 90 | [sizeinfo,count] = sscanf(commentline,'%d%d'); 91 | while ( count == 0 ) 92 | commentline = fgets(mmfile); 93 | if (commentline == -1 ) 94 | error('End-of-file reached before size information was found.') 95 | end 96 | [sizeinfo,count] = sscanf(commentline,'%d%d'); 97 | if ( count > 0 & count ~= 2 ) 98 | error('Invalid size specification line.') 99 | end 100 | end 101 | rows = sizeinfo(1); 102 | cols = sizeinfo(2); 103 | entries = rows*cols; 104 | end 105 | 106 | fclose(mmfile); 107 | % Done. 108 | 109 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/mmwrite.m: -------------------------------------------------------------------------------- 1 | function [ err ] = mmwrite(filename,A,comment,field,precision) 2 | % 3 | % Function: mmwrite(filename,A,comment,field,precision) 4 | % 5 | % Writes the sparse or dense matrix A to a Matrix Market (MM) 6 | % formatted file. 7 | % 8 | % Required arguments: 9 | % 10 | % filename - destination file 11 | % 12 | % A - sparse or full matrix 13 | % 14 | % Optional arguments: 15 | % 16 | % comment - matrix of comments to prepend to 17 | % the MM file. To build a comment matrix, 18 | % use str2mat. For example: 19 | % 20 | % comment = str2mat(' Comment 1' ,... 21 | % ' Comment 2',... 22 | % ' and so on.',... 23 | % ' to attach a date:',... 24 | % [' ',date]); 25 | % If ommitted, a single line date stamp comment 26 | % will be included. 27 | % 28 | % field - 'real' 29 | % 'complex' 30 | % 'integer' 31 | % 'pattern' 32 | % If ommitted, data will determine type. 33 | % 34 | % precision - number of digits to display for real 35 | % or complex values 36 | % If ommitted, full working precision is used. 37 | % 38 | 39 | if ( nargin == 5) 40 | precision = 16; 41 | elseif ( nargin == 4) 42 | precision = 16; 43 | elseif ( nargin == 3) 44 | mattype = 'real'; % placeholder, will check after FIND-ing A 45 | precision = 16; 46 | elseif ( nargin == 2) 47 | comment = ''; 48 | % Check whether there is an imaginary part: 49 | mattype = 'real'; % placeholder, will check after FIND-ing A 50 | precision = 16; 51 | end 52 | 53 | mmfile = fopen([filename],'w'); 54 | if ( mmfile == -1 ) 55 | error('Cannot open file for output'); 56 | end; 57 | 58 | 59 | [M,N] = size(A); 60 | 61 | %%%%%%%%%%%%% This part for sparse matrices %%%%%%%%%%%%%%%% 62 | if ( issparse(A) ) 63 | 64 | [I,J,V] = find(A); 65 | if ( sum(abs(imag(nonzeros(V)))) > 0 ) 66 | Vreal = 0; 67 | else 68 | Vreal = 1; 69 | end 70 | 71 | if ( ~ strcmp(mattype,'pattern') & Vreal ) 72 | mattype = 'real'; 73 | elseif ( ~ strcmp(mattype,'pattern') ) 74 | mattype = 'complex'; 75 | end 76 | % 77 | % Determine symmetry: 78 | % 79 | if ( M ~= N ) 80 | symm = 'general'; 81 | issymm = 0; 82 | NZ = length(V); 83 | else 84 | issymm = 1; 85 | NZ = length(V); 86 | for i=1:NZ 87 | if ( A(J(i),I(i)) ~= V(i) ) 88 | issymm = 0; 89 | break; 90 | end 91 | end 92 | if ( issymm ) 93 | symm = 'symmetric'; 94 | ATEMP = tril(A); 95 | [I,J,V] = find(ATEMP); 96 | NZ = nnz(ATEMP); 97 | else 98 | isskew = 1; 99 | for i=1:NZ 100 | if ( A(J(i),I(i)) ~= - V(i) ) 101 | isskew = 0; 102 | break; 103 | end 104 | end 105 | if ( isskew ) 106 | symm = 'skew-symmetric'; 107 | ATEMP = tril(A); 108 | [I,J,V] = find(ATEMP); 109 | NZ = nnz(ATEMP); 110 | elseif ( strcmp(mattype,'complex') ) 111 | isherm = 1; 112 | for i=1:NZ 113 | if ( A(J(i),I(i)) ~= conj(V(i)) ) 114 | isherm = 0; 115 | break; 116 | end 117 | end 118 | if ( isherm ) 119 | symm = 'hermitian'; 120 | ATEMP = tril(A); 121 | [I,J,V] = find(ATEMP); 122 | NZ = nnz(ATEMP); 123 | else 124 | symm = 'general'; 125 | NZ = nnz(A); 126 | end 127 | else 128 | symm = 'general'; 129 | NZ = nnz(A); 130 | end 131 | end 132 | end 133 | 134 | % Sparse coordinate format: 135 | 136 | rep = 'coordinate'; 137 | 138 | 139 | fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm); 140 | [MC,NC] = size(comment); 141 | if ( MC == 0 ) 142 | fprintf(mmfile,'%% Generated %s\n',[date]); 143 | else 144 | for i=1:MC, 145 | fprintf(mmfile,'%%%s\n',comment(i,:)); 146 | end 147 | end 148 | fprintf(mmfile,'%d %d %d\n',M,N,NZ); 149 | cplxformat = sprintf('%%d %%d %% .%dg %% .%dg\n',precision,precision); 150 | realformat = sprintf('%%d %%d %% .%dg\n',precision); 151 | if ( strcmp(mattype,'real') ) 152 | for i=1:NZ 153 | fprintf(mmfile,realformat,I(i),J(i),V(i)); 154 | end; 155 | elseif ( strcmp(mattype,'complex') ) 156 | for i=1:NZ 157 | fprintf(mmfile,cplxformat,I(i),J(i),real(V(i)),imag(V(i))); 158 | end; 159 | elseif ( strcmp(mattype,'pattern') ) 160 | for i=1:NZ 161 | fprintf(mmfile,'%d %d\n',I(i),J(i)); 162 | end; 163 | else 164 | err = -1; 165 | disp('Unsupported mattype:') 166 | mattype 167 | end; 168 | 169 | %%%%%%%%%%%%% This part for dense matrices %%%%%%%%%%%%%%%% 170 | else 171 | if ( sum(abs(imag(nonzeros(A)))) > 0 ) 172 | Areal = 0; 173 | else 174 | Areal = 1; 175 | end 176 | if ( ~strcmp(mattype,'pattern') & Areal ) 177 | mattype = 'real'; 178 | elseif ( ~strcmp(mattype,'pattern') ) 179 | mattype = 'complex'; 180 | end 181 | % 182 | % Determine symmetry: 183 | % 184 | if ( M ~= N ) 185 | issymm = 0; 186 | symm = 'general'; 187 | else 188 | issymm = 1; 189 | for j=1:N 190 | for i=j+1:N 191 | if (A(i,j) ~= A(j,i) ) 192 | issymm = 0; 193 | break; 194 | end 195 | end 196 | if ( ~ issymm ) break; end 197 | 198 | end 199 | if ( issymm ) 200 | symm = 'symmetric'; 201 | else 202 | isskew = 1; 203 | for j=1:N 204 | for i=j+1:N 205 | if (A(i,j) ~= - A(j,i) ) 206 | isskew = 0; 207 | break; 208 | end 209 | end 210 | if ( ~ isskew ) break; end 211 | end 212 | if ( isskew ) 213 | symm = 'skew-symmetric'; 214 | elseif ( strcmp(mattype,'complex') ) 215 | isherm = 1; 216 | for j=1:N 217 | for i=j+1:N 218 | if (A(i,j) ~= conj(A(j,i)) ) 219 | isherm = 0; 220 | break; 221 | end 222 | end 223 | if ( ~ isherm ) break; end 224 | end 225 | if ( isherm ) 226 | symm = 'hermitian'; 227 | else 228 | symm = 'general'; 229 | end 230 | else 231 | symm = 'general'; 232 | end 233 | end 234 | end 235 | 236 | % Dense array format: 237 | 238 | rep = 'array'; 239 | [MC,NC] = size(comment); 240 | fprintf(mmfile,'%%%%MatrixMarket mtx %s %s %s\n',rep,mattype,symm); 241 | for i=1:MC, 242 | fprintf(mmfile,'%%%s\n',comment(i,:)); 243 | end; 244 | fprintf(mmfile,'%d %d\n',M,N); 245 | cplxformat = sprintf('%% .%dg %% .%dg\n', precision,precision); 246 | realformat = sprintf('%% .%dg\n', precision); 247 | if ( ~ strcmp(symm,'general') ) 248 | rowloop = 'j'; 249 | else 250 | rowloop = '1'; 251 | end 252 | if ( strcmp(mattype,'real') ) 253 | for j=1:N 254 | for i=eval(rowloop):M 255 | fprintf(mmfile,realformat,A(i,j)); 256 | end 257 | end 258 | elseif ( strcmp(mattype,'complex') ) 259 | for j=1:N 260 | for i=eval(rowloop):M 261 | fprintf(mmfile,cplxformat,real(A(i,j)),imag(A(i,j))); 262 | end 263 | end 264 | elseif ( strcmp(mattype,'pattern') ) 265 | err = -2 266 | disp('Pattern type inconsistant with dense matrix') 267 | else 268 | err = -2 269 | disp('Unknown matrix type:') 270 | mattype 271 | end 272 | end 273 | 274 | fclose(mmfile); 275 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/pythag.m: -------------------------------------------------------------------------------- 1 | function x = pythag(y,z) 2 | %PYTHAG Computes sqrt( y^2 + z^2 ). 3 | % 4 | % x = pythag(y,z) 5 | % 6 | % Returns sqrt(y^2 + z^2) but is careful to scale to avoid overflow. 7 | 8 | % Christian H. Bischof, Argonne National Laboratory, 03/31/89. 9 | 10 | [m n] = size(y); 11 | if m>1 | n>1 12 | y = y(:); z=z(:); 13 | rmax = max(abs([y';z']))'; 14 | id=find(rmax==0); 15 | if length(id)>0 16 | rmax(id) = 1; 17 | x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); 18 | x(id)=0; 19 | else 20 | x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); 21 | end 22 | x = reshape(x,m,n); 23 | else 24 | rmax = max(abs([y;z])); 25 | if (rmax==0) 26 | x = 0; 27 | else 28 | x = rmax*sqrt((y/rmax)^2 + (z/rmax)^2); 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/refinebounds.m: -------------------------------------------------------------------------------- 1 | function [bnd,gap] = refinebounds(D,bnd,tol1) 2 | %REFINEBONDS Refines error bounds for Ritz values based on gap-structure 3 | % 4 | % bnd = refinebounds(lambda,bnd,tol1) 5 | % 6 | % Treat eigenvalues closer than tol1 as a cluster. 7 | 8 | % Rasmus Munk Larsen, DAIMI, 1998 9 | 10 | j = length(D); 11 | 12 | if j<=1 13 | return 14 | end 15 | % Sort eigenvalues to use interlacing theorem correctly 16 | [D,PERM] = sort(D); 17 | bnd = bnd(PERM); 18 | 19 | 20 | % Massage error bounds for very close Ritz values 21 | eps34 = sqrt(eps*sqrt(eps)); 22 | [y,mid] = max(bnd); 23 | for l=[-1,1] 24 | for i=((j+1)-l*(j-1))/2:l:mid-l 25 | if abs(D(i+l)-D(i)) < eps34*abs(D(i)) 26 | if bnd(i)>tol1 & bnd(i+l)>tol1 27 | bnd(i+l) = pythag(bnd(i),bnd(i+l)); 28 | bnd(i) = 0; 29 | end 30 | end 31 | end 32 | end 33 | % Refine error bounds 34 | gap = inf*ones(1,j); 35 | gap(1:j-1) = min([gap(1:j-1);[D(2:j)-bnd(2:j)-D(1:j-1)]']); 36 | gap(2:j) = min([gap(2:j);[D(2:j)-D(1:j-1)-bnd(1:j-1)]']); 37 | gap = gap(:); 38 | I = find(gap>bnd); 39 | bnd(I) = bnd(I).*(bnd(I)./gap(I)); 40 | 41 | bnd(PERM) = bnd; -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.f: -------------------------------------------------------------------------------- 1 | subroutine reorth(n,k,V,ldv,vnew,normv,index,alpha,work, 2 | c iflag,nre) 3 | c 4 | c FORTRAN 77 version of MATLAB routine REORTH: 5 | c 6 | c REORTH Reorthogonalize a vector using iterated Gram-Schmidt 7 | c 8 | c [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) 9 | c reorthogonalizes R against the subset of columns of Q given by INDEX. 10 | c If INDEX==[] then R is reorthogonalized all columns of Q. 11 | c If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, 12 | c then a second reorthogonalization is performed. If the norm of R_NEW 13 | c is once more decreased by more than a factor of ALPHA then R is 14 | c numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. 15 | c 16 | c If method==0 then iterated modified Gram-Schmidt is used. 17 | c If method==1 then iterated classical Gram-Schmidt is used. 18 | c 19 | c The default value for ALPHA is 0.5. 20 | c NRE is the number of reorthogonalizations performed (1 or 2). 21 | 22 | c References: 23 | c Aake Bjorck, "Numerical Methods for Least Squares Problems", 24 | c SIAM, Philadelphia, 1996, pp. 68-69. 25 | c 26 | c J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, 27 | c ``Reorthogonalization and Stable Algorithms Updating the 28 | c Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. 29 | c 136, pp. 772-795. 30 | c 31 | c B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 32 | c Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 33 | 34 | c Rasmus Munk Larsen, DAIMI, 1998. 35 | implicit none 36 | integer n,k,ldv,i,iflag,nre 37 | double precision V(ldv,*),vnew(*),normv,index(*),work(*) 38 | double precision alpha,normv_old,dnrm2 39 | integer MAXTRY 40 | parameter (MAXTRY=4) 41 | external dgemv,dnrm2 42 | 43 | c Hack: If index .ne. 1:k we do MGS to avoid reshuffling. 44 | if (iflag.eq.1) then 45 | do i=1,k 46 | if (int(index(i)).ne.i) then 47 | iflag=0 48 | goto 100 49 | endif 50 | enddo 51 | endif 52 | 100 normv_old = 0 53 | nre = 0 54 | normv = dnrm2(n,vnew,1) 55 | do while ((normv.lt.alpha*normv_old .or. nre.eq.0)) 56 | if (iflag.eq.1) then 57 | c CGS: 58 | call dgemv('T',n,k,1D0,V,ldv,vnew,1,0D0,work,1) 59 | call dgemv('N',n,k,-1D0,V,ldv,work,1,1D0,vnew,1) 60 | else 61 | c MGS: 62 | call MGS(n,k,V,ldv,vnew,index) 63 | endif 64 | normv_old = normv 65 | normv = dnrm2(n,vnew,1) 66 | nre = nre + 1 67 | 68 | if ( nre.gt.MAXTRY ) then 69 | c 70 | c vnew is numerically in span(V) => return vnew = (0,0,...,0)^T 71 | normv = 0d0 72 | do i=1,n 73 | vnew(i) = 0d0 74 | enddo 75 | return 76 | endif 77 | enddo 78 | end 79 | c 80 | c**************************************************************************** 81 | c 82 | 83 | subroutine MGS(n,k,V,ldv,vnew,index) 84 | implicit none 85 | integer n,k,ldv 86 | double precision V(ldv,*),vnew(*),index(*) 87 | integer i,j,idx 88 | double precision s 89 | 90 | c 91 | c Modified Gram-Schmidt orthogonalization: 92 | c Orthogalizes vnew against the k vectors in V by the 93 | c iterative process 94 | c 95 | c FOR i=1...k DO 96 | c vnew = vnew - DOT( V(:,i), vnew ) * V(:,i) 97 | c 98 | 99 | c This simple version is faster on Pentium machines. 100 | c Compile with "g77 -O6 -funroll-all-loops -fomit-frame-pointer" 101 | 102 | do i=1,k 103 | idx = int(index(i)) 104 | s = 0 105 | do j=1,n 106 | s = s + V(j,idx)*vnew(j) 107 | enddo 108 | do j=1,n 109 | vnew(j) = vnew(j) - s*V(j,idx) 110 | enddo 111 | enddo 112 | end 113 | c 114 | c**************************************************************************** 115 | c 116 | 117 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.m: -------------------------------------------------------------------------------- 1 | function [r,normr,nre,s] = reorth(Q,r,normr,index,alpha,method) 2 | 3 | %REORTH Reorthogonalize a vector using iterated Gram-Schmidt 4 | % 5 | % [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) 6 | % reorthogonalizes R against the subset of columns of Q given by INDEX. 7 | % If INDEX==[] then R is reorthogonalized all columns of Q. 8 | % If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, 9 | % then a second reorthogonalization is performed. If the norm of R_NEW 10 | % is once more decreased by more than a factor of ALPHA then R is 11 | % numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. 12 | % 13 | % If method==0 then iterated modified Gram-Schmidt is used. 14 | % If method==1 then iterated classical Gram-Schmidt is used. 15 | % 16 | % The default value for ALPHA is 0.5. 17 | % NRE is the number of reorthogonalizations performed (1 or 2). 18 | 19 | % References: 20 | % Aake Bjorck, "Numerical Methods for Least Squares Problems", 21 | % SIAM, Philadelphia, 1996, pp. 68-69. 22 | % 23 | % J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, 24 | % ``Reorthogonalization and Stable Algorithms Updating the 25 | % Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. 26 | % 136, pp. 772-795. 27 | % 28 | % B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 29 | % Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 30 | 31 | % Rasmus Munk Larsen, DAIMI, 1998. 32 | 33 | % Check input arguments. 34 | % warning('PROPACK:NotUsingMex','Using slow matlab code for reorth.') 35 | if nargin<2 36 | error('Not enough input arguments.') 37 | end 38 | [n k1] = size(Q); 39 | if nargin<3 | isempty(normr) 40 | % normr = norm(r); 41 | normr = sqrt(r'*r); 42 | end 43 | if nargin<4 | isempty(index) 44 | k=k1; 45 | index = [1:k]'; 46 | simple = 1; 47 | else 48 | k = length(index); 49 | if k==k1 & index(:)==[1:k]' 50 | simple = 1; 51 | else 52 | simple = 0; 53 | end 54 | end 55 | if nargin<5 | isempty(alpha) 56 | alpha=0.5; % This choice garanties that 57 | % || Q^T*r_new - e_{k+1} ||_2 <= 2*eps*||r_new||_2, 58 | % cf. Kahans ``twice is enough'' statement proved in 59 | % Parletts book. 60 | end 61 | if nargin<6 | isempty(method) 62 | method = 0; 63 | end 64 | if k==0 | n==0 65 | return 66 | end 67 | if nargout>3 68 | s = zeros(k,1); 69 | end 70 | 71 | 72 | normr_old = 0; 73 | nre = 0; 74 | while normr < alpha*normr_old | nre==0 75 | if method==1 76 | if simple 77 | t = Q'*r; 78 | r = r - Q*t; 79 | else 80 | t = Q(:,index)'*r; 81 | r = r - Q(:,index)*t; 82 | end 83 | else 84 | for i=index, 85 | t = Q(:,i)'*r; 86 | r = r - Q(:,i)*t; 87 | end 88 | end 89 | if nargout>3 90 | s = s + t; 91 | end 92 | normr_old = normr; 93 | % normr = norm(r); 94 | normr = sqrt(r'*r); 95 | nre = nre + 1; 96 | if nre > 4 97 | % r is in span(Q) to full accuracy => accept r = 0 as the new vector. 98 | r = zeros(n,1); 99 | normr = 0; 100 | return 101 | end 102 | end 103 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexglx -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsg -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsg64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsg64 -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth.mexsol -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/reorth_mex.c: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | GATEWAY ROUTINE FOR CALLING REORTH FROM MATLAB. 4 | 5 | REORTH Reorthogonalize a vector using iterated Gram-Schmidt 6 | 7 | [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) 8 | reorthogonalizes R against the subset of columns of Q given by INDEX. 9 | If INDEX==[] then R is reorthogonalized all columns of Q. 10 | If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, 11 | then a second reorthogonalization is performed. If the norm of R_NEW 12 | is once more decreased by more than a factor of ALPHA then R is 13 | numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. 14 | 15 | If method==0 then iterated modified Gram-Schmidt is used. 16 | If method==1 then iterated classical Gram-Schmidt is used. 17 | 18 | The default value for ALPHA is 0.5. 19 | NRE is the number of reorthogonalizations performed (1 or 2). 20 | 21 | References: 22 | Aake Bjorck, "Numerical Methods for Least Squares Problems", 23 | SIAM, Philadelphia, 1996, pp. 68-69. 24 | 25 | J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, 26 | ``Reorthogonalization and Stable Algorithms Updating the 27 | Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. 28 | 136, pp. 772-795. 29 | 30 | B. N. Parlett, ``The Symmetric Eigenvalue Problem'', 31 | Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 32 | 33 | Rasmus Munk Larsen, DAIMI, 1998. 34 | ------------------------------------------------------------------------- 35 | */ 36 | 37 | #include 38 | #include "mex.h" 39 | 40 | /* Template for reorth: */ 41 | 42 | void reorth_(int *n, int *k, double *V, int *ldv, double *vnew, 43 | double *normvnew, double *index, double *alpha, double *work, 44 | int *iflag, int *nre); 45 | 46 | /* Here comes the gateway function to be called by Matlab: */ 47 | void mexFunction(int nlhs, mxArray *plhs[], 48 | int nrhs, const mxArray *prhs[]) 49 | { 50 | int n, k1, k, imethod, inre; 51 | double *work; 52 | 53 | if (nrhs != 6) 54 | mexErrMsgTxt("reorth requires 6 input arguments"); 55 | else if (nlhs < 2) 56 | mexErrMsgTxt("reorth requires at least 2 output arguments"); 57 | 58 | n = mxGetM(prhs[0]); /* get the dimensions of the input */ 59 | k1 = mxGetN(prhs[0]); 60 | k = mxGetM(prhs[3]) * mxGetN(prhs[3]); 61 | 62 | /* Create/allocate return argument, a 1x1 real-valued Matrix */ 63 | plhs[0]=mxCreateDoubleMatrix(n,1,mxREAL); 64 | plhs[1]=mxCreateDoubleMatrix(1,1,mxREAL); 65 | if (nlhs>2) 66 | plhs[2]=mxCreateDoubleMatrix(1,1,mxREAL); 67 | 68 | work = mxCalloc(k,sizeof(double)); 69 | 70 | memcpy(mxGetPr(plhs[0]),mxGetPr(prhs[1]), n*sizeof(double)); 71 | memcpy(mxGetPr(plhs[1]),mxGetPr(prhs[2]), sizeof(double)); 72 | imethod = (int) mxGetScalar(prhs[5]); 73 | 74 | reorth_(&n, &k, mxGetPr(prhs[0]), &n, mxGetPr(plhs[0]), 75 | mxGetPr(plhs[1]), mxGetPr(prhs[3]), mxGetPr(prhs[4]), 76 | work,&imethod,&inre); 77 | if (nlhs>2) 78 | *(mxGetPr(plhs[2])) = (double) inre*k; 79 | 80 | mxFree(work); 81 | } 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/testtqlb.m: -------------------------------------------------------------------------------- 1 | % Script for comparing speed an accuracy of original TQLB, optimized TQLB 2 | % and builtin EIG command. 3 | 4 | % Rasmus Munk Larsen, DAIMI, 1998. 5 | 6 | n=1000; 7 | 8 | % Use 2. order difference matrix as testproblem. 9 | e = ones(n,1); 10 | T = spdiags([-e 2*e -e], -1:1, n, n); 11 | true = 4*cos(pi/2*[n:-1:1]'./(n+1)).^2; 12 | alpha = 2*ones(n,1); 13 | beta = -ones(n,1); 14 | 15 | fprintf('-----------------------------------------------------------------\n') 16 | disp('Modified tqlb:') 17 | fprintf('\n') 18 | tic, flops(0) 19 | [lambda,top,bot,err] = tqlb(alpha,beta); 20 | fprintf('Elapsed time = %f\n',toc); 21 | fprintf('Number of flops = %f\n',flops); 22 | fprintf('Max rel. error = %e\n',max(abs((lambda-true)./true))) 23 | 24 | 25 | fprintf('-----------------------------------------------------------------\n') 26 | disp('Original tqlb:') 27 | fprintf('\n') 28 | tic, flops(0); 29 | [lambda2,top,bot,err2] = tqlb_orig(alpha,beta); 30 | fprintf('Elapsed time = %f\n',toc); 31 | fprintf('Number of flops = %f\n',flops); 32 | fprintf('Max rel. error = %e\n',max(abs((lambda2-true)./true))) 33 | 34 | 35 | fprintf('-----------------------------------------------------------------\n') 36 | disp('eig:') 37 | fprintf('\n') 38 | tic, flops(0); 39 | lambda1 = eig(T); 40 | lambda1 =sort(lambda1); 41 | fprintf('Elapsed time = %f\n',toc); 42 | fprintf('Number of flops = %f\n',flops); 43 | fprintf('Max rel. error = %e\n',max(abs((lambda1-true)./true))) 44 | 45 | fprintf('-----------------------------------------------------------------\n') 46 | disp('eig:') 47 | fprintf('\n') 48 | tic, flops(0); 49 | lambda1 = eig(full(T)); 50 | lambda1 =sort(lambda1); 51 | fprintf('Elapsed time = %f\n',toc); 52 | fprintf('Number of flops = %f\n',flops); 53 | fprintf('Max rel. error = %e\n',max(abs((lambda1-true)./true))) 54 | 55 | 56 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.f: -------------------------------------------------------------------------------- 1 | C 2 | C @(#)TQLB.F 1.1 (BNP) 5/9/89 3 | C 4 | SUBROUTINE TQLB(N,D,E,BND,BND2,IERR) 5 | C 6 | INTEGER I,J,L,M,N,II,L1,L2,MML,IERR 7 | DOUBLE PRECISION D(N),E(N),BND(N),BND2(N) 8 | DOUBLE PRECISION C,C2,C3,DL1,EL1,F,G,H,H1,P,R,S,S2,TST1,TST2 9 | C 10 | C THIS SUBROUTINE IS A MODIFICATION OF THE ALGOL PROCEDURE TQL1, 11 | C NUM. MATH. 11, 293-306(1968) BY BOWDLER, MARTIN, REINSCH, AND 12 | C WILKINSON. 13 | C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 227-240(1971). 14 | C 15 | C THIS SUBROUTINE FINDS THE EIGENVALUES OF A SYMMETRIC 16 | C TRIDIAGONAL MATRIX BY THE QL METHOD. 17 | C 18 | C ON INPUT 19 | C 20 | C N IS THE ORDER OF THE MATRIX. 21 | C 22 | C D CONTAINS THE DIAGONAL ELEMENTS OF THE INPUT MATRIX. 23 | C 24 | C E CONTAINS THE SUBDIAGONAL ELEMENTS OF THE INPUT MATRIX 25 | C IN ITS LAST N-1 POSITIONS. E(1) IS ARBITRARY. 26 | C 27 | C ON OUTPUT 28 | C 29 | C D CONTAINS THE EIGENVALUES IN ASCENDING ORDER. IF AN 30 | C ERROR EXIT IS MADE, THE EIGENVALUES ARE CORRECT AND 31 | C ORDERED FOR INDICES 1,2,...IERR-1, BUT MAY NOT BE 32 | C THE SMALLEST EIGENVALUES. 33 | C 34 | C E HAS BEEN DESTROYED. 35 | C 36 | C BND WILL HOLD THE TOP ELEMENTS OF THE NORMALIZED EIGENVECTORS. 37 | C 38 | C IERR IS SET TO 39 | C ZERO FOR NORMAL RETURN, 40 | C J IF THE J-TH EIGENVALUE HAS NOT BEEN 41 | C DETERMINED AFTER 30 ITERATIONS. 42 | C 43 | C calls to PYTHAG for SQRT(A*A + B*B) have been replaced by inline code. 44 | C 45 | C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, 46 | C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY 47 | C 48 | C THIS VERSION DATED AUGUST 1983 (AUGUST 1998). 49 | C 50 | C ------------------------------------------------------------------ 51 | C 52 | IERR = 0 53 | BND(1) = 1.0D0 54 | IF (N .EQ. 1) GO TO 1001 55 | BND2(N) = 1.0D0 56 | C 57 | DO 100 I = 2, N 58 | BND(I) = 0.0D0 59 | BND2(I-1) = 0.0D0 60 | 100 E(I-1) = E(I) 61 | C 62 | F = 0.0D0 63 | TST1 = 0.0D0 64 | E(N) = 0.0D0 65 | C 66 | DO 290 L = 1, N 67 | J = 0 68 | H = ABS(D(L)) + ABS(E(L)) 69 | IF (TST1 .LT. H) TST1 = H 70 | C .......... LOOK FOR SMALL SUB-DIAGONAL ELEMENT .......... 71 | DO 110 M = L, N 72 | TST2 = TST1 + ABS(E(M)) 73 | IF (TST2 .EQ. TST1) GO TO 120 74 | C .......... E(N) IS ALWAYS ZERO, SO THERE IS NO EXIT 75 | C THROUGH THE BOTTOM OF THE LOOP .......... 76 | 110 CONTINUE 77 | C 78 | 120 IF (M .EQ. L) GO TO 210 79 | 130 IF (J .EQ. 30) GO TO 1000 80 | J = J + 1 81 | C .......... FORM SHIFT .......... 82 | L1 = L + 1 83 | L2 = L1 + 1 84 | G = D(L) 85 | P = (D(L1) - G) / (2.0D0 * E(L)) 86 | if (abs(p).le.1.0e0) then 87 | p = p + sign(sqrt(1.0e0 + p*p),p) 88 | else 89 | p = p * (1.0e0 + sqrt(1.0e0 + (1.0e0/p)**2)) 90 | endif 91 | d(l) = e(l) / p 92 | d(l1) = e(l) * p 93 | c********** Original code: ******************** 94 | c R = PYTHAG(P,1.0D0) 95 | c D(L) = E(L) / (P + SIGN(R,P)) 96 | c D(L1) = E(L) * (P + SIGN(R,P)) 97 | c********************************************* 98 | DL1 = D(L1) 99 | H = G - D(L) 100 | IF (L2 .GT. N) GO TO 145 101 | C 102 | DO 140 I = L2, N 103 | 140 D(I) = D(I) - H 104 | C 105 | 145 F = F + H 106 | C .......... QL TRANSFORMATION .......... 107 | P = D(M) 108 | C = 1.0D0 109 | C2 = C 110 | EL1 = E(L1) 111 | S = 0.0D0 112 | MML = M - L 113 | C .......... FOR I=M-1 STEP -1 UNTIL L DO -- .......... 114 | DO 200 II = 1, MML 115 | C3 = C2 116 | C2 = C 117 | S2 = S 118 | I = M - II 119 | G = C * E(I) 120 | H = C * P 121 | c inlined call to PYTHAG. This code corresponds to LAPACK rutine DLAPY2. 122 | c Speeds tqlb up by a factor of 3 on MIPS R10000. 123 | IF(DABS(P).GE.DABS(E(I))) then 124 | S=E(I)/P 125 | R=SQRT(1D0+S*S) 126 | E(I+1)=S2*P*R 127 | C=1D0/R 128 | S=S*C 129 | else 130 | C=P/E(I) 131 | R=SQRT(1D0+C*C) 132 | E(I+1)=S2*E(I)*R 133 | S=1D0/R 134 | C=C*S 135 | endif 136 | P = C * D(I) - S * G 137 | D(I+1) = H + S * (C * G + S * D(I)) 138 | H = BND(I+1) 139 | BND(I+1) = S*BND(I)+C*H 140 | BND(I) = C*BND(I)-S*H 141 | H = BND2(I+1) 142 | BND2(I+1) = S*BND2(I)+C*H 143 | BND2(I) = C*BND2(I)-S*H 144 | 200 CONTINUE 145 | C 146 | P = -S * S2 * C3 * EL1 * E(L) / DL1 147 | E(L) = S * P 148 | D(L) = C * P 149 | TST2 = TST1 + ABS(E(L)) 150 | IF (TST2 .GT. TST1) GO TO 130 151 | 210 P = D(L) + F 152 | H = BND(L) 153 | H1 = BND2(L) 154 | C .......... ORDER EIGENVALUES .......... 155 | IF (L .EQ. 1) GO TO 250 156 | C .......... FOR I=L STEP -1 UNTIL 2 DO -- .......... 157 | DO 230 II = 2, L 158 | I = L + 2 - II 159 | IF (P .GE. D(I-1)) GO TO 270 160 | D(I) = D(I-1) 161 | BND(I) = BND(I-1) 162 | BND2(I) = BND2(I-1) 163 | 230 CONTINUE 164 | C 165 | 250 I = 1 166 | 270 D(I) = P 167 | BND(I) = H 168 | BND2(I)= H1 169 | 290 CONTINUE 170 | C 171 | GO TO 1001 172 | C .......... SET ERROR -- NO CONVERGENCE TO AN 173 | C EIGENVALUE AFTER 30 ITERATIONS .......... 174 | 1000 IERR = L 175 | 1001 RETURN 176 | END 177 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.m: -------------------------------------------------------------------------------- 1 | function [lambda,top,bot,err] = tqlb(alpha,beta) 2 | 3 | % TQLB: Compute eigenvalues and top and bottom elements of 4 | % eigenvectors of a symmetric tridiagonal matrix T. 5 | % 6 | % [lambda,top,bot,err] = tqlb(alpha,beta) 7 | % 8 | % Input parameters: 9 | % alpha(1:n) : Diagonal elements. 10 | % beta(2:n) : Off-diagonal elements. 11 | % Output parameters: 12 | % lambda(1:n) : Computed eigenvalues. 13 | % top(1:n) : Top elements in eigenvectors. 14 | % bot(1:n) : Bottom elements in eigenvectors. 15 | % err : dummy argument. 16 | 17 | 18 | % Rasmus Munk Larsen, DAIMI, 1998 19 | 20 | 21 | % 22 | % This is a slow Matlab substitute for the 23 | % TQLB MEX-file. 24 | % 25 | 26 | warning('PROPACK:NotUsingMex','Using slow matlab code for tqlb.') 27 | n = length(alpha); 28 | T = spdiags([[beta(2:n);0] alpha(1:n) beta(1:n)],-1:1,n,n); 29 | 30 | [V,lambda] = eig(full(T)); lambda = diag(lambda); 31 | bot = V(end,:)'; 32 | top = V(1,:)'; 33 | err=0; 34 | 35 | 36 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexglx -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsg -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsg64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsg64 -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb.mexsol -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/tqlb_mex.c: -------------------------------------------------------------------------------- 1 | /* 2 | MEX interface for TQLB. Matlab calling sequence: 3 | [lambda,top,bot,err] = tqlb(alpha,beta) 4 | */ 5 | 6 | 7 | #include 8 | #include "mex.h" 9 | 10 | /* Template for tqlb: */ 11 | void tqlb_(int *n, double *d__, double *e, double *bnd, 12 | double *bnd2, int *ierr); 13 | 14 | /* Here comes the gateway function to be called by Matlab: */ 15 | void mexFunction(int nlhs, mxArray *plhs[], 16 | int nrhs, const mxArray *prhs[]) 17 | { 18 | int m, n,i, ierr; 19 | double x, *tmp; 20 | 21 | if (nrhs != 2) 22 | mexErrMsgTxt("tqlb requires two input arguments"); 23 | else if (nlhs != 4) 24 | mexErrMsgTxt("tqlb requires four output arguments"); 25 | 26 | for (i=0; i<2; i++) { 27 | m = mxGetM(prhs[i]); /* get the dimensions of the input */ 28 | n = mxGetN(prhs[i]); 29 | 30 | /* make sure input is m x 1 */ 31 | if (n != 1) 32 | mexErrMsgTxt("Input must be a m x 1 vectors"); 33 | } 34 | 35 | /* Create/allocate return argument, a 1x1 real-valued Matrix */ 36 | for (i=0; i<3; i++) { 37 | plhs[i]=mxCreateDoubleMatrix(m,1,mxREAL); 38 | } 39 | plhs[3] = mxCreateDoubleMatrix(1,1,mxREAL); 40 | tmp = mxCalloc(m,sizeof(double)); 41 | 42 | memcpy(mxGetPr(plhs[0]), mxGetPr(prhs[0]),m*sizeof(double)); 43 | memcpy(tmp,mxGetPr(prhs[1]), m*sizeof(double)); 44 | tqlb_(&m,mxGetPr(plhs[0]),tmp,mxGetPr(plhs[1]), 45 | mxGetPr(plhs[2]),&ierr); 46 | 47 | *(mxGetPr(plhs[3])) = (double) ierr; 48 | mxFree(tmp); 49 | } 50 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK/update_gbound.m: -------------------------------------------------------------------------------- 1 | function anorm = update_gbound(anorm,alpha,beta,j) 2 | %UPDATE_GBOUND Update Gerscgorin estimate of 2-norm 3 | % ANORM = UPDATE_GBOUND(ANORM,ALPHA,BETA,J) updates the Gersgorin bound 4 | % for the tridiagonal in the Lanczos process after the J'th step. 5 | % Applies Gerscgorins circles to T_K'*T_k instead of T_k itself 6 | % since this gives a tighter bound. 7 | 8 | if j==1 % Apply Gerscgorin circles to T_k'*T_k to estimate || A ||_2 9 | i=j; 10 | % scale to avoid overflow 11 | scale = max(abs(alpha(i)),abs(beta(i+1))); 12 | alpha(i) = alpha(i)/scale; 13 | beta(i) = beta(i)/scale; 14 | anorm = 1.01*scale*sqrt(alpha(i)^2+beta(i+1)^2 + abs(alpha(i)*beta(i+1))); 15 | elseif j==2 16 | i=1; 17 | % scale to avoid overflow 18 | scale = max(max(abs(alpha(1:2)),max(abs(beta(2:3))))); 19 | alpha(1:2) = alpha(1:2)/scale; 20 | beta(2:3) = beta(2:3)/scale; 21 | 22 | anorm = max(anorm, scale*sqrt(alpha(i)^2+beta(i+1)^2 + ... 23 | abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... 24 | abs(beta(i+1)*beta(i+2)))); 25 | i=2; 26 | anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... 27 | beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... 28 | abs(alpha(i)*beta(i+1))) ); 29 | elseif j==3 30 | % scale to avoid overflow 31 | scale = max(max(abs(alpha(1:3)),max(abs(beta(2:4))))); 32 | alpha(1:3) = alpha(1:3)/scale; 33 | beta(2:4) = beta(2:4)/scale; 34 | i=2; 35 | anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... 36 | beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... 37 | abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... 38 | abs(beta(i+1)*beta(i+2))) ); 39 | i=3; 40 | anorm = max(anorm,scale*sqrt(abs(beta(i)*beta(i-1)) + ... 41 | abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... 42 | beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... 43 | abs(alpha(i)*beta(i+1))) ); 44 | else 45 | % scale to avoid overflow 46 | % scale = max(max(abs(alpha(j-2:j)),max(abs(beta(j-2:j+1))))); 47 | % alpha(j-2:j) = alpha(j-2:j)/scale; 48 | % beta(j-2:j+1) = beta(j-2:j+1)/scale; 49 | 50 | % Avoid scaling, which is slow. At j>3 the estimate is usually quite good 51 | % so just make sure that anorm is not made infinite by overflow. 52 | i = j-1; 53 | anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... 54 | abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... 55 | beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... 56 | abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... 57 | abs(beta(i+1)*beta(i+2))); 58 | if isfinite(anorm1) 59 | anorm = max(anorm,anorm1); 60 | end 61 | i = j; 62 | anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... 63 | abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... 64 | beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... 65 | abs(alpha(i)*beta(i+1))); 66 | if isfinite(anorm1) 67 | anorm = max(anorm,anorm1); 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/choosvd.m: -------------------------------------------------------------------------------- 1 | function y = choosvd( n, d) 2 | 3 | if n <= 100 4 | if d / n <= 0.02 5 | y = 1; 6 | else 7 | y = 0; 8 | end 9 | elseif n <= 200 10 | if d / n <= 0.06 11 | y = 1; 12 | else 13 | y = 0; 14 | end 15 | elseif n <= 300 16 | if d / n <= 0.26 17 | y = 1; 18 | else 19 | y = 0; 20 | end 21 | elseif n <= 400 22 | if d / n <= 0.28 23 | y = 1; 24 | else 25 | y = 0; 26 | end 27 | elseif n <= 500 28 | if d / n <= 0.34 29 | y = 1; 30 | else 31 | y = 0; 32 | end 33 | else 34 | if d / n <= 0.38 35 | y = 1; 36 | else 37 | y = 0; 38 | end 39 | end -------------------------------------------------------------------------------- /Code/External/RPCA/exact_alm_rpca/exact_alm_rpca/exact_alm_rpca.m: -------------------------------------------------------------------------------- 1 | function [A_hat E_hat iter] = exact_alm_rpca(D, lambda, tol, maxIter) 2 | 3 | % Oct 2009 4 | % This matlab code implements the augmented Lagrange multiplier method for 5 | % Robust PCA. 6 | % 7 | % D - m x n matrix of observations/data (required input) 8 | % 9 | % lambda - weight on sparse error term in the cost function 10 | % 11 | % tol - tolerance for stopping criterion. 12 | % - DEFAULT 1e-7 if omitted or -1. 13 | % 14 | % maxIter - maximum number of iterations 15 | % - DEFAULT 1000, if omitted or -1. 16 | % 17 | % Initialize A,E,Y,u 18 | % while ~converged 19 | % minimize 20 | % L(A,E,Y,u) = |A|_* + lambda * |E|_1 + + mu/2 * |D-A-E|_F^2; 21 | % Y = Y + \mu * (D - A - E); 22 | % \mu = \rho * \mu; 23 | % end 24 | % 25 | % Minming Chen, October 2009. Questions? v-minmch@microsoft.com ; 26 | % Arvind Ganesh (abalasu2@illinois.edu) 27 | % 28 | % Copyright: Perception and Decision Laboratory, University of Illinois, Urbana-Champaign 29 | % Microsoft Research Asia, Beijing 30 | 31 | % addpath PROPACK; 32 | % addpath(path, './RPCA/exact_alm_rpca/exact_alm_rpca/PROPACK'); 33 | % addpath('.\External\RPCA\exact_alm_rpca\exact_alm_rpca\PROPACK'); 34 | 35 | [m n] = size(D); 36 | 37 | if nargin < 2 38 | lambda = 1 / sqrt(m); 39 | end 40 | 41 | if nargin < 3 42 | tol = 1e-7; 43 | elseif tol == -1 44 | tol = 1e-7; 45 | end 46 | 47 | if nargin < 4 48 | maxIter = 1000; 49 | elseif maxIter == -1 50 | maxIter = 1000; 51 | end 52 | 53 | % initialize 54 | Y = sign(D); 55 | norm_two = lansvd(Y, 1, 'L'); 56 | norm_inf = norm( Y(:), inf) / lambda; 57 | dual_norm = max(norm_two, norm_inf); 58 | Y = Y / dual_norm; 59 | 60 | A_hat = zeros( m, n); 61 | E_hat = zeros( m, n); 62 | dnorm = norm(D, 'fro'); 63 | tolProj = 1e-6 * dnorm; 64 | total_svd = 0; 65 | %mu = .5/norm_two % this one can be tuned 66 | mu = .5; 67 | rho = 6; % this one can be tuned 68 | 69 | iter = 0; 70 | converged = false; 71 | stopCriterion = 1; 72 | sv = 5; 73 | svp = sv; 74 | while ~converged 75 | iter = iter + 1; 76 | 77 | % solve the primal problem by alternative projection 78 | primal_converged = false; 79 | primal_iter = 0; 80 | sv = sv + round(n * 0.1); 81 | while primal_converged == false 82 | 83 | temp_T = D - A_hat + (1/mu)*Y; 84 | temp_E = max( temp_T - lambda/mu,0) + min( temp_T + lambda/mu,0); 85 | 86 | if choosvd(n, sv) == 1 87 | [U S V] = lansvd(D - temp_E + (1/mu)*Y, sv, 'L'); 88 | else 89 | [U S V] = svd(D - temp_E + (1/mu)*Y, 'econ'); 90 | end 91 | diagS = diag(S); 92 | svp = length(find(diagS > 1/mu)); 93 | if svp < sv 94 | sv = min(svp + 1, n); 95 | else 96 | sv = min(svp + round(0.05*n), n); 97 | end 98 | temp_A = U(:,1:svp)*diag(diagS(1:svp)-1/mu)*V(:,1:svp)'; 99 | 100 | if norm(A_hat - temp_A, 'fro') < tolProj && norm(E_hat - temp_E, 'fro') < tolProj 101 | primal_converged = true; 102 | end 103 | A_hat = temp_A; 104 | E_hat = temp_E; 105 | primal_iter = primal_iter + 1; 106 | total_svd = total_svd + 1; 107 | 108 | end 109 | 110 | Z = D - A_hat - E_hat; 111 | Y = Y + mu*Z; 112 | mu = rho * mu; 113 | 114 | %% stop Criterion 115 | stopCriterion = norm(Z, 'fro') / dnorm; 116 | if stopCriterion < tol 117 | converged = true; 118 | end 119 | 120 | % disp(['Iteration' num2str(iter) ' #svd ' num2str(total_svd) ' r(A) ' num2str(svp)... 121 | % ' |E|_0 ' num2str(length(find(abs(E_hat)>0)))... 122 | % ' stopCriterion ' num2str(stopCriterion)]); 123 | 124 | if ~converged && iter >= maxIter 125 | disp('Maximum iterations reached') ; 126 | converged = 1 ; 127 | end 128 | end 129 | 130 | if nargin == 5 131 | fclose(fid); 132 | end 133 | 134 | -------------------------------------------------------------------------------- /Code/External/SLIC_mex/SLIC_mex.cpp: -------------------------------------------------------------------------------- 1 | /** A wrapper function for the SLIC superpixel oversegmentation method 2 | % 3 | % Copyright (c) 2013, Anestis Papazoglou 4 | % All rights reserved. 5 | % 6 | % Redistribution and use in source and binary forms, with or without 7 | % modification, are permitted provided that the following conditions are 8 | % met: 9 | % 10 | % 1. Redistributions of source code must retain the above copyright notice, 11 | % this list of conditions and the following disclaimer. 12 | % 2. Redistributions in binary form must reproduce the above copyright 13 | % notice, this list of conditions and the following disclaimer in the 14 | % documentation and/or other materials provided with the distribution. 15 | % 16 | % THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | % "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | % TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | % PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 20 | % OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | % EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | % PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | % PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | % LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | % NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | % SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 27 | 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | #include "SLIC.h" 37 | 38 | #define OPAQUE 0xFF0000 39 | #define SQUARE255 65025 40 | 41 | #define USAGE_NOTE "USAGE: \n" 42 | 43 | void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) 44 | { 45 | bool isRGB; 46 | unsigned char R, G, B; 47 | unsigned int height, width, pixels, pixelsX2, dimensions; 48 | int superpixelsNumber, labelsNumber; 49 | double compactness; 50 | unsigned char *image; 51 | unsigned short *output; 52 | unsigned int *aRGBimage; 53 | int *superpixels; 54 | 55 | const mxArray *imageMxArray; 56 | const mxArray *superpixelsNumberMxArray; 57 | mxArray *superpixelsMxArray; 58 | 59 | if( nrhs == 2 || nrhs == 3 ) 60 | { 61 | imageMxArray = prhs[ 0 ]; 62 | superpixelsNumberMxArray = prhs[ 1 ]; 63 | 64 | if( mxGetClassID( imageMxArray ) != mxUINT8_CLASS ) 65 | mexErrMsgTxt( USAGE_NOTE ); 66 | 67 | if( mxGetClassID( superpixelsNumberMxArray ) != mxDOUBLE_CLASS ) 68 | mexErrMsgTxt( USAGE_NOTE ); 69 | 70 | dimensions = mxGetNumberOfDimensions( imageMxArray ); 71 | 72 | if( dimensions == 3 ) 73 | { 74 | //TODO: make sure 3rd dimensions contains 3 colours 75 | isRGB = true; 76 | height = mxGetM( imageMxArray ); 77 | width = mxGetN( imageMxArray ) / 3; 78 | } 79 | else if( dimensions == 1 ) 80 | { 81 | isRGB = false; 82 | height = mxGetM( imageMxArray ); 83 | width = mxGetN( imageMxArray ); 84 | } 85 | else 86 | { 87 | mexErrMsgTxt( USAGE_NOTE ); 88 | } 89 | pixels = height * width; 90 | pixelsX2 = 2 * pixels; 91 | 92 | image = ( unsigned char * )mxGetData( imageMxArray ); 93 | superpixelsNumber = ( unsigned int )( ( double * )mxGetData( superpixelsNumberMxArray ) )[ 0 ]; 94 | 95 | if( ( superpixelsNumber < 1 ) || ( superpixelsNumber >= pixels ) ) 96 | mexErrMsgTxt( USAGE_NOTE ); 97 | 98 | if( nrhs == 3 ) 99 | { 100 | if( mxGetClassID( prhs[ 2 ] ) == mxDOUBLE_CLASS ) 101 | compactness = ( ( double * )mxGetData( prhs[ 2 ] ) )[ 0 ]; 102 | else 103 | mexErrMsgTxt( USAGE_NOTE ); 104 | } 105 | else 106 | { 107 | compactness = 20; 108 | } 109 | } 110 | else 111 | { 112 | mexErrMsgTxt( USAGE_NOTE ); 113 | } 114 | 115 | superpixelsMxArray = mxCreateNumericMatrix( height, width, mxUINT16_CLASS, mxREAL ); 116 | //superpixels = ( int * )mxGetData( superpixelsMxArray ); 117 | aRGBimage = new unsigned int[ pixels ]; 118 | 119 | for( unsigned int i = 0; i < pixels; i++ ) 120 | { 121 | R = image[ i ]; 122 | G = image[ i + pixels ]; 123 | B = image[ i + pixelsX2 ]; 124 | 125 | aRGBimage[ i ] = OPAQUE + SQUARE255 * R + 255 * G + B; 126 | } 127 | 128 | SLIC slic; 129 | 130 | slic.DoSuperpixelSegmentation_ForGivenNumberOfSuperpixels( aRGBimage, height, width, superpixels, labelsNumber, superpixelsNumber, compactness ); 131 | //mexEvalString( "pause" ); 132 | //mxSetData( superpixelsMxArray, ( void * )superpixels ); 133 | //mxSetM( superpixelsMxArray, height ); 134 | //mxSetN( superpixelsMxArray, width ); 135 | 136 | output = ( unsigned short * )mxGetData( superpixelsMxArray ); 137 | for( int i = 0; i < pixels; i++ ) 138 | { 139 | output[ i ] = ( unsigned short )( superpixels[ i ] + 1 ); 140 | } 141 | 142 | plhs[ 0 ] = superpixelsMxArray; 143 | 144 | delete [] aRGBimage; 145 | 146 | return; 147 | } 148 | 149 | -------------------------------------------------------------------------------- /Code/External/SLIC_mex/SLIC_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/SLIC_mex/SLIC_mex.mexa64 -------------------------------------------------------------------------------- /Code/External/SLIC_mex/SLIC_mex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/SLIC_mex/SLIC_mex.mexmaci64 -------------------------------------------------------------------------------- /Code/External/SLIC_mex/SLIC_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/External/SLIC_mex/SLIC_mex.mexw64 -------------------------------------------------------------------------------- /Code/External/SLIC_mex/test.m: -------------------------------------------------------------------------------- 1 | % 2 | img = imread('test.jpg'); 3 | superpixels= SLIC_mex( img, 200, 20 ); 4 | imshow(superpixels,[]); -------------------------------------------------------------------------------- /Code/External/as_rpca/as_rpca.m: -------------------------------------------------------------------------------- 1 | function [A,E,obj] = as_rpca(D,lambda,k,rho,display) 2 | % This routine solves the following optimization problem, 3 | % min |A|_*+lambda*|E|_1 4 | % s.t., X = Z+E, rank(A) < = k 5 | % reference: Active Subspace: Towards Scalable Low-Rank Learning, Neural 6 | % Computation, 2012. 7 | 8 | [d n] = size(D); 9 | if nargin<5 10 | display = true; 11 | end 12 | 13 | if nargin<4 14 | rho = 1.1; 15 | end 16 | 17 | if nargin<3 18 | k = max(1,round(min(d,n)/10)); 19 | end 20 | 21 | if nargin<2 22 | lambda = 1/sqrt(min(d,n)); 23 | end 24 | 25 | tol = 1e-8*norm(D,'fro'); 26 | maxIter = 1000; 27 | max_mu = 1e10; 28 | mu = 1/norm(D,2); 29 | %% Initializing optimization variables 30 | % intialize 31 | J = zeros(k,n); 32 | E = sparse(d,n); 33 | 34 | Y = zeros(d,n); 35 | %% Start main loop 36 | iter = 0; 37 | objs=[]; 38 | while iter1/mu)); 52 | if svp>=1 53 | sigma = sigma(1:svp)-1/mu; 54 | else 55 | svp = 1; 56 | sigma = 0; 57 | end 58 | J = U(:,1:svp)*diag(sigma)*V(:,1:svp)'; 59 | 60 | %update E 61 | A = Q*J; 62 | temp = D - A + Y/mu; 63 | E = max(0,temp - lambda/mu)+min(0,temp + lambda/mu); 64 | 65 | leq = D - A - E; 66 | stopC = norm(leq,'fro'); 67 | if display 68 | E_norm = sum(sum(abs(D - A))); 69 | obj = sum(sigma)+lambda*E_norm; 70 | objs = [objs,obj]; 71 | end 72 | if display && (iter==1 || mod(iter,10)==0 || stopC 3 | #include "image\ImageSimple.h" 4 | 5 | inline double Fxyz(const double t) 6 | { 7 | return ((t > 0.008856)? pow(t, (1.0/3.0)) : (7.787*t + 16.0/116.0)); 8 | } 9 | 10 | inline void RgbPix2Lab(unsigned char byR, unsigned char byG, unsigned char byB, float &fL, float &fa, float &fb) 11 | { 12 | // RGBtoXYZ 13 | // Normalize red, green, blue values. 14 | double rLinear = (double)byR/255.0; 15 | double gLinear = (double)byG/255.0; 16 | double bLinear = (double)byB/255.0; 17 | 18 | // Convert to a sRGB form 19 | double r = (rLinear > 0.04045)? pow((rLinear + 0.055)/(1 + 0.055), 2.2) : (rLinear/12.92) ; 20 | double g = (gLinear > 0.04045)? pow((gLinear + 0.055)/(1 + 0.055), 2.2) : (gLinear/12.92) ; 21 | double b = (bLinear > 0.04045)? pow((bLinear + 0.055)/(1 + 0.055), 2.2) : (bLinear/12.92) ; 22 | 23 | // Converts 24 | double x = r*0.4124 + g*0.3576 + b*0.1805; 25 | double y = r*0.2126 + g*0.7152 + b*0.0722; 26 | double z = r*0.0193 + g*0.1192 + b*0.9505; 27 | 28 | x = (x>0.9505)? 0.9505 : ((x<0)? 0 : x); 29 | y = (y>1.0)? 1.0 : ((y<0)? 0 : y); 30 | z = (z>1.089)? 1.089 : ((z<0)? 0 : z); 31 | 32 | // XYZ to LAB 33 | double dD65_X = 0.9505; 34 | double dD65_Y = 1.0; 35 | double dD65_Z = 1.0890; 36 | 37 | double dL = 116.0 * Fxyz( y/dD65_Y ) - 16; 38 | double dA = 500.0 * ( Fxyz( x/dD65_X ) - Fxyz( y/dD65_Y) ); 39 | double dB = 200.0 * ( Fxyz( y/dD65_Y ) - Fxyz( z/dD65_Z) ); 40 | 41 | fL = (float) dL; 42 | fa = (float) dA; 43 | fb = (float) dB; 44 | } 45 | 46 | inline void Rgb2Lab(ImageSimpleUChar &rImg, ImageSimpleUChar &gImg, ImageSimpleUChar &bImg, ImageSimpleFloat &LImg, ImageSimpleFloat &AImg, ImageSimpleFloat &BImg) 47 | { 48 | int w = rImg.Width(); 49 | int h = rImg.Height(); 50 | int pixNum = w * h; 51 | 52 | if (LImg.Width() != w || LImg.Height() != h) 53 | LImg.Create(w, h); 54 | if (AImg.Width() != w || AImg.Height() != h) 55 | AImg.Create(w, h); 56 | if (BImg.Width() != w || BImg.Height() != h) 57 | BImg.Create(w, h); 58 | 59 | for (int x = 0; x < pixNum; x ++) 60 | { 61 | RgbPix2Lab(rImg[x], gImg[x], bImg[x], LImg[x], AImg[x], BImg[x]); 62 | } 63 | } -------------------------------------------------------------------------------- /Code/SLIC/SLIC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "image/ImageSimple.h" 4 | 5 | int Run_SLIC_GivenPatchNum(ImageSimpleFloat &LImg, ImageSimpleFloat &AImg, ImageSimpleFloat &BImg, unsigned int iPatchNum, float compactness, ImageSimpleUInt &idxImg); 6 | 7 | int Run_SLIC_GivenPatchSize(ImageSimpleFloat &LImg, ImageSimpleFloat &AImg, ImageSimpleFloat &BImg, unsigned int iPatchSize, float compactness, ImageSimpleUInt &idxImg); -------------------------------------------------------------------------------- /Code/SLIC/SLIC_mex.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "SLIC.h" 4 | #include "Rgb2Lab.h" 5 | 6 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) 7 | { 8 | char usageStr[] = "Usage: idxImg = SLIC_mex(image(3-Channel uint8 image), spNum(double scalar), compactness(double scalar))\n"; 9 | 10 | //Check input 11 | const mxArray *pmxImg = prhs[0]; 12 | if (nrhs != 3 || !mxIsUint8(pmxImg) || !mxIsDouble(prhs[1]) || !mxIsDouble(prhs[2])) 13 | mexErrMsgTxt(usageStr); 14 | 15 | mwSize chn = mxGetNumberOfDimensions(pmxImg); 16 | if (3 != chn) 17 | mexErrMsgTxt(usageStr); 18 | const mwSize *sz = mxGetDimensions(pmxImg); 19 | mwSize height = sz[0], width = sz[1], num_pix = height * width; 20 | unsigned int iPatchNum = unsigned int( mxGetScalar(prhs[1]) ); 21 | float compactness = float( mxGetScalar(prhs[2]) ); 22 | 23 | //Transfer matlab matrix 24 | ImageSimpleUChar img_r, img_g, img_b; 25 | img_r.Create(width, height); 26 | img_g.Create(width, height); 27 | img_b.Create(width, height); 28 | 29 | unsigned char *pImgData = (unsigned char*)mxGetData(pmxImg); 30 | for (int x = 0; x < width; x++) 31 | { 32 | for (int y = 0; y < height; y++) 33 | { 34 | img_r.Pixel(x,y) = pImgData[y]; 35 | img_g.Pixel(x,y) = pImgData[y + num_pix]; 36 | img_b.Pixel(x,y) = pImgData[y + num_pix * 2]; 37 | } 38 | pImgData += height; 39 | } 40 | 41 | //Rgb --> Lab 42 | ImageSimpleFloat img_L, img_A, img_B; 43 | Rgb2Lab(img_r, img_g, img_b, img_L, img_A, img_B); 44 | 45 | //Do SLIC 46 | ImageSimpleUInt idxImg; 47 | idxImg.Create(width, height); 48 | int iSuperPixelNum = Run_SLIC_GivenPatchNum(img_L, img_A, img_B, iPatchNum, compactness, idxImg); 49 | 50 | //Transfer back to matlab 51 | plhs[0] = mxCreateDoubleMatrix(height, width, mxREAL); 52 | double *pdIdxImg = mxGetPr(plhs[0]); 53 | for (int x = 0; x < width; x++) 54 | { 55 | for (int y = 0; y < height; y++) 56 | { 57 | unsigned int id = idxImg.Pixel(x, y); 58 | pdIdxImg[y] = double(id) + 1; 59 | } 60 | pdIdxImg += height; 61 | } 62 | 63 | plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL); 64 | *mxGetPr(plhs[1]) = double(iSuperPixelNum); 65 | 66 | return; 67 | } -------------------------------------------------------------------------------- /Code/SLIC/SLIC_mex.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/SLIC/SLIC_mex.mexw32 -------------------------------------------------------------------------------- /Code/SLIC/SLIC_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/SLIC/SLIC_mex.mexw64 -------------------------------------------------------------------------------- /Code/SLIC/compile.m: -------------------------------------------------------------------------------- 1 | function compile 2 | mex SLIC_mex.cpp SLIC.cpp -------------------------------------------------------------------------------- /Code/SLIC/image/ImageConcept.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | ///////////////////////////////////////////////////////////////////////////////// 4 | // ImageAccessConcept is a general concept for reading image 5 | // 1. it does not necessarily own memory 6 | // 2. memory could be non-continuous for alignment at each row, i.e., each image row y is pointed by RowPtr(y) at Stride() bytes 7 | template 8 | class ImageAccessConcept 9 | { 10 | public: 11 | typedef P PixelType; 12 | 13 | unsigned int Width() const { return 0; } 14 | unsigned int Height() const { return 0; } 15 | unsigned int Stride() const { return 0; } 16 | const PixelType* RowPtr(int y) const { return 0; } 17 | const PixelType& Pixel(int x, int y) const { return RowPtr(y)[x]; } 18 | 19 | // writing support 20 | PixelType* RowPtr(int y) { return 0; } 21 | PixelType& Pixel(int x, int y) { return RowPtr(y)[x]; } 22 | }; 23 | 24 | template 25 | void ImageAccessConceptCheck(ImageAccessConcept& img) 26 | { 27 | ImageAccessConcept::PixelType p; 28 | 29 | unsigned int w = img.Width(); 30 | unsigned int h = img.Height(); 31 | unsigned int s = img.Stride(); 32 | 33 | const ImageAccessConcept::PixelType* ptr = img.RowPtr(0); 34 | p = img.Pixel(0, 0); 35 | 36 | img.RowPtr(0)[0] = p; 37 | img.Pixel(0, 0) = p; 38 | 39 | // test basic functions 40 | if (IsImageEmpty(img)); 41 | if (IsPointInsideImage(img, 0, 0)); 42 | unsigned int left, top, right, bottom; 43 | if (ComputeImageBBox(img, left, top, right, bottom)); 44 | p = FindMaxPointInImage(img, left, top); 45 | } 46 | 47 | ////////////////////////////////////////////////////////////////////// 48 | // very basic helper functions that take an ImageAccessConcept as input 49 | #include 50 | 51 | template 52 | bool RectIntersect(IntType l0, IntType t0, IntType r0, IntType b0 53 | ,IntType l1, IntType t1, IntType r1, IntType b1 54 | ,IntType& l_out, IntType& t_out, IntType& r_out, IntType& b_out) 55 | { 56 | static_assert(std::is_integral::value, "RectIntersect must use integral type"); 57 | 58 | l_out = std::max(l0, l1); 59 | t_out = std::max(t0, t1); 60 | r_out = std::min(r0, r1); 61 | b_out = std::min(b0, b1); 62 | 63 | return ((r_out > l_out) && (b_out > t_out)); 64 | } 65 | 66 | template 67 | bool IsImageEmpty(const ImageAccessType& img) 68 | { 69 | return (img.Width() == 0) || (img.Height() == 0); 70 | } 71 | 72 | template 73 | bool IsPointInsideImage(const ImageAccessType& img, IntType x, IntType y) 74 | { 75 | static_assert(std::is_integral::value, "IsPointInsideImage must use integral type"); 76 | 77 | return ((x >= 0) && (x < static_cast(img.Width())) && (y >= 0) && (y < static_cast(img.Height()))); 78 | } 79 | 80 | // compute the bounding box of non-zero area, [(left, top), (right, bottom)) 81 | // return true if the bbox is valid, otherwise false (all pixels are zero and empty bbox) 82 | // TODO: generalize 'be zero' to a predicate 83 | template 84 | bool ComputeImageBBox(const ImageAccessType& img, IntType& left, IntType& top, IntType& right, IntType& bottom) 85 | { 86 | static_assert(std::is_integral::value, "ComputeImageBBox must use integral type"); 87 | 88 | if (IsImageEmpty(img)) return false; 89 | 90 | // make sure width(height) > 0 91 | left = img.Width()-1; 92 | top = img.Height()-1; 93 | right = 0; 94 | bottom = 0; 95 | 96 | for(unsigned int y = 0; y < img.Height(); y++) 97 | { 98 | const ImageAccessType::PixelType* pRow = img.RowPtr(y); 99 | for(unsigned int x = 0; x < img.Width(); x++, pRow++) 100 | { 101 | if (0 == *pRow) continue; // TODO: could be replaced by a predicate 102 | 103 | if (x < left) left = x; 104 | if (x > right) right = x; 105 | if (y < top) top = y; 106 | if (y > bottom) bottom = y; 107 | } 108 | } 109 | 110 | right++; bottom++; // make the boundary open 111 | 112 | return ((left < right) && (top < bottom)); 113 | } 114 | 115 | // TODO: generalize 'max' to a predicate 116 | template 117 | typename ImageAccessType::PixelType FindMaxPointInImage(const ImageAccessType& img, IntType& best_x, IntType& best_y) 118 | { 119 | static_assert(std::is_integral::value, "FindMaxPointInImage must use integral type"); 120 | 121 | best_x = 0; 122 | best_y = 0; 123 | typename ImageAccessType::PixelType best_value = img.RowPtr(0)[0]; 124 | 125 | const int h = img.Height(); 126 | const int w = img.Width(); 127 | for (unsigned int y = 0; y < img.Height(); y++) 128 | { 129 | const ImageAccessType::PixelType* pRow = img.RowPtr(y); 130 | for (unsigned int x = 0; x < img.Width(); x++, pRow++) 131 | { 132 | if (*pRow > best_value) // TODO: could be replaced by a predicate 133 | { 134 | best_value = *pRow; 135 | best_x = x; 136 | best_y = y; 137 | } 138 | } 139 | } 140 | 141 | return best_value; 142 | } -------------------------------------------------------------------------------- /Code/avg_sm.m: -------------------------------------------------------------------------------- 1 | function s_avg = avg_sm(supixels, img_num, map_num, Mset) 2 | % gernerate saliency maps 3 | for j = 1:img_num 4 | spnum(j) = max(supixels{j}(:)); % superpixel numbers 5 | for q = 1:spnum(j) 6 | h = supixels{j} == q; 7 | for t = 1:map_num 8 | s_avg{j,q}(t) = sum(sum(h.*double(Mset{j,t})))/sum(h(:)); % mean saliency for superpixels 9 | end 10 | end; 11 | end; -------------------------------------------------------------------------------- /Code/compute_sigma_new.m: -------------------------------------------------------------------------------- 1 | function [sigma_c,sigma_g] = compute_sigma_new(img_num, supixels, cfeat, gfeat) 2 | ctotal = 0; 3 | gtotal = 0; 4 | num = 0; 5 | 6 | for i = 1:img_num 7 | for j = 1:max(supixels{i}(:)) 8 | for temp = 1:max(supixels{i}(:)) 9 | cdist = Ka2distance_demo(cfeat{i,j},cfeat{i,temp}); % color distance 10 | gdist = Ka2distance_demo(gfeat{i,j},gfeat{i,temp}); % gabor distance 11 | ctotal = ctotal + cdist; 12 | gtotal = gtotal + gdist; 13 | num = num + 1; 14 | end; 15 | 16 | if i < img_num 17 | for ii = (i+1):img_num 18 | for k = 1: max(supixels{ii}(:)) 19 | cdist = Ka2distance_demo(cfeat{i,j},cfeat{(ii),k});% color distance 20 | gdist = Ka2distance_demo(gfeat{i,j},gfeat{(ii),k});% gabor distance 21 | ctotal = ctotal + cdist; 22 | gtotal = gtotal + gdist; 23 | num = num + 1; 24 | end; 25 | end; 26 | end; 27 | end; 28 | end; 29 | 30 | sigma_c = ctotal/num; 31 | sigma_g = gtotal/num; -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/1/1a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/1/1a.bmp -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/1/1b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/1/1b.bmp -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/10/10a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/10/10a.bmp -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/10/10b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/10/10b.bmp -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/100/100a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/100/100a.bmp -------------------------------------------------------------------------------- /Code/cosdata/gt/pair/pair105/100/100b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/gt/pair/pair105/100/100b.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/1/1a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/1/1a.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/1/1a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/1/1a.jpg -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/1/1b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/1/1b.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/1/1b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/1/1b.jpg -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/10/10a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/10/10a.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/10/10a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/10/10a.jpg -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/10/10b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/10/10b.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/10/10b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/10/10b.jpg -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/100/100a.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/100/100a.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/100/100a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/100/100a.jpg -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/100/100b.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/100/100b.bmp -------------------------------------------------------------------------------- /Code/cosdata/images/pair/pair105/100/100b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/cosdata/images/pair/pair105/100/100b.jpg -------------------------------------------------------------------------------- /Code/create_feature_space.m: -------------------------------------------------------------------------------- 1 | function feaImg=create_feature_space(im) 2 | 3 | [n, r, c] = size(im); 4 | 5 | % choice of bandwidth and orientation 6 | % f = [0,2]; 7 | % f is 1/lambda where lambda is the wavelength (pixels). Valid numbers are 8 | % between 2 and 256 9 | % lambda = [3,5,7]; 10 | lambda = sqrt(2)*[2 6 8]; 11 | f = 1./lambda; 12 | % theta = [0 pi/6 pi/3 3*pi/4]; 13 | theta = 0:pi/8:(pi-pi/8); 14 | 15 | feaImg=[]; 16 | for i=1:length(f) 17 | for j=1:length(theta) 18 | gamma = 0; 19 | [~, Gimg_r]=gaborfilterVikas(im(:,:,1),f(i),theta(j),gamma); % [gabor filter, R channel output] 20 | [~, Gimg_g]=gaborfilterVikas(im(:,:,2),f(i),theta(j),gamma); % [gabor filter, G channel output] 21 | [~, Gimg_b]=gaborfilterVikas(im(:,:,3),f(i),theta(j),gamma); % [gabor filter, B channel output] 22 | Gimg=[]; 23 | Gimg=cat(3,cat(3,Gimg_r,Gimg_g),Gimg_b); % contatenate arrays along 3rd dimension 24 | Gimg=reshape(Gimg,n*r,c); 25 | feaImg=cat(2,feaImg,Gimg); 26 | end 27 | end 28 | 29 | for i=1:length(f) 30 | for j=1:length(theta) 31 | gamma = -0.5*pi; 32 | [~, Gimg_r]=gaborfilterVikas(im(:,:,1),f(i),theta(j),gamma); % [gabor filter, R channel output] 33 | [~, Gimg_g]=gaborfilterVikas(im(:,:,2),f(i),theta(j),gamma); % [gabor filter, G channel output] 34 | [~, Gimg_b]=gaborfilterVikas(im(:,:,3),f(i),theta(j),gamma); % [gabor filter, B channel output] 35 | Gimg=[]; 36 | Gimg=cat(3,cat(3,Gimg_r,Gimg_g),Gimg_b); % contatenate arrays along 3rd dimension 37 | Gimg=reshape(Gimg,n*r,c); 38 | feaImg=cat(2,feaImg,Gimg); 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /Code/cvx-w64/cvx/README.txt: -------------------------------------------------------------------------------- 1 | CVX: A system for disciplined convex programming 2 | Copyright 2005-2014 CVX Research, Inc. 3 | Professional package 4 | -------------------------------------------------------- 5 | 6 | Thank you for your interest in CVX! 7 | 8 | INSTALLATION 9 | ------------ 10 | 11 | For full installation instructions, please see the Installation section of the 12 | users' guide, which can be found in 13 | doc/install.html 14 | doc/CVX.pdf (section 2) 15 | or online at 16 | http://cvxr.com/cvx/doc/install.html 17 | 18 | DOCUMENTATION 19 | ------------- 20 | 21 | Full documentation, in both HTML and PDF formats, is available in 22 | doc/index.html 23 | doc/CVX.pdf 24 | or online at 25 | http://cvxr.com/cvx/doc 26 | 27 | EXAMPLES 28 | -------- 29 | 30 | The full example library is available in the examples/ subdirectory. The index 31 | can be found at 32 | examples/index.html 33 | or online at 34 | http://cvxr.com/cvx/examples 35 | 36 | SUPPORT 37 | ------- 38 | 39 | Please note that CVX Research, Inc. cannot provide direct email support 40 | without a paid contract. However, we have created an assembled a variety of 41 | avenues for obtaining help with CVX in particular or optimization in general. 42 | Please see the Support section of the documentation for details: 43 | doc/support.html 44 | http://cvxr.com/cvx/doc/support.html 45 | 46 | LICENSE 47 | ------- 48 | 49 | This package is governed by the terms of the CVX Professional License. This 50 | package may *not* be redistributed or placed in a public repository without 51 | the advance written consent of CVX Research, Inc. Please see the file 52 | LICENSE.txt for more precise license terms. 53 | 54 | The contents of the example library in the `examples/` subdirectory 55 | are *public domain*. We do ask that if you use any of this content in 56 | your own work, that you acknowledge the source and any specific authors 57 | cited therein. 58 | 59 | Redistributable packages governed by the GPLv3-based CVX Standard License 60 | are available directly from the CVX download page 61 | http://cvxr.com/cvx/download 62 | or from the CVX GitHub repository 63 | http://github.com/cvxr/cvx 64 | -------------------------------------------------------------------------------- /Code/do_kmeans.c: -------------------------------------------------------------------------------- 1 | #include "mex.h" 2 | #include 3 | 4 | void do_kmeans(int vq_num,int vq_dim,int Knum,int Itnum,double dat[],double rcen[],double Cout[],double Lout[]) 5 | { 6 | double very_large=1000000000; //3*256^2 7 | double dis,temp,InvKNum; 8 | double error=1.0; 9 | int Lnum; 10 | int j,k,i,rid,*tnum; 11 | double *vq_temp,*vq_sum; 12 | 13 | vq_temp=mxCalloc(vq_dim,sizeof(double)); 14 | vq_sum=mxCalloc(vq_dim*Knum,sizeof(double)); 15 | tnum=mxCalloc(Knum,sizeof(int)); 16 | Lnum=0; 17 | 18 | // mexPrintf("Itnum %d \n",Itnum); 19 | 20 | while (error>0.0001 && Lnum0)~=length(diag(in)) 15 | error('The input matrix shall have positive elements on its diagonal') 16 | end 17 | if min(eig(in))>=0 18 | out = in; 19 | disp('The covariance matrix is already positive semi-definite') 20 | return 21 | end 22 | global Size; Size = size(in); 23 | % Process upper triangular part of input and make it global 24 | f = reshape(triu(in)',[],1); f(f==0) = []; global F; F = f; 25 | % Set zero lower bounds for variances 26 | lbnd = NaN(length(f),1); diagin = diag(in); 27 | for i=1:length(diagin) 28 | for j=1:length(f) 29 | if f(j)==diagin(i) 30 | lbnd(j) = 0; 31 | elseif f(j)~=diagin(i) && lbnd(j)~=0 32 | lbnd(j) = -Inf; 33 | end 34 | end 35 | end 36 | % Invoke nonlinear optimization 37 | back = fmincon(@distF,f,[],[],[],[],lbnd,[],@ineq,optimset('Algorithm','active-set','MaxFunEvals',20000,'MaxIter',20000,'Display','off','PlotFcns',@optimplotfirstorderopt)); 38 | close 39 | % Bring output back to symmetric matrix format 40 | a = zeros(size(in)); ct = 1; rc = 1; cc = 1; 41 | for i=1:length(back) 42 | a(rc,cc) = back(i); cc = cc+1; 43 | if cc>Size(2) 44 | cc = ct+1; rc = rc+1; ct = ct+1; 45 | end 46 | end 47 | out_pre = a+a'; 48 | for i=1:Size(1) 49 | out_pre(i,i) = a(i,i); 50 | end 51 | % Should small negative eigenvalues remain, correct them 52 | [ve,va] = eig(out_pre); va(va<0) = 0; out = ve*va*ve'; 53 | % Visualize difference between in and out 54 | diffF = in-out; imagesc(diffF(1:size(diffF,1),1:size(diffF,2))); colorbar; colormap(copper) 55 | set(gcf,'Color',[.97 .97 .97]); title('Difference between matrix input and output','FontSize',12) 56 | end 57 | 58 | function out = distF(in) % distance 59 | global F; 60 | out = sum((F-in).^2); 61 | end 62 | 63 | function [c,ceq] = ineq(in) % inequality constraints (eigenvalues larger zero) 64 | global Size; 65 | a = zeros(Size); ct = 1; rc = 1; cc = 1; 66 | for i=1:length(in) 67 | a(rc,cc) = in(i); cc = cc+1; 68 | if cc>Size(2) 69 | cc = ct+1; rc = rc+1; ct = ct+1; 70 | end 71 | end 72 | b = a+a'; 73 | for i=1:Size(1) 74 | b(i,i) = a(i,i); 75 | end 76 | [ve,va] = eig(b); c = -diag(va); ceq = []; 77 | end -------------------------------------------------------------------------------- /Code/normalize.m: -------------------------------------------------------------------------------- 1 | function nmap = normalize( map ) 2 | % normallize 3 | nmap = double(map); 4 | nmap = (nmap-min(nmap(:)))*255/(max(nmap(:))-min(nmap(:))); 5 | nmap = nmap*255/max(nmap(:)); 6 | nmap = uint8(floor(nmap)); 7 | end 8 | 9 | -------------------------------------------------------------------------------- /Code/read_maps.m: -------------------------------------------------------------------------------- 1 | function Mset = read_maps(inames, img_num, map_names, map_num, fdir) 2 | Mset = cell(img_num, map_num); 3 | 4 | for m=1:img_num 5 | for n=1:map_num 6 | % read-in saliency maps 7 | Mset{m,n} = im2double(imread([fdir '/' inames{m} map_names{n}])); 8 | end; 9 | end; 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Code/rgb2lab.m: -------------------------------------------------------------------------------- 1 | function [L,a,b] = RGB2Lab(R,G,B) 2 | %RGB2LAB Convert an image from RGB to CIELAB 3 | % 4 | % function [L, a, b] = RGB2Lab(R, G, B) 5 | % function [L, a, b] = RGB2Lab(I) 6 | % function I = RGB2Lab(...) 7 | % 8 | % RGB2Lab takes red, green, and blue matrices, or a single M x N x 3 image, 9 | % and returns an image in the CIELAB color space. RGB values can be 10 | % either between 0 and 1 or between 0 and 255. Values for L are in the 11 | % range [0,100] while a and b are roughly in the range [-110,110]. The 12 | % output is of type double. 13 | % 14 | % This transform is based on ITU-R Recommendation BT.709 using the D65 15 | % white point reference. The error in transforming RGB -> Lab -> RGB is 16 | % approximately 10^-5. 17 | % 18 | % See also LAB2RGB. 19 | 20 | % By Mark Ruzon from C code by Yossi Rubner, 23 September 1997. 21 | % Updated for MATLAB 5 28 January 1998. 22 | % Updated for MATLAB 7 30 March 2009. 23 | 24 | if nargin == 1 25 | B = double(R(:,:,3)); 26 | G = double(R(:,:,2)); 27 | R = double(R(:,:,1)); 28 | end 29 | 30 | if max(max(R)) > 1.0 || max(max(G)) > 1.0 || max(max(B)) > 1.0 31 | R = double(R) / 255; 32 | G = double(G) / 255; 33 | B = double(B) / 255; 34 | end 35 | 36 | % Set a threshold 37 | T = 0.008856; 38 | 39 | [M, N] = size(R); 40 | s = M * N; 41 | RGB = [reshape(R,1,s); reshape(G,1,s); reshape(B,1,s)]; 42 | 43 | % RGB to XYZ 44 | MAT = [0.412453 0.357580 0.180423; 45 | 0.212671 0.715160 0.072169; 46 | 0.019334 0.119193 0.950227]; 47 | XYZ = MAT * RGB; 48 | 49 | % Normalize for D65 white point 50 | X = XYZ(1,:) / 0.950456; 51 | Y = XYZ(2,:); 52 | Z = XYZ(3,:) / 1.088754; 53 | 54 | XT = X > T; 55 | YT = Y > T; 56 | ZT = Z > T; 57 | 58 | Y3 = Y.^(1/3); 59 | 60 | fX = XT .* X.^(1/3) + (~XT) .* (7.787 .* X + 16/116); 61 | fY = YT .* Y3 + (~YT) .* (7.787 .* Y + 16/116); 62 | fZ = ZT .* Z.^(1/3) + (~ZT) .* (7.787 .* Z + 16/116); 63 | 64 | L = reshape(YT .* (116 * Y3 - 16.0) + (~YT) .* (903.3 * Y), M, N); 65 | a = reshape(500 * (fX - fY), M, N); 66 | b = reshape(200 * (fY - fZ), M, N); 67 | 68 | if nargout < 2 69 | L = cat(3,L,a,b); 70 | end 71 | -------------------------------------------------------------------------------- /Code/sacs_accv14_thes.m: -------------------------------------------------------------------------------- 1 | function [w,supixels] = sacs_accv14_thes(map_names, inames, Mset, imgDir, par) 2 | 3 | img_num = length(inames); 4 | map_num = length(map_names); 5 | bins = 256; 6 | knn = par.knn; 7 | numsupixel = par.numsupixel; 8 | thes = par.thes; 9 | 10 | for i = 1:img_num, 11 | imname = dir([imgDir '/' [inames{i},'.bmp']]); 12 | imdir = strcat(imgDir,'/',imname.name); 13 | img = imread(imdir); 14 | img_R = double(img(:,:,1)); 15 | img_G = double(img(:,:,2)); 16 | img_B = double(img(:,:,3)); 17 | superpixels = SLIC_mex(img, numsupixel, 20); 18 | supixels{i} = superpixels; 19 | spnum = max(superpixels(:)); % the actual number of the superpixels 20 | 21 | avg_p = zeros(spnum,2); 22 | 23 | for l = 1:spnum, 24 | [xx,yy] = find(superpixels == l); 25 | avg_p(l,:) = mean([xx,yy]); 26 | end 27 | 28 | [nb,~] = knnsearch(avg_p,avg_p,'k',knn,'distance','euclidean'); 29 | 30 | for p = 1:map_num, 31 | mest = Mset{i,p}; 32 | mest = im2double(mest); 33 | avg = zeros(1,spnum); 34 | for j=1:spnum, 35 | h = superpixels == j; 36 | % calculate the average saliency score for each superpixel 37 | avg(j) = mean(mest(h)); 38 | end; 39 | % compute the color histogram for the p-th map of the i-th image 40 | for sp = 1:spnum, 41 | window = nb(sp,:); 42 | sign = avg(window) >= thes * max(avg(window)); % sailency thresholding 43 | slabels = window(sign); % record the superpixel label over the theshold 44 | fhis = []; 45 | for q = 1:numel(slabels) 46 | h = (superpixels == slabels(q)); 47 | H = (mest(h)); 48 | his = hist(H(:),(0:1:bins-1)/bins); 49 | fhis = [fhis;his]; 50 | end; 51 | F{p,sp} = sum(fhis);%feature sp on p-th map 52 | 53 | end; 54 | end 55 | 56 | for sp = 1:spnum, 57 | f_matrix = zeros(map_num,bins); 58 | for p = 1:map_num 59 | temp = F{p,sp}; 60 | f_matrix(p,:) = temp; 61 | end 62 | f_matrix = f_matrix ./ 10000; % to reduce the scale of each bin, for accelerating the speed. 63 | %---------------------RPCA---------------------------% 64 | % lamda is used to control the weight of the saprsity of E 65 | lamda = 0.05; 66 | [~ ,E] = exact_alm_rpca(f_matrix',lamda); 67 | S = double(E'); 68 | w{i,sp} = sqrt(sum(abs(S).^2,2)); 69 | w{i,sp} = w{i,sp} / (max(w{i,sp})-min(w{i,sp})+1e-10); %normalization 70 | w{i,sp} = exp(-w{i,sp})+1e-10; 71 | sum_w = sum(w{i,sp},1); 72 | w{i,sp} = w{i,sp} / (sum_w); 73 | end 74 | end 75 | end -------------------------------------------------------------------------------- /Code/set_A_new.m: -------------------------------------------------------------------------------- 1 | function A = set_A_new(img_num,supixels,w,map_num) 2 | A = []; 3 | for id = 1:img_num, 4 | for i = 1:max(supixels{id}(:)), 5 | A_vec1 = ones(1,map_num)-w{id,i}'; 6 | A_vec2 = exp(A_vec1)./sum(exp(A_vec1)); 7 | A = vertcat(A,A_vec2); 8 | end; 9 | end; -------------------------------------------------------------------------------- /Code/set_B.m: -------------------------------------------------------------------------------- 1 | function B = set_B(e, s_avg, img_num, supixels) 2 | B = []; 3 | for id = 1:img_num 4 | e_val = (e{id}-repmat(min(e{id}),size(e{id},1),1))./repmat(max(e{id})-min(e{id}),size(e{id},1),1); 5 | for i = 1:max(supixels{id}(:)), 6 | mean_val = mean(e_val(i,:)); 7 | std_val = std(e{id}(i,:)); 8 | men = heaviside(mean_val-std_val); 9 | temp_vec1 = (1-men).*s_avg{id,i}+men.*(1-s_avg{id,i}); 10 | temp_vec2 = exp(temp_vec1)./sum(exp(temp_vec1)); 11 | B = vertcat(B,temp_vec2); 12 | end 13 | end -------------------------------------------------------------------------------- /Code/set_affinity.m: -------------------------------------------------------------------------------- 1 | function [M,e] = set_affinity(supixels,img_num,cfeat,gfeat,par) 2 | 3 | for i = 1:img_num, 4 | iii = 0; 5 | for ii = 1:img_num, 6 | N1 = max(supixels{i}(:)); 7 | N2 = max(supixels{ii}(:)); 8 | W{i,ii} = zeros(N1,N2); 9 | if (i == ii) 10 | for j = 1:N1, 11 | rx = find(supixels{i} == j); 12 | neigh = getneighbor_demo(supixels{i},rx); 13 | for n = 1:neigh.num, 14 | temp = neigh.ind(n); 15 | d1 = Ka2distance_demo(cfeat{i,j},cfeat{ii,temp}); % color distance 16 | d2 = Ka2distance_demo(gfeat{i,j},gfeat{ii,temp}); % gabor distance 17 | W{i,ii}(j,temp) = exp(-(par.clambda*(d1/par.sigma_c) + par.glambda*(d2/par.sigma_g))); 18 | end; 19 | end; 20 | else 21 | iii = iii+1; 22 | for j = 1:N1, 23 | for k = 1:N2, 24 | d3 = Ka2distance_demo(cfeat{i,j},cfeat{ii,k}); 25 | d4 = Ka2distance_demo(gfeat{i,j},gfeat{ii,k}); 26 | dist(k) = par.clambda*(d3/par.sigma_c) + par.glambda*(d4/par.sigma_g); 27 | end; 28 | [val,loc] = sort(dist,'ascend'); 29 | for m = 1:min(par.neighbors,N2), 30 | W{i,ii}(j,loc(m)) = exp(-val(m)); 31 | end; 32 | e{i}(j,iii) = exp(-val(m)); 33 | clear dist 34 | end; 35 | end; 36 | end; 37 | end; 38 | 39 | % affinity matrix 40 | M = cell2mat(W); 41 | M = sqrt(M.*M'); 42 | 43 | -------------------------------------------------------------------------------- /Code/set_w.m: -------------------------------------------------------------------------------- 1 | function w_new = set_w(img_num, supixels, x) 2 | addnum = 0; 3 | 4 | for i = 1:img_num 5 | for j = 1:max(supixels{i}(:)) 6 | w_new{i,j} = x(j+addnum,:); 7 | end 8 | addnum = addnum + max(supixels{i}(:)); 9 | 10 | 11 | end 12 | -------------------------------------------------------------------------------- /Code/sp_make_dir.m: -------------------------------------------------------------------------------- 1 | function [ ] = sp_make_dir( filePath ) 2 | % function [ ] = sp_make_dir( filePath ) 3 | % MAKE_DIR Summary of this function goes here 4 | % Detailed explanation goes here 5 | 6 | [dirPath fileName] = fileparts(filePath); 7 | if(isdir(dirPath)==0) 8 | mkdir(dirPath); 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1a_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1a_patch.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/1/1b_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/1/1b_patch.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_HDCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_HDCT.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10a_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10a_patch.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_HDCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_HDCT.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/10/10b_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/10/10b_patch.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_HDCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_HDCT.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100a_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100a_patch.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_Achanta.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_Achanta.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_CA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_CA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_COV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_COV.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_CoC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_CoC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_Cor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_Cor.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_DSR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_DSR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_FES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_FES.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_Fu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_Fu.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_GMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_GMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_HDCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_HDCT.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_Hou.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_Hou.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_Itti.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_Itti.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_LMR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_LMR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_MC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_MC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_PCA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_PCA.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_RBD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_RBD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SEG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SEG.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SF.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SUN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SUN.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SWD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SWD.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SeR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SeR.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_SpC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_SpC.png -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_color.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_color.bmp -------------------------------------------------------------------------------- /Code/submaps/pair/pair105/100/100b_patch.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/submaps/pair/pair105/100/100b_patch.bmp -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/1/1a_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/1/1a_1.png -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/1/1b_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/1/1b_1.png -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/10/10a_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/10/10a_1.png -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/10/10b_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/10/10b_1.png -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/100/100a_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/100/100a_1.png -------------------------------------------------------------------------------- /Code/test/pair/pair105/icassp17/100/100b_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/Code/test/pair/pair105/icassp17/100/100b_1.png -------------------------------------------------------------------------------- /ICASSP17_CSLA_PAPER.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/ICASSP17_CSLA_PAPER.pdf -------------------------------------------------------------------------------- /ICASSP17_CSLA_POSTER.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chungchi/CSLA/495b10d1f28e62034fb722bc9bd1907dd0cd1e5b/ICASSP17_CSLA_POSTER.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## (CSLA) Image Co-saliency Detection via Locally Adaptive Saliency Map Fusion 2 | ## To get an idea of this paper, simply run the code `demo.m`. 3 | ### Note: Please download the "CVX" and get the license file from "http://cvxr.com/cvx/download" 4 | --------------------------------------------------------------------------------