forked from YuejiaoGong/PDP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveSaliencyMap.m
More file actions
44 lines (34 loc) · 996 Bytes
/
SaveSaliencyMap.m
File metadata and controls
44 lines (34 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function salMap = SaveSaliencyMap(feaVec, pixelList, frameRecord, imgName, doNormalize, fill_value)
% Fill back super-pixel values to image pixels and save into .png images
% Code Author: Wangjiang Zhu
% Email: wangjiang88119@gmail.com
% Date: 3/24/2014
if (~iscell(pixelList))
error('pixelList should be a cell');
end
if (~ischar(imgName))
error('imgName should be a string');
end
if (nargin < 5)
doNormalize = true;
end
if (nargin < 6)
fill_value = 0;
end
h = frameRecord(1);
w = frameRecord(2);
top = frameRecord(3);
bot = frameRecord(4);
left = frameRecord(5);
right = frameRecord(6);
partialH = bot - top + 1;
partialW = right - left + 1;
partialImg = CreateImageFromSPs(feaVec, pixelList, partialH, partialW, doNormalize);
if partialH ~= h || partialW ~= w
feaImg = ones(h, w) * fill_value;
feaImg(top:bot, left:right) = partialImg;
salMap = feaImg;
else
salMap = partialImg;
end
imwrite(salMap, imgName);