-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathInitialSegmentation_NoCNN.m
44 lines (33 loc) · 1.04 KB
/
InitialSegmentation_NoCNN.m
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 [BasicSal,Sal,bbox] =InitialSegmentation_NoCNN(Params)
global supth;
SeedSup = Pix2SupTh(Params.PriorSal, Params.Label,supth);
EdgSup =zeros(size(SeedSup));
EdgSup(SeedSup==0) = 1;
[L, Sal]=AMCSegmentation(double(Params.img), Params.Label, Params.SupCol,EdgSup, Params.Ncol);
global multiplier;
global rowind;
global colind;
BasicSal= zeros(Params.orgrow,Params.orgcol);
BasicSal(rowind, colind)=imgnormalize(L);
sth = mean(BasicSal(:))*multiplier;
BasicSal(BasicSal<sth) =0;
BasicSal(BasicSal>=sth) =1;
Sal(Sal<sth)=0;
global oldCol;
global oldLabel;
oldCol =Params.SupCol;
oldLabel = Sal>0;
global targethist;
global nbins;
targethist = rgbhist_fast(Params.img,sup2pixel2(double(oldLabel),Params.Label),nbins,1);
figure(1);
subplot(2,1,1);
imshow(uint8(Params.img));
subplot(2,1,2);
imshow(BasicSal(rowind,colind),[]);
drawnow();
[xx, yy]= meshgrid(1:Params.orgcol,1:Params.orgrow);
xs =xx(BasicSal>0);
ys =yy(BasicSal>0);
bbox = [min(ys); min(xs); max(ys); max(xs)];
save([Params.salcpath num2str(Params.ff,'%04d') '.mat'], 'BasicSal','bbox');