【显著图】基于多尺度图结构实现显著图计算附matlab源码
【显著图】基于多尺度图结构实现显著图计算附matlab源码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
In the fifield of saliency detection, many graph-based algorithms use boundary pixels as background seeds to estimate the background and foreground saliency,which leads to signifificant errors in some of pictures. In addition, local context with high contrast will mislead the algorithms. In this paper, we propose a novel multilevel bottom-up saliency detection
approach that accurately utilizes the boundary information and takes advantage of both region based features and local image details. To provide more accurate saliency estimations, we build a three-level graph model to capture both region-based features and local image details. By
using superpixels of all four boundaries, we fifirst roughly fifigure out the foreground superpixels. After calculating the RGB distances between the average of foreground superpixels and every boundary superpixel, we discard the boundary superpixels with the longest distance to get a set of accurate background boundary queries. Finally, we propose the regularized random walks ranking to formulate pixel-wise saliency maps. Experiment results on two public datasets indicate the signifificantly promoted accuracy and robustness of our proposed algorithm in comparison with
7 state-of-the-art saliency detection approaches.
2 部分代码
clear all
clc
close all
%% Initialization
addpath(genpath(’./support/’));
IMG_DIR = ’./TestData/data/’;%
Original image path
SAL_DIR=
’./TestData/solution/’
;% Output path of the saliency map
if
~exist(SAL_DIR,
’dir’
)
mkdir(SAL_DIR);
end
imglist=dir([IMG_DIR
’*’
’jpg’
]);
%% Algorithm start
for imgno=1:length(imglist)
%
Load input image
disp(imgno);
disp(imglist(imgno).name);
% Calculate saliency
imgnamein=imglist(imgno).name;
spn =
200
;
spnb =
24
;
itheta =
10
;
alpha =
0
.
99
;
% Step
1
&
2
: Saliency Estimation
imgname = [IMG_DIR, imgnamein(
1
:end-
4
)
’.jpg’
];
imgbmpname = strcat(imgname(
1
:
(
end
-
4
)),
’.bmp’
);
[img, wid] = removeframe(imgname);
img = uint8(img*
255
);
w=fspecial(
’gaussian’
,[
5
,
5
],
15
);
img2=imfilter(img,w);
%%%
%%%
%%%
%%1st gaussian
w=fspecial(’gaussian’,[55,55],15);
img3=imfilter(img,w);%
%%%
%%%
%%%
%
2
st gaussian
[m, n, ~] = size(img);
comm = [
’SLIC_SUPPORT’
’ ’
imgbmpname
’ ’
int2str(
2
)
’ ’
int2str(spn)
’ ’
];
evalc(
’system(comm)’
);
spname = [imgbmpname(
1
:end-
4
)
’.dat’
];
superpixels = ReadDAT([m,n], spname);
spno = max(superpixels(
:
));
[salest,W] = Msalestimation(img, superpixels, spno, itheta, alpha,img2,img3);
salest= (salest-min(salest))/(max(salest)-min(salest));
map=superpixels;
for
i=
1
:spno
map(map==i)=salest(i);
end
map1=reshape(map
’,n*m,1);
% Step 3: regularized random walk ranking
salest=salest(1:spno,1);
th1 = (mean(salest) + max(salest)) / 2;
th2 = mean(salest);
mu = (1-alpha) / alpha;
[seeds, label] = seed4rw(salest, th1, th2);
[P] = myrrwr(m,n,img,itheta,superpixels,seeds,label,salest,spno,mu);
sal = P(:,1);
salmean = (sal+map1)/2;
sal = (salmean-min(salmean(:)))/(max(salmean(:))-min(salmean(:)));
sal=reshape(sal,n,m)’
;
saloutput = zeros(wid(
1
),wid(
2
));
saloutput(wid(
3
)
:wid
(
4
),wid(
5
)
:wid
(
6
)) = sal;
saloutput = uint8(saloutput*
255
);
saliency=saloutput;
% Output saliency map to file
imwrite(saliency, [SAL_DIR, imglist(imgno).name(
1
:end-
4
),
’_Saliency.png’
]);
salest=salest(
1
:spno
,
1
);
th1 = (mean(salest) + max(salest)) /
2
;
th2 = mean(salest);
mu = (
1
-alpha) / alpha;
[seeds, label] = seed4rw(salest, th1, th2);
[~, probabilities] = rrwr(img, superpixels, salest, seeds, label, mu);
sal = probabilities(
:
,
:
,
1
);
sal = (sal-min(sal(
:
)))/(max(sal(
:
))-min(sal(
:
)));
saloutput = zeros(wid(
1
),wid(
2
));
saloutput(wid(
3
)
:wid
(
4
),wid(
5
)
:wid
(
6
)) = sal;
saloutput = uint8(saloutput*
255
);
saliency=saloutput;
% Output saliency map to file
figure
subplot(
121
);
imshow(img);
title(
’原图’
)
subplot(
122
);
imshow(saliency) ; title(
’显著图’
)
imwrite(saliency, [SAL_DIR, imglist(imgno).name(
1
:end-
4
),
’_SaliencyOld.png’
]);
% imwrite(map, [SAL_DIR, imglist(imgno).name(
1
:end-
4
),
’_sal锟洁级BB.png’
]);
clearvars -except IMG_DIR SAL_DIR imglist imgno
end
3 仿真结果
4 参考文献
[1]Hao, Aimin, Shuai, et al. Structure-Sensitive Saliency Detection via Multilevel Rank Analysis in Intrinsic Feature Space[J]. IEEE Transactions on Image Processing, 2015, 24(8):2303-2316.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
