Step
𝟏
:
Dynamic thresholding
for
𝑖
=
1
to
𝑊
do
for
𝑗
=
1
to
𝑊
do
if
|
𝑝
𝑖
,
𝑗
𝑙
/
𝑟
−
𝑐
𝑙
/
𝑟
|
<
𝑇
𝑑
(
𝑥
,
𝑦
)
then
set
𝐁
𝑖
,
𝑗
𝑙
/
𝑟
to
1
end if
end for
end for
Step
𝟐
:
Dilation
Dilate
𝐁
𝑙
/
𝑟
with
3
×
3
squared structured element
Step
𝟑
:
Imposing connectivity
for
𝑖
=
1
to
𝑊
do
for
𝑗
=
1
to
𝑊
do
if
𝐁
𝑖
,
𝑗
𝑙
/
𝑟
=
1
and not connected to
𝐁
𝑤
+
1
,
𝑤
+
1
𝑙
/
𝑟
then
set
𝐁
𝑖
,
𝑗
𝑙
/
𝑟
to
0
end if
end for
end for
Algorithm 1:
Adaptive local segmentation for reference pixel
𝐼
𝑙
(
𝑥
,
𝑦
)
.