forked from YuejiaoGong/PDP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPDP_singleLayer.m
More file actions
36 lines (32 loc) · 1.72 KB
/
PDP_singleLayer.m
File metadata and controls
36 lines (32 loc) · 1.72 KB
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
function salMap = PDP_singleLayer(levelImg, superlabels, adjcMatrix, pixelList, levelIndex,RES, noSuffixName,frameRecord)
idxImg= superlabels{levelIndex};
[h, w] = size(idxImg);
smImg = imresize(levelImg, 0.4);
smImg = double(smImg)/255;
trans = CalDepthMap(smImg, 0.95, 5);
depthMap = imresize(trans, [h w]);
minVal = min(depthMap(:));
maxVal = max(depthMap(:));
depthMap = (depthMap - minVal) / (maxVal - minVal + eps);
% imshow(depthMap);
%% Get superpixel properties
%%%% the weights of features has small influence, comment by xxl
spNum = size(adjcMatrix, 1);
[meanPos, meanLabCol, meanDepth] = ...
GetSuperpixelProperties(pixelList, spNum, h, w, levelImg, depthMap);
bdIds = GetBndPatchIds(idxImg);
histLab = GetLabHist(pixelList, levelImg, spNum);
colDistM1 = GetDistanceMatrix(meanLabCol);
colDistM = (GetDistanceMatrix(meanLabCol) + GetX2DistanceMatrix(histLab) * 10)/2;
posDistM = GetDistanceMatrix(meanPos);
histWLD = GetWLDFeatures(pixelList, levelImg, spNum);
histLM = GetLMFeatures(pixelList, levelImg, spNum);
texDistM = (GetX2DistanceMatrix(histLM) + GetX2DistanceMatrix(histWLD))/2;
%% Main procedures
bdCon = BoundaryConnectivity(adjcMatrix, colDistM1, bdIds);
[refDepthSharp, refDepthSoft] = RefineDepth(meanDepth, bdCon);
bgProb = CalBackgroundProbability(refDepthSharp);
[~,~,~,~, wCtrF]= CalForegroundContrast(colDistM, posDistM, texDistM, bgProb, refDepthSoft);
fusedCtr = SaliencyFusionViaOptimization(bgProb, wCtrF, adjcMatrix, bdIds, colDistM, spNum);
salMap = CreateImageFromSPs(fusedCtr, pixelList, h, w, true);
end