Skip to content

Commit 7592b46

Browse files
Image-segmentation (#14)
* Image-segmentation * fix lint Co-authored-by: wangnengjie <751614701@qq.com>
1 parent 6ef3281 commit 7592b46

6 files changed

Lines changed: 60 additions & 0 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ TEX=\
77
$(SRC)/Network-flows.tex\
88
$(SRC)/Ln9-NearestPoints.tex\
99
$(SRC)/Ln11-LargeIntegerMultiplication.tex\
10+
$(SRC)/Image-segmentation.tex\
1011

1112
all: book.pdf
1213
.PHONY: all clean dev clean-all

book.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
\input{src/Ln11-LargeIntegerMultiplication.tex}
4040
\input{src/dynamic-programming-1.tex}
4141
\input{src/Network-flows.tex}
42+
\input{src/Image-segmentation.tex}
4243

4344
\bibliography{ref.bib}
4445
\end{document}

image/Image-segmentation1.png

215 KB
Loading

image/Image-segmentation2.png

5.39 KB
Loading

image/Image-segmentation3.png

42.9 KB
Loading

src/Image-segmentation.tex

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
\chapter{网络流应用之图像分割}
2+
3+
4+
\centering 本章简单介绍网络流在图像分割上的应用。
5+
6+
7+
\begin{definition}{背景知识}{def1}
8+
图像是可以看作由一个个像素组成的巨大图, 将像素一一用边连接起来, 则这些像素点会成为这个巨大图网络的顶点.
9+
一个图由前景和背景组成, 假设顶点上的值用 $a_i$ 表示, $ 0 \leq a_i \leq 1 $, $a_i$ 趋近于 0 表示 $a_i$ 为图的背景, $a_i$ 趋近于 1 表示 $a_i$ 为图的前景, 并且设所有属于前景的顶点 $a_i$ 构成集合 A, 所有属于背景的顶点 $a_j$ 构成集合 B.
10+
假设边上的值用 $w_{ij}$ 表示, $w_{ij}$ 设为边的惩罚值, $w_{ij}$ 趋向于 0 表示“分离” (即 $w_{ij}$ 连接的两个点分别属于前景和背景), $w_{ij}$ 趋向于 1 表示“在一起” (即 $w_{ij}$ 连接的两个点都属于前景或者背景)
11+
设总的惩罚值为 $ A = \min\left(\sum_{i \epsilon B}a_i + \sum_{i \epsilon A}(1 - a_j) + \sum_{i \epsilon A, j \epsilon B}w_{ij} \right) $
12+
\end{definition}
13+
14+
15+
\section{问题实例}
16+
\subsection{问题描述}
17+
\begin{itemize}
18+
\item 对于下面这个图,利用网络流求解该图前景和背景的最大可能
19+
\end{itemize}
20+
21+
\begin{figure}[htb]
22+
\centering
23+
\includegraphics[scale=0.6]{image/Image-segmentation2.png}
24+
\caption{图片前景背景识别}\label{fig1}
25+
\end{figure}
26+
27+
\subsection{思路描述}
28+
\begin{itemize}
29+
\item 图形切割算法通过向图 G (V,E) 添加 S 点和 T 点,将图中所有的顶点,与 S 和 T 建立边,
30+
如果一个点与 S 相连,则对应边的权值为该点的值 $a_i$, 如果一个点与 T 相连,则对应边的权值为1减去该点的值 $ 1 - a_j $
31+
可以得到下面这个图:
32+
\end{itemize}
33+
34+
\begin{figure}[htb]
35+
\centering
36+
\includegraphics[height=4.5cm]{image/Image-segmentation3.png}
37+
\caption{图片前景背景识别}\label{fig2}
38+
\end{figure}
39+
40+
\begin{itemize}
41+
\item 根据最大流最小割, 可以得到得到二分图的最大匹配, 可以得到集合A和B, 保证总的惩罚值 $ A = \min\left(\sum_{i \epsilon B}a_i + \sum_{i \epsilon A}(1 - a_j) + \sum_{i \epsilon A, j \epsilon B}w_{ij} \right) $ 最小,
42+
最小为 $(0.2 + 0.1) + (1 - 0.9) + (1 - 0.8) + 0.3 + 0.3 = 1.2 $, 而 A 和 B 分别对应图的前景和背景。
43+
\end{itemize}
44+
45+
46+
47+
\section{问题扩展}
48+
\begin{itemize}
49+
\item 假如一个图的前景不是一个整体,
50+
而是有两个分开的部分,比如两只在两个不同位置的猫在一个图中。
51+
这样一个算法能否将图像上的前景和背景分开?
52+
\end{itemize}
53+
54+
\begin{figure}[htb]
55+
\centering
56+
\includegraphics[scale=0.6]{image/Image-segmentation1.png}
57+
\caption{图片前景背景识别}\label{fig3}
58+
\end{figure}

0 commit comments

Comments
 (0)