资源简介
Automatic Salient Object Segmentation Based on Context and Shape Prior论文的代码
代码片段和文件信息
function imsegs = APPgetSpStats(imsegs)
% imsegs = APPgetSpStats(imsegs)
% Gets basic information about the superpixels
%
% Copyright(C) Derek Hoiem Carnegie Mellon University 2005
% Current Version: 1.0 09/30/2005
for ii = 1:length(imsegs)
nseg = imsegs(ii).nseg;
segimage = double( imsegs(ii).segimage );
imh = size(segimage 1);
adjmat = eye([nseg nseg]);
% get adjacency
dx = segimage ~= segimage(:[2:end end]);
dy = segimage ~= segimage([2:end end] :);
ind1 = find(dy);
ind2 = ind1 + 1;
s1 = segimage(ind1);
s2 = segimage(ind2);
% adjmat(s1 + nseg*(s2-1)) = 1;
% adjmat(s2 + nseg*(s1-1)) = 1;
adjmat(sub2ind([nseg nseg] s1 s2)) = 1;
adjmat(sub2ind([nseg nseg] s2 s1)) = 1;
ind3 = find(dx);
ind4 = ind3 + imh;
s3 = segimage(ind3);
s4 = segimage(ind4);
% adjmat(s3 + nseg*(s4-1)) = 1;
% adjmat(s4 + nseg*(s3-1)) = 1;
adjmat(sub2ind([nseg nseg] s3 s4)) = 1;
adjmat(sub2ind([nseg nseg] s4 s3)) = 1;
% slower code
% [height width] = size(segimage);
%
% for y = 1:height-1
% for x = 1:width-1
% s1 = segimage(y x);
% s2 = segimage(y+1 x);
% s3 = segimage(y x+1);
% if s1 > 0
% npixels(s1) = npixels(s1) + 1;
% if s2 > 0
% adjmat(s1 s2) = 1;
% adjmat(s2 s1) = 1;
% end
% if s3 > 0
% adjmat(s1 s3) = 1;
% adjmat(s3 s1) = 1;
% end
% end
% end
% end
%
% x = width;
% for y = 1:height
% s1 = segimage(y x);
% if s1 > 0
% npixels(s1) = npixels(s1) + 1;
% end
% end
%
% y = height;
% for x = 1:width-1
% s1 = segimage(y x);
% if s1 > 0
% npixels(s1) = npixels(s1) + 1;
% end
% end
stats = regionprops(segimage ‘Area‘);
imsegs(ii).npixels = vertcat(stats(:).Area);
imsegs(ii).adjmat = logical(adjmat);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-07-26 16:27 CBSaliency-release\
文件 224898 2011-03-03 14:21 CBSaliency-release\0_25_25057.png
文件 2232 2011-06-10 10:50 CBSaliency-release\APPgetSpStats.m
文件 3112 2011-07-25 22:41 CBSaliency-release\CBSaliency.m
文件 72 2011-06-10 10:56 CBSaliency-release\compile.m
文件 516 2011-06-05 10:25 CBSaliency-release\computeColorCenter.m
文件 926 2011-06-05 11:33 CBSaliency-release\computeColorWeight.m
文件 1664 2011-07-25 17:01 CBSaliency-release\computeOneScaleSmap_fast.m
文件 1230 2011-06-07 17:51 CBSaliency-release\computeQuantMatrix.m
文件 541 2011-06-10 16:07 CBSaliency-release\computeRegionHist.m
文件 322 2011-06-05 10:16 CBSaliency-release\histDist.m
文件 713 2011-06-07 22:09 CBSaliency-release\im2superpixels.m
文件 3212 2011-06-10 10:52 CBSaliency-release\mergeAdjacentRegions_fast.m
文件 1963 2011-06-11 11:46 CBSaliency-release\mexMergeAdjacentRegions.cpp
文件 949 2011-06-07 17:35 CBSaliency-release\processSuperpixelImage.m
文件 1539 2011-07-26 16:22 CBSaliency-release\readme.txt
文件 1501 2010-04-28 22:55 CBSaliency-release\rgb2lab.m
目录 0 2011-07-26 16:27 CBSaliency-release\segment\
文件 1940 2006-12-28 12:10 CBSaliency-release\segment\convolve.h
文件 17987 2006-12-28 12:09 CBSaliency-release\segment\COPYING
文件 1857 2006-12-28 12:10 CBSaliency-release\segment\disjoint-set.h
文件 2973 2006-12-28 12:10 CBSaliency-release\segment\filter.h
文件 2294 2011-06-07 16:19 CBSaliency-release\segment\image.h
文件 4926 2006-12-28 12:10 CBSaliency-release\segment\imconv.h
文件 1648 2006-12-28 12:10 CBSaliency-release\segment\imutil.h
文件 338 2005-02-23 13:16 CBSaliency-release\segment\Makefile
文件 1709 2011-06-07 17:38 CBSaliency-release\segment\mexSegment.cpp
文件 1731 2006-12-28 12:10 CBSaliency-release\segment\misc.h
文件 5253 2006-12-28 12:10 CBSaliency-release\segment\pnmfile.h
文件 782 2005-02-23 16:39 CBSaliency-release\segment\README
文件 2191 2006-12-28 12:10 CBSaliency-release\segment\segment-graph.h
............此处省略3个文件信息
评论
共有 条评论