CN111986111B - An Image Segmentation Method - Google Patents
An Image Segmentation Method Download PDFInfo
- Publication number
- CN111986111B CN111986111B CN202010834179.6A CN202010834179A CN111986111B CN 111986111 B CN111986111 B CN 111986111B CN 202010834179 A CN202010834179 A CN 202010834179A CN 111986111 B CN111986111 B CN 111986111B
- Authority
- CN
- China
- Prior art keywords
- pixel
- pixel boundary
- points
- image
- boundary point
- 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.)
- Active
Links
- 238000003709 image segmentation Methods 0.000 title claims abstract description 20
- 238000000034 method Methods 0.000 title claims abstract description 14
- 230000000717 retained effect Effects 0.000 description 4
- 230000011218 segmentation Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明涉及图像处理领域,特别涉及一种图像分割方法。The invention relates to the field of image processing, in particular to an image segmentation method.
背景技术Background technique
图像分割是将特定的、具有独特性质的区域并提出感兴趣目标的技术和过程,是由图像处理到图像分析的关键步骤。在目前的图像分割中,五分是分割出一个图像还是多个图像,都会将要分割的图像进行整体的扫描,最终在能得到要分割的图像,这样每次在分割的时候,就需要进行大量的运算,使得在图像分割的时候时间较长。Image segmentation is the technology and process of identifying specific and unique regions and proposing objects of interest. It is a key step from image processing to image analysis. In the current image segmentation, whether to segment one image or multiple images, the image to be segmented will be scanned as a whole, and finally the image to be segmented can be obtained, so that each time it is segmented, a large number of The operation makes the image segmentation time longer.
发明内容Contents of the invention
本发明的目的是克服上述现有技术中存在的问题,提供一种图像分割方法,通过扫描得到一个可以分割的点,在通过在该分割点的相邻的周围进行扫描,使得得到与之相邻的分割点,最后在将所有的分割点相连接,即可以得到要分割的图像。The purpose of the present invention is to overcome the problems existing in the above-mentioned prior art, and provide a kind of image segmentation method, obtain a point that can be segmented by scanning, and scan the adjacent surroundings of the segmented point, so that a corresponding image can be obtained. The adjacent segmentation points, and finally connect all the segmentation points to get the image to be segmented.
为此,本发明提供一种图像分割方法,包括如下步骤:For this reason, the invention provides a kind of image segmentation method, comprises the steps:
S1:将要分割的图像的所有像素点进行分离,并在每相邻的两个像素点之间插入一个像素分界点,使得每一个像素分界点的周围都是该图像的像素点,并获取所有像素分界点的坐标。S1: Separate all pixels of the image to be segmented, and insert a pixel boundary point between every two adjacent pixels, so that each pixel boundary point is surrounded by pixels of the image, and obtain all Coordinates of pixel breakpoints.
S2:依次按照设定的扫描路径扫描像素分界点。S2: Scanning pixel boundary points sequentially according to the set scanning path.
S3:在扫描每一个像素分界点的时候,分别获取该像素分界点周围每一个像素点的像素值,并对该像素分界点周围的相邻两个像素点的像素值进行比较,当相邻两个像素点的像素值之差大于设定的数值的时候,则留取该像素分界点的坐标并进入步骤S4,否则,进入步骤S2。S3: When scanning each pixel boundary point, obtain the pixel value of each pixel point around the pixel boundary point, and compare the pixel values of two adjacent pixel points around the pixel boundary point, when adjacent When the difference between the pixel values of two pixel points is larger than the set value, the coordinates of the boundary point of the pixel are saved and step S4 is entered; otherwise, step S2 is entered.
S4:获取该像素分界点周围的像素分界点,并扫描该像素分界点周围的像素分界点,并执行步骤S3,直至再次留取的像素分界点的坐标为该像素分界点的坐标。S4: Obtain the pixel boundary points around the pixel boundary point, scan the pixel boundary points around the pixel boundary point, and execute step S3 until the coordinates of the pixel boundary points that are obtained again are the coordinates of the pixel boundary point.
S5:将所有留取的坐标连接成线,并按照该线对图像进行分割,最后去除该图像中所有的像素分界点。S5: Connect all the retained coordinates into a line, and segment the image according to the line, and finally remove all pixel boundary points in the image.
进一步,在步骤S2中,起始的扫描位置为任意一个像素分界点所在的位置。Further, in step S2, the initial scanning position is the position where any pixel boundary point is located.
更进一步,设定的路径为螺旋形路径。Furthermore, the set path is a spiral path.
进一步,在步骤S1中,在获取像素分界点的坐标的时候,为所有的像素分界点统一分配坐标,相邻的两个像素分界点的坐标中,横坐标之差或者纵坐标之差的绝对值为1。Further, in step S1, when obtaining the coordinates of the pixel boundary points, coordinates are uniformly assigned to all pixel boundary points. In the coordinates of two adjacent pixel boundary points, the absolute difference between the difference in abscissa or the difference in ordinate The value is 1.
进一步,在步骤S1之前,对要处理的图像进行去噪处理。Further, before step S1, denoising processing is performed on the image to be processed.
本发明提供的一种图像分割方法,具有如下有益效果:通过扫描得到一个可以分割的点,在通过在该分割点的相邻的周围进行扫描,使得得到与之相邻的分割点,最后在将所有的分割点相连接,即可以得到要分割的图像。An image segmentation method provided by the present invention has the following beneficial effects: a point that can be segmented is obtained by scanning, and by scanning around the adjacent segment of the segmented point, the segmented point adjacent to it is obtained, and finally the Connect all the segmentation points to get the image to be segmented.
附图说明Description of drawings
图1为本发明的整体流程示意框图。Fig. 1 is a schematic block diagram of the overall process of the present invention.
具体实施方式Detailed ways
下面结合附图,对本发明的一个具体实施方式进行详细描述,但应当理解本发明的保护范围并不受具体实施方式的限制。A specific embodiment of the present invention will be described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific embodiment.
在本申请文件中,未经明确的部件型号以及结构,均为本领域技术人员所公知的现有技术,本领域技术人员均可根据实际情况的需要进行设定,在本申请文件的实施例中不做具体的限定。In this application document, unspecified component models and structures are all prior art known to those skilled in the art, and those skilled in the art can set them according to the needs of the actual situation. In the embodiments of this application document No specific restrictions are made.
具体的,如图1所示,本发明实施例提供了一种图像分割方法,包括如下步骤:Specifically, as shown in FIG. 1, an embodiment of the present invention provides an image segmentation method, including the following steps:
S1:将要分割的图像的所有像素点进行分离,并在每相邻的两个像素点之间插入一个像素分界点,使得每一个像素分界点的周围都是该图像的像素点,并获取所有像素分界点的坐标。S1: Separate all pixels of the image to be segmented, and insert a pixel boundary point between every two adjacent pixels, so that each pixel boundary point is surrounded by pixels of the image, and obtain all Coordinates of pixel breakpoints.
该步骤中,将相邻的两个像素点之间使用点插入算法插入一个像素分界点,将图像的各个像素点遍历之后,就可以得到一个新的图像,在新的图像中,没两个相邻的像素点之间都有一个像素分界点,使得每一个像素点都被相邻的像素分界点所包围,每一个像素点都会相邻一个像素分界点,每一个像素分界点都会相邻一个像素点。In this step, a pixel boundary point is inserted between two adjacent pixel points using a point insertion algorithm. After traversing each pixel point of the image, a new image can be obtained. In the new image, no two There is a pixel boundary point between adjacent pixel points, so that each pixel point is surrounded by adjacent pixel boundary points, each pixel point is adjacent to a pixel boundary point, and each pixel boundary point is adjacent a pixel.
S2:依次按照设定的扫描路径扫描像素分界点。S2: Scanning pixel boundary points sequentially according to the set scanning path.
该步骤中,扫描路径可以使用S型路径,也可以是有螺旋形路径,总之,该路径需要遍历到每一个像素分界点。遍历像素分割点的最佳的方式是使用S型路径,因为S型路径可以遍历每一个像素分界点,且每一个像素分界点只扫描一次。In this step, the scanning path may use an S-shaped path or a spiral path. In short, the path needs to traverse to each pixel boundary point. The best way to traverse the pixel division points is to use the S-type path, because the S-type path can traverse each pixel boundary point, and each pixel boundary point is scanned only once.
S3:在扫描每一个像素分界点的时候,分别获取该像素分界点周围每一个像素点的像素值,并对该像素分界点周围的相邻两个像素点的像素值进行比较,当相邻两个像素点的像素值之差大于设定的数值的时候,则留取该像素分界点的坐标并进入步骤S4,否则,进入步骤S2。S3: When scanning each pixel boundary point, obtain the pixel value of each pixel point around the pixel boundary point, and compare the pixel values of two adjacent pixel points around the pixel boundary point, when adjacent When the difference between the pixel values of two pixel points is greater than the set value, the coordinates of the boundary point of the pixel are retained and enter step S4, otherwise, enter step S2.
该步骤中,对像素分界点周围的像素点的值进行判断,根据周围的像素点的像素值的差值判断该像素点分界点是否为图像可以分割的图像分割线处,当相邻两个像素点的像素值之差大于设定的数值的时候,认为像素点分界点的为图像可以分割的图像分割线处。若不是,则继续进入步骤S2中进行下一个像素分界点的扫描。In this step, judge the value of the pixel points around the pixel boundary point, and judge whether the pixel point boundary point is the image dividing line where the image can be divided according to the difference between the pixel values of the surrounding pixel points. When two adjacent When the difference between the pixel values of the pixel is greater than the set value, it is considered that the boundary point of the pixel is the image dividing line where the image can be divided. If not, proceed to step S2 to scan the next pixel boundary point.
S4:获取该像素分界点周围的像素分界点,并扫描该像素分界点周围的像素分界点,并执行步骤S3,直至再次留取的像素分界点的坐标为该像素分界点的坐标。S4: Obtain the pixel boundary points around the pixel boundary point, scan the pixel boundary points around the pixel boundary point, and execute step S3 until the coordinates of the pixel boundary points that are obtained again are the coordinates of the pixel boundary point.
该步骤中,在已经得到一个像素分界点为符合条件的像素分界点的时候,使得扫描其周围的相邻的像素分界点,这样就沿着其中的一个符合要求的像素分界点,快速的得到其他符合要求的像素分界点。In this step, when a pixel boundary point has been obtained as a qualified pixel boundary point, the adjacent pixel boundary points around it are scanned, so that along one of the pixel boundary points that meets the requirements, quickly obtain Other pixel demarcation points that meet the requirements.
S5:将所有留取的坐标连接成线,并按照该线对图像进行分割,最后去除该图像中所有的像素分界点。S5: Connect all the retained coordinates into a line, and segment the image according to the line, and finally remove all pixel boundary points in the image.
该步骤中,所有留取的像素点分界点的坐标连接成线即是图像分割线,按照该分割线进行分割,即可以得到分割后的图像,最后,在将图像中所有的像素分界点全部去除,就得到了原有的图像分割后的图像。In this step, the coordinates of all the retained pixel boundary points are connected into a line, which is the image segmentation line, and the segmented image can be obtained by dividing according to the segmentation line. Finally, all the pixel boundary points in the image are all The image after the original image segmentation is obtained.
在本实施例中,在步骤S2中,起始的扫描位置为任意一个像素分界点所在的位置。该方案适用于螺旋形路径,这样可以使得运算的数量进行大量的减小,而对于S型路径,建议从图像的角顶点开始进行扫描。In this embodiment, in step S2, the initial scanning position is the position where any pixel boundary point is located. This solution is suitable for a spiral path, which can greatly reduce the number of operations, and for an S-shaped path, it is recommended to start scanning from the corner vertex of the image.
同时,在本实施例中,设定的路径为螺旋形路径。使用螺旋形路径的时候,就可以使得在执行步骤S4的时候,不会在重复遍历已经执行过步骤S4的像素分界点,这样可以使得图像在分割处理的时候,节约运算步骤,从而提升图像分割的效率。Meanwhile, in this embodiment, the set path is a spiral path. When the spiral path is used, it is possible to prevent repeated traversal of the pixel boundary points that have been executed in step S4 when performing step S4, which can save calculation steps during image segmentation processing, thereby improving image segmentation s efficiency.
在本实施例中,在步骤S1中,在获取像素分界点的坐标的时候,为所有的像素分界点统一分配坐标,相邻的两个像素分界点的坐标中,横坐标之差或者纵坐标之差的绝对值为1。这样就使得相邻的两个像素点分界点之间的坐标没有间隔和跳跃,在进行后期坐标汇总的时候,所得到的图像分割线更加的平滑,得到的图像分割线的函数也会更加的精准。In this embodiment, in step S1, when obtaining the coordinates of pixel boundary points, coordinates are uniformly assigned to all pixel boundary points, and in the coordinates of two adjacent pixel boundary points, the difference in abscissa or ordinate The absolute value of the difference is 1. In this way, there is no gap or jump in the coordinates between the boundary points of two adjacent pixels. When the coordinates are summarized in the later stage, the obtained image segmentation line will be smoother, and the function of the obtained image segmentation line will be more accurate. precise.
在本实施例中,在步骤S1之前,对要处理的图像进行去噪处理。通过去噪处理后的图像,相邻的像素点之间的像素值更加的平滑,在对其像素值进行比较的时候,所产生的误差就会更小。In this embodiment, before step S1, denoising processing is performed on the image to be processed. In the image after denoising processing, the pixel values between adjacent pixel points are smoother, and when the pixel values are compared, the error generated will be smaller.
以上公开的仅为本发明的几个具体实施例,但是,本发明实施例并非局限于此,任何本领域的技术人员能思之的变化都应落入本发明的保护范围。The above disclosures are only a few specific embodiments of the present invention, however, the embodiments of the present invention are not limited thereto, and any changes conceivable by those skilled in the art shall fall within the protection scope of the present invention.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010834179.6A CN111986111B (en) | 2020-08-19 | 2020-08-19 | An Image Segmentation Method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010834179.6A CN111986111B (en) | 2020-08-19 | 2020-08-19 | An Image Segmentation Method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111986111A CN111986111A (en) | 2020-11-24 |
CN111986111B true CN111986111B (en) | 2022-11-29 |
Family
ID=73434021
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010834179.6A Active CN111986111B (en) | 2020-08-19 | 2020-08-19 | An Image Segmentation Method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111986111B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7031517B1 (en) * | 1998-10-02 | 2006-04-18 | Canon Kabushiki Kaisha | Method and apparatus for segmenting images |
CN1882036A (en) * | 2005-06-14 | 2006-12-20 | 佳能株式会社 | Image processing apparatus and method |
CN101667297A (en) * | 2009-09-07 | 2010-03-10 | 宁波大学 | Method for extracting breast region in breast molybdenum target X-ray image |
CN102855642A (en) * | 2011-06-28 | 2013-01-02 | 富泰华工业(深圳)有限公司 | Image processing device and object outline extraction method thereof |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7916912B2 (en) * | 2006-09-14 | 2011-03-29 | Siemens Israel Ltd. | Efficient border extraction of image feature |
US7809189B2 (en) * | 2007-01-12 | 2010-10-05 | Arcsoft, Inc. | Method for image separating |
-
2020
- 2020-08-19 CN CN202010834179.6A patent/CN111986111B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7031517B1 (en) * | 1998-10-02 | 2006-04-18 | Canon Kabushiki Kaisha | Method and apparatus for segmenting images |
CN1882036A (en) * | 2005-06-14 | 2006-12-20 | 佳能株式会社 | Image processing apparatus and method |
CN101667297A (en) * | 2009-09-07 | 2010-03-10 | 宁波大学 | Method for extracting breast region in breast molybdenum target X-ray image |
CN102855642A (en) * | 2011-06-28 | 2013-01-02 | 富泰华工业(深圳)有限公司 | Image processing device and object outline extraction method thereof |
Non-Patent Citations (2)
Title |
---|
"Automatic Phase-Based Edge Detection of Corneal Sheimpflug Images";Chunhong Ji et al.;《2014 IEEE Workshop on Electronics, Computer and Applications》;20140309;第1-4页 * |
"车祸中车辆严重碰撞区域边界图像分割技术";邱保志 等;《计算机仿真》;20130131;第1-4页 * |
Also Published As
Publication number | Publication date |
---|---|
CN111986111A (en) | 2020-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7848571B2 (en) | Computer-implemented method for efficient image segmentation using automated saddle-point detection | |
WO2017088462A1 (en) | Image processing method and device | |
WO2012074361A1 (en) | Method of image segmentation using intensity and depth information | |
JP6823486B2 (en) | Crack detection method | |
CN108334879B (en) | Region extraction method, system and terminal equipment | |
CN115457063A (en) | Method, device and equipment for extracting edge of circular hole of PCB (printed Circuit Board) and storage medium | |
CN112508835A (en) | Non-contrast agent medical image enhancement modeling method based on GAN | |
CN113971681B (en) | A belt conveyor edge detection method in complex environment | |
CN110097495A (en) | A kind of improved Zhang parallel image thinning algorithm | |
CN113052162A (en) | Text recognition method and device, readable storage medium and computing equipment | |
WO2024119323A1 (en) | Tissue segmentation method for sample image, system, device and medium | |
CN111127450B (en) | Bridge crack detection method and system based on image | |
CN119251508B (en) | A method for automatic annotation of crack semantic segmentation and improving segmentation effect | |
CN114419006B (en) | A method and system for removing text watermarks from grayscale video that changes with background | |
JP2011048627A (en) | Method and program for extracting mask image, and method and program for constructing voxel data | |
CN111986111B (en) | An Image Segmentation Method | |
CN114626118A (en) | Building indoor model generation method and device | |
CN104574448A (en) | Method for identifying connected pixel blocks | |
US20240020846A1 (en) | Corner point detection method and apparatus | |
CN105719304B (en) | A kind of flower image dividing method based on Otsu | |
CN111046727B (en) | Video feature extraction method and device, electronic equipment and storage medium | |
US8363941B2 (en) | Method and program for extracting silhouette image and method and program for constructing three dimensional model | |
CN119693403B (en) | Contour extraction method, computer device and medium for semantic segmentation map | |
CN118243695B (en) | Pathological section quality judging method and system based on image processing | |
JP6637823B2 (en) | Crack detection method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |