• 大小: 88KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-04-19
  • 语言: Matlab
  • 标签: 显著性  

资源简介

MATLAB实现的基于图和流形排名的图像显著性检测算法,

资源截图

代码片段和文件信息

% 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;
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
    Yt=ze

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5123  2013-04-06 11:11  显著性检测算法\demo.m

     文件       2101  2003-08-22 05:43  显著性检测算法\others\adjacency.m

     文件       1052  2013-04-03 16:31  显著性检测算法\others\AdjcProcloop.m

     文件      14019  2006-08-13 18:29  显著性检测算法\others\colorspace.m

     文件        215  2013-03-05 19:16  显著性检测算法\others\makeweights.m

     文件       2365  2003-08-22 05:43  显著性检测算法\others\normalize.m

     文件        441  2013-03-05 18:58  显著性检测算法\others\ReadDAT.m

     文件       1256  2013-03-28 20:17  显著性检测算法\others\removeframe.m

     文件       1924  2013-04-03 17:48  显著性检测算法\readme.txt

     文件     192512  2012-11-28 16:12  显著性检测算法\SLICSuperpixelSegmentation.exe

     目录          0  2013-07-07 18:27  显著性检测算法\others

     目录          0  2013-07-07 18:27  显著性检测算法

----------- ---------  ---------- -----  ----

               221008                    12


评论

共有 条评论