CN103198470B - Image cutting method and image cutting system - Google Patents
Image cutting method and image cutting system Download PDFInfo
- Publication number
- CN103198470B CN103198470B CN201310060703.9A CN201310060703A CN103198470B CN 103198470 B CN103198470 B CN 103198470B CN 201310060703 A CN201310060703 A CN 201310060703A CN 103198470 B CN103198470 B CN 103198470B
- Authority
- CN
- China
- Prior art keywords
- point
- image
- foreground
- weight
- pixel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
本发明提出一种图像的分割方法及系统。其中,方法包括以下步骤:提供待分割图像;从待分割图像的像素点中获取任意前景点和背景点,并对前景点和背景点进行标定;根据待分割图像的像素点以及标定的前景点和背景点构造流网络图;采用压入重标注方法对流网络图进行处理以得到最小割集,其中,最小割集为将待分割图像分割成前景和背景在流网络图中所需断开的相似性最小的边的集合;以及根据最小割集将待分割图像分割为前景区域和背景区域。根据本发明实施例的方法,通过构造待识别图像的流网络图,并对其进行压入和重标注,因此简化了算法的复杂度,同时适用于所有的图像方便了用户使用。
The invention provides an image segmentation method and system. Wherein, the method includes the following steps: providing the image to be segmented; obtaining any foreground point and background point from the pixels of the image to be segmented, and calibrating the foreground point and the background point; and background points to construct a flow network graph; use the push-in relabeling method to process the flow network graph to obtain the minimum cut set, where the minimum cut set is the segment that needs to be disconnected in the flow network graph to divide the image to be segmented into foreground and background A set of edges with the smallest similarity; and the image to be segmented is divided into a foreground area and a background area according to the minimum cut set. According to the method of the embodiment of the present invention, by constructing the flow network diagram of the image to be recognized, and pressing and relabeling it, the complexity of the algorithm is simplified, and it is applicable to all images, which is convenient for users to use.
Description
技术领域technical field
本发明涉及图像分割技术领域,特别涉及一种图像的分割方法及系统。The present invention relates to the technical field of image segmentation, in particular to an image segmentation method and system.
背景技术Background technique
数字图像指以二维数组形式表示的图像。数字图像可以由许多不同的输入设备和技术生成,例如,数码相机、扫描仪、坐标测量机等。起初利用计算机来处理图形和图像信息。如今,数字图像处理在国防、工农业生产、生活娱乐等多领域都有着广阔的应用。A digital image refers to an image represented in the form of a two-dimensional array. Digital images can be generated by many different input devices and technologies, for example, digital cameras, scanners, coordinate measuring machines, etc. At first, computers were used to process graphics and image information. Today, digital image processing has a wide range of applications in many fields such as national defense, industrial and agricultural production, and life and entertainment.
图像分割指的是将数字图像细分为多个图像子区域像素的集合的过程。其目的是简化或改变图像的表示形式,使得图像更容易理解和分析。图像分割在实际中的应用包括医学影像、在卫星图像中定位物体、人脸识别、交通控制系统等。Image segmentation refers to the process of subdividing a digital image into a collection of pixels in multiple image sub-regions. Its purpose is to simplify or change the representation of the image, making the image easier to understand and analyze. Practical applications of image segmentation include medical imaging, locating objects in satellite images, face recognition, traffic control systems, etc.
对图像分割算法的研究已有几十年的历史,借助各种理论提出了上千种各种类型的分割算法。但这些方法大都是针对具体问题的,因此无法通用于所有的图像,并且现有图像分割算法的复杂度有较高。The research on image segmentation algorithms has a history of several decades, and thousands of various types of segmentation algorithms have been proposed with the help of various theories. However, most of these methods are specific to specific problems, so they cannot be applied to all images, and the complexity of existing image segmentation algorithms is relatively high.
发明内容Contents of the invention
本发明的目的旨在至少解决上述的技术缺陷之一。The object of the present invention is to solve at least one of the above-mentioned technical drawbacks.
为达到上述目的,本发明一方面的实施例提出一种图像的分割方法,包括以下步骤:提供待分割图像;从所述待分割图像的像素点中获取任意前景点和背景点,并对所述前景点和背景点进行标定;根据所述待分割图像的像素点以及标定的所述前景点和背景点构造流网络图;采用压入重标注方法对所述流网络图进行处理以得到最小割集,其中,最小割集为将所述待分割图像分割成前景和背景在所述流网络图中所需断开的相似性最小的边的集合;以及根据所述最小割集将所述待分割图像分割为前景区域和背景区域。In order to achieve the above object, an embodiment of the present invention proposes an image segmentation method, including the following steps: providing an image to be segmented; obtaining any foreground point and background point from the pixels of the image to be segmented, and The foreground points and background points are calibrated; the flow network graph is constructed according to the pixels of the image to be segmented and the calibrated foreground points and background points; A cut set, wherein the minimum cut set is a set of edges with the minimum similarity that the image to be segmented is divided into foreground and background in the flow network diagram; and according to the minimum cut set, the The image to be segmented is divided into a foreground area and a background area.
根据本发明实施例的方法,通过构造待识别图像的流网络图,并对其进行压入和重标注,因此简化了算法的复杂度,同时适用于所有的图像方便了用户使用。According to the method of the embodiment of the present invention, by constructing the flow network diagram of the image to be recognized, and pressing and relabeling it, the complexity of the algorithm is simplified, and it is applicable to all images, which is convenient for users to use.
在本发明的一个实例中,在所述流网络图中,每个像素点与其相邻的像素点之间的边的权重为W(p,q),且除源点的相邻点和汇点的其他像素点与所述源点之间的边的权重以及除汇点的相邻点和源点的其他像素点与所述汇点之间的边的权重为常数,其中,所述源点为所述前景点,所述汇点为所述后景点。In an example of the present invention, in the flow network graph, the weight of the edge between each pixel point and its adjacent pixel points is W(p, q), and the weight of the edge between the adjacent points of the source point and the sink point The weights of the edges between other pixel points of the point and the source point and the weights of the edges between the adjacent points of the sink point and other pixel points of the source point and the sink point are constants, wherein the source The point is the foreground point, and the sink point is the back point.
在本发明的一个实例中,所述相邻像素点之间的权重W(p,q)通过如下公式表示,其中,dist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。In an example of the present invention, the weight W(p,q) between the adjacent pixels is represented by the following formula, Among them, dist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q.
在本发明的一个实例中,所述常数通过如下公式表示,其中,N(p)表示p点的相邻点集,V表示像素点的集合,W(p,q)表示点p,q之间边的权重。In an example of the present invention, the constant is represented by the following formula, Among them, N(p) represents the adjacent point set of point p, V represents the set of pixel points, and W(p, q) represents the weight of the edge between point p and q.
为达到上述目的,本发明的实施例另一方面提出一种图像的分割系统,包括:获取模块,用于提供待分割图像;标定模块,用于从所述待分割图像的像素点中获取任意前景点和背景点,并对所述前景点和背景点进行标定;构造模块,用于根据所述待分割图像的像素点以及标定的所述前景点和背景点构造流网络图;处理模块,用于采用压入重标注方法对所述流网络图进行处理以得到最小割集,其中,最小割集为将所述待分割图像分割成前景和背景在所述流网络图中所需断开的相似性最小的边的集合;以及分割模块,用于根据所述最小割集将所述待分割图像分割为前景区域和背景区域。In order to achieve the above purpose, an embodiment of the present invention proposes an image segmentation system on the other hand, including: an acquisition module, used to provide an image to be segmented; a calibration module, used to obtain any pixel point from the image to be segmented Foreground points and background points, and the foreground points and background points are calibrated; a construction module is used to construct a flow network diagram according to the pixel points of the image to be segmented and the marked foreground points and background points; a processing module, It is used to process the flow network diagram by using the push-in relabeling method to obtain a minimum cut set, wherein the minimum cut set is to divide the image to be segmented into foreground and background in the flow network diagram. A set of edges with the smallest similarity; and a segmentation module, configured to segment the image to be segmented into a foreground area and a background area according to the minimum cut set.
本发明的一个实例中,在所述流网络图中,每个像素点与其相邻的像素点之间的边的权重为W(p,q),且除源点的相邻点和汇点的其他像素点与所述源点之间的边的权重以及除汇点的相邻点和源点的其他像素点与所述汇点之间的边的权重为常数,其中,所述源点为所述前景点,所述汇点为所述后景点。In an example of the present invention, in the flow network diagram, the weight of the edge between each pixel and its adjacent pixels is W(p, q), and the adjacent points and sink points of the source point are divided The weights of the edges between other pixel points of and the source point and the weights of the edges between other pixel points except the adjacent points of the sink point and the source point and the sink point are constant, wherein the source point is the foreground point, and the sink point is the back point.
本发明的一个实例中,所述相邻像素点之间的权重W(p,q)通过如下公式表示,其中,sist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。In an example of the present invention, the weight W(p,q) between the adjacent pixels is represented by the following formula, Among them, sist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q.
在本发明的一个实例中,所述常数通过如下公式表示,其中,N(p)表示p点的相邻点集,V表示像素点的集合,W(p,q)表示点p,q之间边的权重。In an example of the present invention, the constant is represented by the following formula, Among them, N(p) represents the adjacent point set of point p, V represents the set of pixel points, and W(p, q) represents the weight of the edge between point p and q.
根据本发明实施例的系统,通过构造待识别图像的流网络图,并对其进行压入和重标注,因此简化了算法的复杂度,同时适用于所有的图像方便了用户使用。According to the system of the embodiment of the present invention, by constructing the flow network diagram of the image to be recognized, and pressing and relabeling it, the complexity of the algorithm is simplified, and it is applicable to all images, which is convenient for users to use.
本发明附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
附图说明Description of drawings
本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and easy to understand from the following description of the embodiments in conjunction with the accompanying drawings, wherein:
图1为根据本发明一个实施例的图像的分割方法的流程图;Fig. 1 is the flow chart of the segmentation method of an image according to one embodiment of the present invention;
图2为根据本发明一个实施例的待分割图像的边划分示意图;FIG. 2 is a schematic diagram of edge division of an image to be segmented according to an embodiment of the present invention;
图3为根据本发明一个实施例的待分割图像的分割示意图;以及FIG. 3 is a schematic diagram of segmentation of an image to be segmented according to an embodiment of the present invention; and
图4为根据本发明一个实施例的图像的分割系统的结构框图。Fig. 4 is a structural block diagram of an image segmentation system according to an embodiment of the present invention.
具体实施方式detailed description
下面详细描述本发明的实施例,实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures are exemplary only for explaining the present invention and should not be construed as limiting the present invention.
图1为根据本发明一个实施例的相似图像分类方法的流程图。如图1所示,根据本发明实施例的相似图像分类方法,包括以下步骤:Fig. 1 is a flowchart of a method for classifying similar images according to an embodiment of the present invention. As shown in Figure 1, the similar image classification method according to the embodiment of the present invention includes the following steps:
步骤S101,提供待分割图像。Step S101, providing an image to be segmented.
步骤S102,从待分割图像的像素点中获取任意前景点和背景点,并对前景点和背景点进行标定。Step S102, obtaining arbitrary foreground points and background points from the pixels of the image to be segmented, and marking the foreground points and background points.
具体地,在待分割图像中任意确定一个前景点和一个背景点。可采用交互式方式,或先验知识,例如四个角和中心区域中分别抽出一个点作为背景和前景点。Specifically, a foreground point and a background point are arbitrarily determined in the image to be segmented. An interactive method or prior knowledge can be used, such as extracting a point from the four corners and the center area as the background and foreground points respectively.
步骤S103,根据待分割图像的像素点以及标定的前景点和背景点构造流网络图。Step S103, constructing a flow network graph according to the pixel points of the image to be segmented and the marked foreground points and background points.
具体地,包括待分割图像中所有像素点的集合为顶点集V,并且以前景点S为源点,背景点T为汇点构造流网络图G=<V,E>。该流网络图G为无向带权图,且边E的权重表示该条边能通过的最大流量。Specifically, the set of all pixels in the image to be segmented is the vertex set V, and the former point of view S is used as the source point, and the background point T is used as the sink point to construct a flow network graph G=<V, E>. The flow network graph G is an undirected weighted graph, and the weight of the edge E represents the maximum flow that the edge can pass.
流网络图G的边集E的构成为,每一个像素点与其每一个相邻的像素点之间存在一条边,其中相邻的定义可以为4邻域(上下左右)或8邻域(4邻域外加左上、左下、右上、右下),例如,在图2中用细实线表示相邻边。待分割图像中相邻两点p,q间的边权重为W(p,q)可通过如下公式表示,其中,dist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。该距离dist(p,q)的可以通过欧式距离公式城市距离公式dist(p,q)=|xp-xq|+yp-yq|,或棋盘距离公式dist(p,q)=max(|xp-xq|,|yp-yq|)中的任意一种得出,其中,(xp,yp)和(xq,yq)分别表示点p和点q在图像中的坐标。The edge set E of the flow network graph G is composed of an edge between each pixel point and each adjacent pixel point, where the adjacent definition can be 4 neighborhoods (up, down, left, right) or 8 neighborhoods (4 Neighborhood plus upper left, lower left, upper right, lower right), for example, in Figure 2, the adjacent edges are represented by thin solid lines. The edge weight between two adjacent points p and q in the image to be segmented is W(p, q), which can be expressed by the following formula, Among them, dist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q. The distance dist(p,q) can be obtained by the Euclidean distance formula City distance formula dist(p,q)=|x p -x q |+y p -y q |, or chessboard distance formula dist(p,q)=max(|x p -x q |,|y p - y q |), where (x p , y p ) and (x q , y q ) represent the coordinates of point p and point q in the image, respectively.
除源点S的相邻点和汇点T的其他像素点与源点S之间的边(图2中用粗实线表示)的权重以及除汇点T的相邻点和源点S的其他像素点与汇点T之间的边(图2中用虚线表示)的权重为常数K可通过如下公式表示,其中,dist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。在此公式的含义为对于一个像素点求与其相邻像素点的边权重之和,遍历图像中的所有像素点,该和的最大值加1即为K。The weight of the edge (indicated by a thick solid line in Figure 2) between the adjacent points of the source point S and other pixel points of the sink point T and the source point S and the weight of the adjacent points of the sink point T and the source point S The weight of the edge between other pixels and the sink point T (indicated by the dotted line in Figure 2) is a constant K, which can be expressed by the following formula, Among them, dist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q. The meaning of the formula here is to calculate the sum of the edge weights of a pixel and its adjacent pixels, traverse all the pixels in the image, and add 1 to the maximum value of the sum to get K.
步骤S104,采用压入重标注方法对流网络图进行处理以得到最小割集,其中,最小割集为将待分割图像分割成前景和背景在流网络图中所需断开的相似性最小的边的集合。Step S104, process the flow network graph using the push-in relabeling method to obtain a minimum cut set, where the minimum cut set is the edge with the least similarity that needs to be disconnected in the flow network graph to divide the image to be segmented into foreground and background collection.
具体地,在构造流网络图中,每条边的权重大小表明该边连接的两个点的相似程度。背景点与前景点间的最小割集,代表着能将流网络图分割成前景和背景两部分需要断开的相似性最小的边的集合。求得该流网络的最小割,就等于求得了分割图像。根据流网络图论的基本定理,最小割的流量之和等于网络中的最大流。当流网络达到最大流时,会有一个割集的所有边都达到饱和状态,这个割集就是最小割。因此求解最小割转化为求解最大流。Specifically, in constructing the flow network graph, the weight of each edge indicates the degree of similarity between the two points connected by the edge. The minimum cut set between the background point and the foreground point represents the set of edges with the least similarity that need to be disconnected to divide the flow network graph into two parts, the foreground and the background. Obtaining the minimum cut of the flow network is equivalent to obtaining the segmented image. According to the fundamental theorem of flow network graph theory, the sum of the flows of the minimum cut is equal to the maximum flow in the network. When the flow network reaches the maximum flow, all edges of a cut set will be saturated, and this cut set is the minimum cut. Therefore, solving the minimum cut is transformed into solving the maximum flow.
压入重标注将顶点类比为水库,将边类比为水库间的管道,将边的权重类比为管道能通过的最大流量。水流从源点流出,经网络传播,最终流入汇点。每个水库有一定高度,水只能往低处流。每个水库的含水量为流入水库与流出水库的流量之差。Push-in relabeling compares vertices to reservoirs, edges to pipes between reservoirs, and edge weights to the maximum flow that the pipes can pass through. Water flows from a source, travels through the network, and finally flows into a sink. Each reservoir has a certain height, and water can only flow to low places. The water content of each reservoir is the difference between the flow into and out of the reservoir.
p,q表示流网络图G中的点:每个点的高度d(p);每个点的含水量e(p);两点间的流量F(p,q)。求解过程中,流网络上的流量,必须始终满足前述的流网络图G产生的限制条件。以图2为例,(1)流网络图G中两点有边直接相连时,两点间才允许存在流量,例如ab间允许存在流量,ac间不允许存在流量。(2)两点间的流量不得超过两点间边的权重,例如F(a,b)<=W(a,b),F(S,a)<=K,其中,F(p,q)表示点p和q间的流量,d(p)表示点p的高度,e(p)表示点p的含水量。p, q represent the points in the flow network graph G: the height d(p) of each point; the water content e(p) of each point; the flow F(p,q) between two points. During the solution process, the traffic on the flow network must always meet the constraints generated by the flow network graph G mentioned above. Take Figure 2 as an example. (1) When two points in the flow network graph G are directly connected by an edge, traffic is allowed between the two points. For example, traffic is allowed between ab and ac, but not between ac. (2) The flow between two points must not exceed the weight of the edge between two points, for example, F(a, b) <= W (a, b), F (S, a) <= K, where, F(p, q ) represents the flow rate between points p and q, d(p) represents the height of point p, and e(p) represents the water content of point p.
首先,将源点S的高度设为不小于N-1的值(N为流网络图G中点的数目),其余点的高度设为0,每个点的含水量设为0,且任意两点间的流量设为0。然后,对于与源点S相连的每一个点p,将该点的含水量设为二者间流量的上限,即边的权重,e(p)=W(S,p),并将二者间的流量设为二者间流量的上限,即F(S,p)=W(S,p)。流网络图中点进行压入或重标注。对于点p和点q,将水从点p压入点q的条件为,p点不是源点S或汇点T;p点仍有水,即e(p)>0;p和q间的管道仍有余量,即W(p,q)-F(p,q)>0;(4)q点的高度比p点的高度小1,即d(p)-d(q)=1。First, set the height of the source point S to a value not less than N-1 (N is the number of points in the flow network graph G), the height of the other points is set to 0, the water content of each point is set to 0, and any The flow between two points is set to 0. Then, for each point p connected to the source point S, the water content of the point is set as the upper limit of the flow between the two, that is, the weight of the edge, e(p)=W(S,p), and the two The flow between them is set as the upper limit of the flow between them, that is, F(S,p)=W(S,p). Points in the flow network diagram are pushed or relabeled. For point p and point q, the condition for pushing water from point p to point q is that point p is not source point S or sink point T; point p still has water, that is, e(p)>0; between p and q There is still a margin in the pipeline, that is, W(p,q)-F(p,q)>0; (4) The height of point q is 1 less than the height of point p, that is, d(p)-d(q)=1 .
对于点p和点q,将水从点p压入点q的步骤为,首先取p点含水量和pq间还能流过的水量的较小值,记为f,即f=min(e(p),W(p,q)-F(p,q))因此p点的含水量减少f,即e(p)=e(p)-f,而pq间的流量增加f,即F(p,q)=F(p,q)+f。For point p and point q, the steps to press water from point p to point q are: first, take the smaller value of the water content at point p and the amount of water that can still flow between pq, and record it as f, that is, f=min(e (p), W(p,q)-F(p,q)) Therefore, the water content at point p decreases by f, that is, e(p)=e(p)-f, and the flow between p and q increases by f, that is, F (p,q)=F(p,q)+f.
在本发明的一个实施例中,对点p进行重标注的条件为,(1)p点不是源点S或汇点T;(2)p点仍有水,即e(p)>0;(3)从p点到与其相连的点无法进行压入操作。对点p进行重标注的步骤为,首先找出与p相连且与p之间的管道还有余量的点集,用R(p)表示,即然后,将p的高度改为R(p)中最低点的高度加1,即 In one embodiment of the present invention, the conditions for relabeling point p are: (1) point p is not source point S or sink point T; (2) point p still has water, that is, e(p)>0; (3) The push operation cannot be performed from point p to the point connected to it. The step of relabeling point p is to first find out the point set that is connected to p and the pipeline between p and there is still a margin, which is represented by R(p), that is Then, change the height of p to the height of the lowest point in R(p) plus 1, i.e.
通过以上压入或重标注方法重复进行操作,当没有任何点满足压入或重标注条件时所得流网络图上的流量为最大流量。Repeat the operation through the above push-in or re-labeling methods, and when no point meets the push-in or re-labeling conditions, the flow on the resulting flow network graph is the maximum flow.
在此时的流网络图中,寻找能将流网络割断为本别包含源点S和汇点T两部分的最小割集,对应到真实图像中就是分割边界所在。具体地,在当前流网络图中,找到所有流量已达上限的边,即满足F(p,q)=W(p,q)的所有边,并将该边按流量从小到大的顺序逐步加入最小割集,直到将流网络图断开为分别包含源点S和汇点T的两部分。之后再,按流量从大到小的顺序在保证能将流网络图断开为两部分的情况下,逐步将最小割集中的冗余边删除,最终得到最小割集。In the flow network diagram at this time, find the minimum cut set that can cut the flow network into two parts including the source point S and the sink point T, corresponding to the real image is where the segmentation boundary is. Specifically, in the current flow network graph, find all the edges whose flow has reached the upper limit, that is, all edges that satisfy F(p,q)=W(p,q), and step by step the edges in the order of flow from small to large Join the minimum cut set until the flow network graph is broken into two parts including source S and sink T respectively. After that, according to the order of flow from large to small, under the condition that the flow network graph can be broken into two parts, the redundant edges in the minimum cut set are gradually deleted, and finally the minimum cut set is obtained.
步骤S105,根据最小割集将待分割图像分割为前景区域和背景区域。Step S105, segment the image to be segmented into a foreground area and a background area according to the minimum cut set.
如图3所示,当找到的最小割集包含(S,d)、(S,g)、(S,h)、(S,e)、(S,f)、(S,i)、(T,a)、(T,b)、(T,c)、(a,d)、(b,e)、(c,f)十二条边,则对应到待分割图像中,应在如图3所示的最粗横线位置进行分割,S、a、b、c构成前景区域,其余点构成背景区域。As shown in Figure 3, when the found minimum cut set contains (S, d), (S, g), (S, h), (S, e), (S, f), (S, i), ( T, a), (T, b), (T, c), (a, d), (b, e), (c, f) twelve sides, which correspond to the image to be segmented, should be in the The position of the thickest horizontal line shown in Figure 3 is segmented, S, a, b, and c form the foreground area, and the rest of the points form the background area.
根据本发明实施例的方法,通过构造待识别图像的流网络图,并对其进行压入和重标注,因此简化了算法的复杂度,同时适用于所有的图像方便了用户使用。According to the method of the embodiment of the present invention, by constructing the flow network diagram of the image to be recognized, and pressing and relabeling it, the complexity of the algorithm is simplified, and it is applicable to all images, which is convenient for users to use.
图4为根据本发明一个实施例的图像的分割系统的结构框图。如图4所示,根据本发明实施例的图像的分割系统包括获取模块100、标定模块200、构造模块300、处理模块400和分割模块500。Fig. 4 is a structural block diagram of an image segmentation system according to an embodiment of the present invention. As shown in FIG. 4 , the image segmentation system according to the embodiment of the present invention includes an acquisition module 100 , a calibration module 200 , a construction module 300 , a processing module 400 and a segmentation module 500 .
获取模块100用于提供待分割图像。The acquiring module 100 is used for providing an image to be segmented.
标定模块200用于从待分割图像的像素点中获取任意前景点和背景点,并对前景点和背景点进行标定。The marking module 200 is used to obtain any foreground point and background point from the pixel points of the image to be segmented, and to mark the foreground point and the background point.
具体地,在待分割图像中任意确定一个前景点和一个背景点。可采用交互式方式,或先验知识,例如四个角和中心区域中分别抽出一个点作为背景和前景点。Specifically, a foreground point and a background point are arbitrarily determined in the image to be segmented. An interactive method or prior knowledge can be used, such as extracting a point from the four corners and the center area as the background and foreground points respectively.
构造模块300用于根据待分割图像的像素点以及标定的前景点和背景点构造流网络图。The construction module 300 is used to construct a flow network graph according to the pixel points of the image to be segmented and the marked foreground points and background points.
具体地,包括待分割图像中所有像素点的集合为顶点集V,并且以前景点S为源点,背景点T为汇点构造流网络图G=<V,E>。该流网络图G为无向带权图,且边E的权重表示该条边能通过的最大流量。Specifically, the set of all pixels in the image to be segmented is the vertex set V, and the former point of view S is used as the source point, and the background point T is used as the sink point to construct a flow network graph G=<V, E>. The flow network graph G is an undirected weighted graph, and the weight of the edge E represents the maximum flow that the edge can pass.
流网络图G的边集E的构成为,每一个像素点与其每一个相邻的像素点之间存在一条边,其中相邻的定义可以为4邻域(上下左右)或8邻域(4邻域外加左上、左下、右上、右下),例如,在图2中用细实线表示相邻边。待分割图像中相邻两点p,q间的边权重为W(p,q)可通过如下公式表示,其中,dist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。该距离dist(p,q)的可以通过欧式距离公式城市距离公式dist(p,q)=|xp-xq|+yp-yq|,或棋盘距离公式dist(p,q)=max(|xp-xq|,|yp-yq|)中的任意一种得出,其中,(xp,yp)和(xq,yq)分别表示点p和点q在图像中的坐标。The edge set E of the flow network graph G is composed of an edge between each pixel point and each adjacent pixel point, where the adjacent definition can be 4 neighborhoods (up, down, left, right) or 8 neighborhoods (4 Neighborhood plus upper left, lower left, upper right, lower right), for example, in Figure 2, the adjacent edges are represented by thin solid lines. The edge weight between two adjacent points p and q in the image to be segmented is W(p, q), which can be expressed by the following formula, Among them, dist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q. The distance dist(p,q) can be obtained by the Euclidean distance formula City distance formula dist(p,q)=|x p -x q |+y p -y q |, or chessboard distance formula dist(p,q)=max(|x p -x q |,|y p - y q |), where (x p , y p ) and (x q , y q ) represent the coordinates of point p and point q in the image, respectively.
除源点S的相邻点和汇点T的其他像素点与源点S之间的边(图2中用粗实线表示)的权重以及除汇点T的相邻点和源点S的其他像素点与汇点T之间的边(图2中用虚线表示)的权重为常数K可通过如下公式表示,其中,dist(p,q)表示p和q之间的距离,σ表示调节参数,Ip表示p点的亮度,Iq表示q的点的亮度。在此公式的含义为对于一个像素点求与其相邻像素点的边权重之和,遍历图像中的所有像素点,该和的最大值加1即为K。The weight of the edge (indicated by a thick solid line in Figure 2) between the adjacent points of the source point S and other pixel points of the sink point T and the source point S and the weight of the adjacent points of the sink point T and the source point S The weight of the edge between other pixels and the sink point T (indicated by the dotted line in Figure 2) is a constant K, which can be expressed by the following formula, Among them, dist(p,q) represents the distance between p and q, σ represents the adjustment parameter, I p represents the brightness of point p, and I q represents the brightness of point q. The meaning of the formula here is to calculate the sum of the edge weights of a pixel and its adjacent pixels, traverse all the pixels in the image, and add 1 to the maximum value of the sum to get K.
处理模块400用于采用压入重标注方法对流网络图进行处理以得到最小割集,其中,最小割集为将待分割图像分割成前景和背景在流网络图中所需断开的相似性最小的边的集合。The processing module 400 is used to process the flow network graph by using the push-in relabeling method to obtain a minimum cut set, wherein the minimum cut set is to divide the image to be segmented into foreground and background with the minimum similarity of disconnection in the flow network graph The set of edges of .
具体地,在构造流网络图中,每条边的权重大小表明该边连接的两个点的相似程度。背景点与前景点间的最小割集,代表着能将流网络图分割成前景和背景两部分需要断开的相似性最小的边的集合。求得该流网络的最小割,就等于求得了分割图像。根据流网络图论的基本定理,最小割的流量之和等于网络中的最大流。当流网络达到最大流时,会有一个割集的所有边都达到饱和状态,这个割集就是最小割。因此求解最小割转化为求解最大流。Specifically, in constructing the flow network graph, the weight of each edge indicates the degree of similarity between the two points connected by the edge. The minimum cut set between the background point and the foreground point represents the set of edges with the least similarity that need to be disconnected to divide the flow network graph into two parts, the foreground and the background. Obtaining the minimum cut of the flow network is equivalent to obtaining the segmented image. According to the fundamental theorem of flow network graph theory, the sum of the flows of the minimum cut is equal to the maximum flow in the network. When the flow network reaches the maximum flow, all the edges of a cut set will be saturated, and this cut set is the minimum cut. Therefore, solving the minimum cut is transformed into solving the maximum flow.
压入重标注将顶点类比为水库,将边类比为水库间的管道,将边的权重类比为管道能通过的最大流量。水流从源点流出,经网络传播,最终流入汇点。每个水库有一定高度,水只能往低处流。每个水库的含水量为流入水库与流出水库的流量之差。Push-in relabeling compares vertices to reservoirs, edges to pipes between reservoirs, and edge weights to the maximum flow that the pipes can pass through. Water flows from a source, travels through the network, and finally flows into a sink. Each reservoir has a certain height, and water can only flow to low places. The water content of each reservoir is the difference between the flow into and out of the reservoir.
p,q表示流网络图G中的点:每个点的高度d(p);每个点的含水量e(p);两点间的流量F(p,q)。求解过程中,流网络上的流量,必须始终满足前述的流网络图G产生的限制条件。以图2为例,(1)流网络图G中两点有边直接相连时,两点间才允许存在流量,例如ab间允许存在流量,ac间不允许存在流量。(2)两点间的流量不得超过两点间边的权重,例如F(a,b)<=W(a,b),F(S,a)<=K,其中,F(p,q)表示点p和q间的流量,d(p)表示点p的高度,e(p)表示点p的含水量。p, q represent the points in the flow network graph G: the height d(p) of each point; the water content e(p) of each point; the flow F(p,q) between two points. During the solution process, the traffic on the flow network must always meet the constraints generated by the flow network graph G mentioned above. Take Figure 2 as an example. (1) When two points in the flow network graph G are directly connected by an edge, traffic is allowed between the two points. For example, traffic is allowed between ab and ac, but not between ac. (2) The flow between two points must not exceed the weight of the edge between two points, for example, F(a, b) <= W (a, b), F (S, a) <= K, where, F(p, q ) represents the flow rate between points p and q, d(p) represents the height of point p, and e(p) represents the water content of point p.
首先,将源点S的高度设为不小于N-1的值(N为流网络图G中点的数目),其余点的高度设为0,每个点的含水量设为0,且任意两点间的流量设为0。然后,对于与源点S相连的每一个点p,将该点的含水量设为二者间流量的上限,即边的权重,e(p)=W(S,p),并将二者间的流量设为二者间流量的上限,即F(S,p)=W(S,p)。流网络图中点进行压入或重标注。对于点p和点q,将水从点p压入点q的条件为,p点不是源点S或汇点T;p点仍有水,即e(p)>0;p和q间的管道仍有余量,即W(p,q)-F(p,q)>0;(4)q点的高度比p点的高度小1,即d(p)-d(q)=1。First, set the height of the source point S to a value not less than N-1 (N is the number of points in the flow network graph G), the height of the other points is set to 0, the water content of each point is set to 0, and any The flow between two points is set to 0. Then, for each point p connected to the source point S, the water content of the point is set as the upper limit of the flow between the two, that is, the weight of the edge, e(p)=W(S,p), and the two The flow between them is set as the upper limit of the flow between them, that is, F(S,p)=W(S,p). Points in the flow network diagram are pushed or relabeled. For point p and point q, the condition for pushing water from point p to point q is that point p is not source point S or sink point T; point p still has water, that is, e(p)>0; between p and q There is still a margin in the pipeline, that is, W(p,q)-F(p,q)>0; (4) The height of point q is 1 less than the height of point p, that is, d(p)-d(q)=1 .
对于点p和点q,将水从点p压入点q的步骤为,首先取p点含水量和pq间还能流过的水量的较小值,记为f,即f=min(e(p),W(p,q)-F(p,q))因此p点的含水量减少f,即e(p)=e(p)-f,而pq间的流量增加f,即F(p,q)=F(p,q)+f。For point p and point q, the steps to press water from point p to point q are: first, take the smaller value of the water content at point p and the amount of water that can still flow between pq, and record it as f, that is, f=min(e (p), W(p,q)-F(p,q)) Therefore, the water content at point p decreases by f, that is, e(p)=e(p)-f, and the flow between p and q increases by f, that is, F (p,q)=F(p,q)+f.
在本发明的一个实施例中,对点p进行重标注的条件为,(1)p点不是源点S或汇点T;(2)p点仍有水,即e(p)>0;(3)从p点到与其相连的点无法进行压入操作。对点p进行重标注的步骤为,首先找出与p相连且与p之间的管道还有余量的点集,用R(p)表示,即然后,将p的高度改为R(p)中最低点的高度加1,即 In one embodiment of the present invention, the conditions for relabeling point p are: (1) point p is not source point S or sink point T; (2) point p still has water, that is, e(p)>0; (3) The push operation cannot be performed from point p to the point connected to it. The step of relabeling point p is to first find out the point set that is connected to p and the pipeline between p and there is still a margin, which is represented by R(p), that is Then, change the height of p to the height of the lowest point in R(p) plus 1, i.e.
通过以上压入或重标注方法重复进行操作,当没有任何点满足压入或重标注条件时所得流网络图上的流量为最大流量。Repeat the operation through the above push-in or re-labeling methods, and when no point meets the push-in or re-labeling conditions, the flow on the resulting flow network graph is the maximum flow.
在此时的流网络图中,寻找能将流网络割断为本别包含源点S和汇点T两部分的最小割集,对应到真实图像中就是分割边界所在。具体地,在当前流网络图中,找到所有流量已达上限的边,即满足F(p,q)=W(p,q)的所有边,并将该边按流量从小到大的顺序逐步加入最小割集,直到将流网络图断开为分别包含源点S和汇点T的两部分。之后再,按流量从大到小的顺序在保证能将流网络图断开为两部分的情况下,逐步将最小割集中的冗余边删除,最终得到最小割集。In the flow network diagram at this time, find the minimum cut set that can cut the flow network into two parts including the source point S and the sink point T, corresponding to the real image is where the segmentation boundary is. Specifically, in the current flow network graph, find all the edges whose flow has reached the upper limit, that is, all edges that satisfy F(p,q)=W(p,q), and step by step the edges in the order of flow from small to large Join the minimum cut set until the flow network graph is broken into two parts including source S and sink T respectively. After that, according to the order of flow from large to small, under the condition that the flow network graph can be broken into two parts, the redundant edges in the minimum cut set are gradually deleted, and finally the minimum cut set is obtained.
分割模块500用于根据最小割集将待分割图像分割为前景区域和背景区域。The segmentation module 500 is used to segment the image to be segmented into a foreground area and a background area according to the minimum cut set.
如图3所示,当找到的最小割集包含(S,d)、(S,g)、(S,h)、(S,e)、(S,f)、(S,i)、(T,a)、(T,b)、(T,c)、(a,d)、(b,e)、(c,f)十二条边,则对应到待分割图像中,应在如图3所示的最粗横线位置进行分割,S、a、b、c构成前景区域,其余点构成背景区域。As shown in Figure 3, when the found minimum cut set contains (S, d), (S, g), (S, h), (S, e), (S, f), (S, i), ( T, a), (T, b), (T, c), (a, d), (b, e), (c, f) twelve sides, which correspond to the image to be segmented, should be in the The position of the thickest horizontal line shown in Figure 3 is segmented, S, a, b, and c form the foreground area, and the rest of the points form the background area.
根据本发明实施例的方法,通过构造待识别图像的流网络图,并对其进行压入和重标注,因此简化了算法的复杂度,同时适用于所有的图像方便了用户使用。According to the method of the embodiment of the present invention, by constructing the flow network diagram of the image to be recognized, and pressing and relabeling it, the complexity of the algorithm is simplified, and it is applicable to all images, which is convenient for users to use.
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在不脱离本发明的原理和宗旨的情况下在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be construed as limitations to the present invention. Variations, modifications, substitutions, and modifications to the above-described embodiments are possible within the scope of the present invention.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310060703.9A CN103198470B (en) | 2013-02-26 | 2013-02-26 | Image cutting method and image cutting system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310060703.9A CN103198470B (en) | 2013-02-26 | 2013-02-26 | Image cutting method and image cutting system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103198470A CN103198470A (en) | 2013-07-10 |
CN103198470B true CN103198470B (en) | 2017-02-15 |
Family
ID=48720976
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310060703.9A Expired - Fee Related CN103198470B (en) | 2013-02-26 | 2013-02-26 | Image cutting method and image cutting system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103198470B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104737151A (en) * | 2013-08-28 | 2015-06-24 | 华为技术有限公司 | Method and device for complex graph processing |
CN104134192A (en) * | 2014-07-23 | 2014-11-05 | 中国科学院深圳先进技术研究院 | Image defogging method and system |
CN107204034B (en) | 2016-03-17 | 2019-09-13 | 腾讯科技(深圳)有限公司 | A kind of image processing method and terminal |
CN106204600A (en) * | 2016-07-07 | 2016-12-07 | 广东技术师范学院 | Cerebral tumor image partition method based on multisequencing MR image related information |
CN106920244B (en) * | 2017-01-13 | 2019-08-02 | 广州中医药大学 | A kind of method of the neighbouring background dot of detection image edges of regions |
CN109740658B (en) * | 2018-12-28 | 2023-04-18 | 陕西师范大学 | Semi-supervised image classification method based on weighted graph |
CN111277902B (en) * | 2020-02-17 | 2022-03-25 | 北京达佳互联信息技术有限公司 | Video matching method, device and equipment |
CN113139976B (en) * | 2021-04-20 | 2024-07-12 | 上海科技大学 | Maximum flow minimum cut solving algorithm capable of being terminated in advance based on indentation and re-marking |
CN116258725B (en) * | 2023-05-16 | 2023-08-22 | 福建自贸试验区厦门片区Manteia数据科技有限公司 | Medical image processing method and device based on feature images and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7190809B2 (en) * | 2002-06-28 | 2007-03-13 | Koninklijke Philips Electronics N.V. | Enhanced background model employing object classification for improved background-foreground segmentation |
CN101101668A (en) * | 2007-07-13 | 2008-01-09 | 杭州电子科技大学 | A Medical Image Segmentation Method Based on Oscillation Network |
US8175379B2 (en) * | 2008-08-22 | 2012-05-08 | Adobe Systems Incorporated | Automatic video image segmentation |
CN102467740A (en) * | 2010-11-08 | 2012-05-23 | 北京大学 | Foreground and background interactive segmentation method of large-size color image and system thereof |
CN102270338B (en) * | 2011-06-27 | 2013-07-31 | 西安交通大学 | Method for effectively segmenting repeated object based on image representation improvement |
-
2013
- 2013-02-26 CN CN201310060703.9A patent/CN103198470B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN103198470A (en) | 2013-07-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103198470B (en) | Image cutting method and image cutting system | |
CN111832655B (en) | A Multi-scale 3D Object Detection Method Based on Feature Pyramid Network | |
CN112257609B (en) | A vehicle detection method and device based on adaptive key point heatmap | |
CN103413133B (en) | Automatically-extracting power line method in random laser point cloud data | |
CN108229425A (en) | A kind of identifying water boy method based on high-resolution remote sensing image | |
CN108648161A (en) | The binocular vision obstacle detection system and method for asymmetric nuclear convolutional neural networks | |
CN105184779B (en) | One kind is based on the pyramidal vehicle multiscale tracing method of swift nature | |
CN108537814A (en) | A kind of three-dimensional sonar point cloud chart based on ViBe is as dividing method | |
CN104036479B (en) | Multi-focus image fusion method based on non-negative matrix factorization | |
CN106918813A (en) | A kind of three-dimensional sonar point cloud chart image intensifying method based on distance statistics | |
CN103049914A (en) | Boundary-based high-resolution depth map generation | |
CN103366353A (en) | Infrared image and visible-light image fusion method based on saliency region segmentation | |
CN103577875A (en) | CAD (computer-aided design) people counting method based on FAST (features from accelerated segment test) | |
CN110942071A (en) | License plate recognition method based on license plate classification and LSTM | |
CN107392968A (en) | The image significance detection method of Fusion of Color comparison diagram and Color-spatial distribution figure | |
CN103903234B (en) | A kind of real time imaging defogging method based on image depth | |
CN103337073B (en) | A kind of two dimensional image threshold segmentation method based on three-dimensional entropy | |
CN109034083A (en) | A kind of natural Extracting costline method and apparatus based on more scape remote sensing images | |
CN106097313A (en) | Image partition method and device | |
CN102567964B (en) | Filtering method for stereoscopic vision parallax image | |
CN116343188A (en) | STN-pan network-based transmission tower signboard text detection and identification method | |
CN105606123A (en) | A Method for Automatic Correction of Digital Ground Elevation Model in Low Altitude Aerial Photogrammetry | |
CN103927523B (en) | A Foggy Level Detection Method Based on Longitudinal Gray Scale Feature | |
CN110110946A (en) | Water quality prediction early warning system and its implementation based on anisotropy Delaunay subdivision | |
CN103632365B (en) | A kind of stereoscopic image disparity estimation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170215 |