資源簡介
圖像顯著性matlab代碼,將所需要檢測的圖像放到test文件夾中,灰度圖像,然后運行demo.m即可

代碼片段和文件信息
%?Demo?for?paper?“Saliency?Detection?via?Graph-based?Manifold?Ranking“?
%?by?Chuan?Yang?Lihe?Zhang?Huchuan?Lu?Ming-Hsuan?Yang?and?Xiang?Ruan
%?To?appear?in?Proceedings?of?IEEE?Conference?on?Computer?Vision?and?Pattern?Recognition?(CVPR?2013)?Portland?June?2013.
clear?all;
tic
addpath(‘./others/‘);
%%------------------------set?parameters---------------------%%
theta=10;?%?control?the?edge?weight?
alpha=0.99;%?control?the?balance?of?two?items?in?manifold?ranking?cost?function
spnumber=200;%?superpixel?number
imgRoot=‘./test/‘;%?test?image?path
saldir=‘./saliencymap/‘;%?the?output?path?of?the?saliency?map
supdir=‘./superpixels/‘;%?the?superpixel?label?file?path
mkdir(supdir);
mkdir(saldir);
imnames=dir([imgRoot?‘*‘?‘jpg‘]);
for?ii=1:length(imnames)???
????disp(ii);
????imname=[imgRoot?imnames(ii).name];?
????[input_imw]=removeframe(imname);%?run?a?pre-processing?to?remove?the?image?frame?
????[mnk]?=?size(input_im);
%%----------------------generate?superpixels--------------------%%
????imname=[imname(1:end-4)?‘.bmp‘];%?the?slic?software?support?only?the?‘.bmp‘?image
????comm=[‘SLICSuperpixelSegmentation‘?‘?‘?imname?‘?‘?int2str(20)?‘?‘?int2str(spnumber)?‘?‘?supdir];
????system(comm);????
????spname=[supdir?imnames(ii).name(1:end-4)??‘.dat‘];
????superpixels=ReadDAT([mn]spname);?%?superpixel?label?matrix
????spnum=max(superpixels(:));%?the?actual?superpixel?number
%%----------------------design?the?graph?model--------------------------%%
%?compute?the?feature?(mean?color?in?lab?color?space)?
%?for?each?node?(superpixels)
????input_vals=reshape(input_im?m*n?k);
????rgb_vals=zeros(spnum13);
????inds=cell(spnum1);
????for?i=1:spnum
????????inds{i}=find(superpixels==i);
????????rgb_vals(i1:)=mean(input_vals(inds{i}:)1);
????end??
????lab_vals?=?colorspace(‘Lab<-‘?rgb_vals);?
????seg_vals=reshape(lab_valsspnum3);%?feature?for?each?superpixel
?
?%?get?edges
????adjloop=AdjcProcloop(superpixelsspnum);
????edges=[];
????for?i=1:spnum
????????indext=[];
????????ind=find(adjloop(i:)==1);
????????for?j=1:length(ind)
????????????indj=find(adjloop(ind(j):)==1);
????????????indext=[indextindj];
????????end
????????indext=[indextind];
????????indext=indext((indext>i));
????????indext=unique(indext);
????????if(~isempty(indext))
????????????ed=ones(length(indext)2);
????????????ed(:2)=i*ed(:2);
????????????ed(:1)=indext;
????????????edges=[edges;ed];
????????end
????end
%?compute?affinity?matrix
????weights?=?makeweights(edgesseg_valstheta);
????W?=?adjacency(edgesweightsspnum);
%?learn?the?optimal?affinity?matrix?(eq.?3?in?paper)
????dd?=?sum(W);?D?=?sparse(1:spnum1:spnumdd);?clear?dd;
????optAff?=(D-alpha*W)\eye(spnum);?
????mz=diag(ones(spnum1));
????mz=~mz;
????optAff=optAff.*mz;
??
%%-----------------------------stage?1--------------------------%%
%?compute?the?saliency?value?for?each?superpixel?
%?with?the?top?boundary?as?the?query
????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????2754857??2016-09-12?05:27??saliency\2013CVPR_Saliency?Detection?via?Graph-ba
?????文件???????5186??2018-04-29?21:13??saliency\demo.m
?????文件???????8600??2016-11-11?03:18??saliency\demo_annotated.m
?????文件??????13868??2018-10-25?10:26??saliency\hideimg.jpg
?????文件???????1082??2018-10-29?22:48??saliency\lena\1-2.png
?????文件???????1067??2018-10-29?22:48??saliency\lena\1.png
?????文件???????7516??2018-10-25?11:01??saliency\lena\lena-2.png
?????文件???????7402??2018-10-25?11:01??saliency\lena\LENA.png
?????文件?????291582??2018-10-25?10:26??saliency\msg.txt
?????文件???????2101??2015-10-26?12:54??saliency\others\adjacency.m
?????文件???????1052??2015-10-26?12:54??saliency\others\AdjcProcloop.m
?????文件??????14019??2015-10-26?12:54??saliency\others\colorspace.m
?????文件????????215??2015-10-26?12:54??saliency\others\makeweights.m
?????文件???????2365??2015-10-26?12:54??saliency\others\normalize.m
?????文件????????441??2015-10-26?12:54??saliency\others\ReadDAT.m
?????文件???????1300??2018-10-29?22:48??saliency\others\removefr
?????文件?????????31??2018-10-25?10:26??saliency\psnr.txt
?????文件???????1924??2015-10-26?12:54??saliency\readme.txt
?????文件???????1104??2018-10-30?15:21??saliency\saliencymap\2.png
?????文件???????1108??2018-10-30?15:21??saliency\saliencymap\2_stage1.png
?????文件???????1110??2018-10-30?15:21??saliency\saliencymap\3.png
?????文件???????1100??2018-10-30?15:21??saliency\saliencymap\3_stage1.png
?????文件???????1061??2018-10-30?15:21??saliency\saliencymap\4.png
?????文件???????1082??2018-10-30?15:21??saliency\saliencymap\4_stage1.png
?????文件???????1091??2018-10-30?15:21??saliency\saliencymap\5.png
?????文件???????1100??2018-10-30?15:21??saliency\saliencymap\5_stage1.png
?????文件????????996??2018-10-30?15:21??saliency\saliencymap\6.png
?????文件???????1094??2018-10-30?15:21??saliency\saliencymap\6_stage1.png
?????文件????????950??2018-10-30?15:21??saliency\saliencymap\8.png
?????文件????????760??2018-10-30?15:21??saliency\saliencymap\8_stage1.png
............此處省略36個文件信息
評論
共有 條評論