CN111986111A - An image segmentation method - Google Patents
An image segmentation method Download PDFInfo
- Publication number
- CN111986111A CN111986111A CN202010834179.6A CN202010834179A CN111986111A CN 111986111 A CN111986111 A CN 111986111A CN 202010834179 A CN202010834179 A CN 202010834179A CN 111986111 A CN111986111 A CN 111986111A
- Authority
- CN
- China
- Prior art keywords
- pixel
- point
- image
- points
- demarcation 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.)
- Granted
Links
- 238000003709 image segmentation Methods 0.000 title claims abstract description 19
- 238000000034 method Methods 0.000 title claims abstract description 19
- 230000000717 retained effect Effects 0.000 claims description 3
- 230000011218 segmentation Effects 0.000 abstract description 10
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010586 diagram 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
本发明公开了一种图像分割方法,包括如下步骤:S1:将要分割的图像的所有像素点进行分离,并在每相邻的两个像素点之间插入一个像素分界点;S2:依次按照设定的扫描路径扫描像素分界点;S3:在扫描每一个像素分界点的时候,分别获取该像素分界点周围每一个像素点的像素值,并对该像素分界点周围的相邻两个像素点的像素值进行比较;S4:获取该像素分界点周围的像素分界点,并扫描该像素分界点周围的像素分界点;S5:将所有留取的坐标连接成线,并按照该线对图像进行分割。本发明通过扫描得到一个可以分割的点,在通过在该分割点的相邻的周围进行扫描,使得得到与之相邻的分割点,最后在将所有的分割点相连接,即可以得到要分割的图像。
The invention discloses an image segmentation method, comprising the following steps: S1: separating all pixel points of an image to be segmented, and inserting a pixel demarcation point between each adjacent two pixel points; S2: sequentially according to the setting Scan the pixel demarcation point with a certain scanning path; S3: When scanning each pixel demarcation point, obtain the pixel value of each pixel point around the pixel demarcation point, and analyze the adjacent two pixel points around the pixel demarcation point. Compare the pixel values of the pixel values; S4: Obtain the pixel demarcation point around the pixel demarcation point, and scan the pixel demarcation points around the pixel demarcation point; S5: Connect all the reserved coordinates into a line, and perform the image processing according to the line. segmentation. The present invention obtains a point that can be divided by scanning, scans around the adjacent division point to obtain adjacent division points, and finally connects all division points, that is, the division point to be divided can be obtained. Image.
Description
技术领域technical field
本发明涉及图像处理领域,特别涉及一种图像分割方法。The invention relates to the field of image processing, in particular to an image segmentation method.
背景技术Background technique
图像分割是将特定的、具有独特性质的区域并提出感兴趣目标的技术和过程,是由图像处理到图像分析的关键步骤。在目前的图像分割中,五分是分割出一个图像还是多个图像,都会将要分割的图像进行整体的扫描,最终在能得到要分割的图像,这样每次在分割的时候,就需要进行大量的运算,使得在图像分割的时候时间较长。Image segmentation is a technique 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 the five points are divided into 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. operation, which makes the image segmentation time longer.
发明内容SUMMARY OF THE INVENTION
本发明的目的是克服上述现有技术中存在的问题,提供一种图像分割方法,通过扫描得到一个可以分割的点,在通过在该分割点的相邻的周围进行扫描,使得得到与之相邻的分割点,最后在将所有的分割点相连接,即可以得到要分割的图像。The purpose of the present invention is to overcome the problems existing in the above-mentioned prior art, and provide an image segmentation method, which can obtain a point that can be divided by scanning, and scan the adjacent surrounding of the divided point, so that a similar point is obtained. The adjacent segmentation points, and finally all the segmentation points are connected, that is, the image to be segmented can be obtained.
为此,本发明提供一种图像分割方法,包括如下步骤:To this end, the present invention provides an image segmentation method, comprising the following steps:
S1:将要分割的图像的所有像素点进行分离,并在每相邻的两个像素点之间插入一个像素分界点,使得每一个像素分界点的周围都是该图像的像素点,并获取所有像素分界点的坐标。S1: Separate all the pixels of the image to be segmented, and insert a pixel demarcation point between every two adjacent pixel points, so that each pixel demarcation point is surrounded by the pixels of the image, and obtain all the pixel points of the image. The coordinates of the pixel demarcation point.
S2:依次按照设定的扫描路径扫描像素分界点。S2: Scan the pixel boundary points sequentially according to the set scanning path.
S3:在扫描每一个像素分界点的时候,分别获取该像素分界点周围每一个像素点的像素值,并对该像素分界点周围的相邻两个像素点的像素值进行比较,当相邻两个像素点的像素值之差大于设定的数值的时候,则留取该像素分界点的坐标并进入步骤S4,否则,进入步骤S2。S3: When scanning each pixel demarcation point, obtain the pixel value of each pixel point around the pixel demarcation point, and compare the pixel values of two adjacent pixel points around the pixel demarcation point. When the difference between the pixel values of the two pixel points is greater than the set value, the coordinates of the pixel boundary point are reserved and the process goes to step S4; otherwise, the process goes to step S2.
S4:获取该像素分界点周围的像素分界点,并扫描该像素分界点周围的像素分界点,并执行步骤S3,直至再次留取的像素分界点的坐标为该像素分界点的坐标。S4: Acquire the pixel boundary point around the pixel boundary point, scan the pixel boundary point around the pixel boundary point, and perform step S3 until the coordinates of the pixel boundary point that are retained again are the coordinates of the pixel boundary point.
S5:将所有留取的坐标连接成线,并按照该线对图像进行分割,最后去除该图像中所有的像素分界点。S5: Connect all the reserved coordinates into a line, 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 demarcation point is located.
更进一步,设定的路径为螺旋形路径。Further, the set path is a spiral path.
进一步,在步骤S1中,在获取像素分界点的坐标的时候,为所有的像素分界点统一分配坐标,相邻的两个像素分界点的坐标中,横坐标之差或者纵坐标之差的绝对值为1。Further, in step S1, when the coordinates of the pixel boundary points are obtained, coordinates are uniformly allocated to all the pixel boundary points. Among the coordinates of the adjacent two pixel boundary points, the absolute difference between the abscissa or the difference between the ordinates is The value is 1.
进一步,在步骤S1之前,对要处理的图像进行去噪处理。Further, before step S1, denoising is performed on the image to be processed.
本发明提供的一种图像分割方法,具有如下有益效果:通过扫描得到一个可以分割的点,在通过在该分割点的相邻的周围进行扫描,使得得到与之相邻的分割点,最后在将所有的分割点相连接,即可以得到要分割的图像。An image segmentation method provided by the present invention has the following beneficial effects: obtaining a segmentable point by scanning, scanning around the adjacent segmentation point to obtain adjacent segmentation points, and finally in 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 flow of the present invention.
具体实施方式Detailed ways
下面结合附图,对本发明的一个具体实施方式进行详细描述,但应当理解本发明的保护范围并不受具体实施方式的限制。A specific embodiment of the present invention will be described in detail below with reference to 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, the component models and structures that are not specified are the prior art known to those skilled in the art, and those skilled in the art can set it according to the needs of the actual situation. 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 the pixels of the image to be segmented, and insert a pixel demarcation point between every two adjacent pixel points, so that each pixel demarcation point is surrounded by the pixels of the image, and obtain all the pixel points of the image. The coordinates of the pixel demarcation point.
该步骤中,将相邻的两个像素点之间使用点插入算法插入一个像素分界点,将图像的各个像素点遍历之后,就可以得到一个新的图像,在新的图像中,没两个相邻的像素点之间都有一个像素分界点,使得每一个像素点都被相邻的像素分界点所包围,每一个像素点都会相邻一个像素分界点,每一个像素分界点都会相邻一个像素点。In this step, a pixel demarcation point is inserted between two adjacent pixel points using the point insertion algorithm. After traversing each pixel point of the image, a new image can be obtained. In the new image, there are no two There is a pixel boundary point between adjacent pixels, so that each pixel point is surrounded by adjacent pixel boundary points, each pixel point will be adjacent to a pixel boundary point, and each pixel boundary point will be adjacent a pixel.
S2:依次按照设定的扫描路径扫描像素分界点。S2: Scan the 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 pixel segmentation points is to use an S-shaped path, because the S-shaped path can traverse every pixel segmentation point, and each pixel segmentation point is scanned only once.
S3:在扫描每一个像素分界点的时候,分别获取该像素分界点周围每一个像素点的像素值,并对该像素分界点周围的相邻两个像素点的像素值进行比较,当相邻两个像素点的像素值之差大于设定的数值的时候,则留取该像素分界点的坐标并进入步骤S4,否则,进入步骤S2。S3: When scanning each pixel demarcation point, obtain the pixel value of each pixel point around the pixel demarcation point, and compare the pixel values of two adjacent pixel points around the pixel demarcation point. When the difference between the pixel values of the two pixel points is greater than the set value, the coordinates of the pixel boundary point are reserved and the process goes to step S4; otherwise, the process goes to step S2.
该步骤中,对像素分界点周围的像素点的值进行判断,根据周围的像素点的像素值的差值判断该像素点分界点是否为图像可以分割的图像分割线处,当相邻两个像素点的像素值之差大于设定的数值的时候,认为像素点分界点的为图像可以分割的图像分割线处。若不是,则继续进入步骤S2中进行下一个像素分界点的扫描。In this step, the values of the pixels around the pixel boundary point are judged, and whether the boundary point of the pixel point is at the image dividing line where the image can be divided is judged according to the difference of the pixel values of the surrounding pixel points. When the difference between the pixel values of the pixel points is greater than the set value, it is considered that the boundary point of the pixel point 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: Acquire the pixel boundary point around the pixel boundary point, scan the pixel boundary point around the pixel boundary point, and perform step S3 until the coordinates of the pixel boundary point that are retained again are the coordinates of the pixel boundary point.
该步骤中,在已经得到一个像素分界点为符合条件的像素分界点的时候,使得扫描其周围的相邻的像素分界点,这样就沿着其中的一个符合要求的像素分界点,快速的得到其他符合要求的像素分界点。In this step, when a pixel demarcation point has been obtained as a qualified pixel demarcation point, the adjacent pixel demarcation points around it are scanned, so that along one of the pixel demarcation points that meet the requirements, the pixel demarcation point can be quickly obtained. Other qualified pixel demarcation points.
S5:将所有留取的坐标连接成线,并按照该线对图像进行分割,最后去除该图像中所有的像素分界点。S5: Connect all the reserved coordinates into a line, 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 reserved pixel point boundary points are connected into a line, which is the image segmentation line. According to the segmentation line, the segmented image can be obtained. Finally, all the pixel boundary points in the image are divided After removal, the original image segmented image 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 scheme is suitable for spiral paths, which can greatly reduce the number of operations, while for S-shaped paths, it is recommended to scan from the corner vertices 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 avoid repeating the traversal of the pixel boundary points that have been performed in step S4 when performing step S4, which can save the operation steps when the image is segmented, thereby improving image segmentation. s efficiency.
在本实施例中,在步骤S1中,在获取像素分界点的坐标的时候,为所有的像素分界点统一分配坐标,相邻的两个像素分界点的坐标中,横坐标之差或者纵坐标之差的绝对值为1。这样就使得相邻的两个像素点分界点之间的坐标没有间隔和跳跃,在进行后期坐标汇总的时候,所得到的图像分割线更加的平滑,得到的图像分割线的函数也会更加的精准。In this embodiment, in step S1, when obtaining the coordinates of the pixel boundary points, coordinates are uniformly allocated to all pixel boundary points. Among the coordinates of two adjacent pixel boundary points, the difference between the abscissas or the ordinate is The absolute value of the difference is 1. In this way, the coordinates between the boundary points of two adjacent pixels have no gaps and jumps. When the coordinates are summarized later, the obtained image segmentation line is smoother, and the function of the obtained image segmentation line will also be better. Precise.
在本实施例中,在步骤S1之前,对要处理的图像进行去噪处理。通过去噪处理后的图像,相邻的像素点之间的像素值更加的平滑,在对其像素值进行比较的时候,所产生的误差就会更小。In this embodiment, before step S1, denoising processing is performed on the image to be processed. Through the denoised image, the pixel values between adjacent pixels are smoother, and the error will be smaller when the pixel values are compared.
以上公开的仅为本发明的几个具体实施例,但是,本发明实施例并非局限于此,任何本领域的技术人员能思之的变化都应落入本发明的保护范围。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 that can be conceived by those skilled in the art should fall within the protection scope of the present invention.
Claims (5)
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 true CN111986111A (en) | 2020-11-24 |
CN111986111B 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 (6)
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 |
US20080069421A1 (en) * | 2006-09-14 | 2008-03-20 | Siemens Medical Solutions Usa Inc. | Efficient Border Extraction Of Image Feature |
US20080170787A1 (en) * | 2007-01-12 | 2008-07-17 | Arcsoft, Inc. | Method for image separating |
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 |
-
2020
- 2020-08-19 CN CN202010834179.6A patent/CN111986111B/en active Active
Patent Citations (6)
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 |
US20080069421A1 (en) * | 2006-09-14 | 2008-03-20 | Siemens Medical Solutions Usa Inc. | Efficient Border Extraction Of Image Feature |
US20080170787A1 (en) * | 2007-01-12 | 2008-07-17 | Arcsoft, Inc. | Method for image separating |
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 |
---|
CHUNHONG JI ET AL.: ""Automatic Phase-Based Edge Detection of Corneal Sheimpflug Images"", 《2014 IEEE WORKSHOP ON ELECTRONICS, COMPUTER AND APPLICATIONS》 * |
邱保志 等: ""车祸中车辆严重碰撞区域边界图像分割技术"", 《计算机仿真》 * |
Also Published As
Publication number | Publication date |
---|---|
CN111986111B (en) | 2022-11-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8014628B2 (en) | Image inspection apparatus, image inspection method and computer program | |
US7848571B2 (en) | Computer-implemented method for efficient image segmentation using automated saddle-point detection | |
WO2012074361A1 (en) | Method of image segmentation using intensity and depth information | |
CN1716316A (en) | Stereo 3D reconstruction system and method based on color segmentation | |
JP4908440B2 (en) | Image processing apparatus and method | |
JP6823486B2 (en) | Crack detection method | |
TW202202831A (en) | A computer implemented process to enhance edge defect detection and other defects in ophthalmic lenses | |
CN115457063A (en) | Method, device and equipment for extracting edge of circular hole of PCB (printed Circuit Board) and storage medium | |
CN110097495A (en) | A kind of improved Zhang parallel image thinning algorithm | |
CN119251508B (en) | A method for automatic annotation of crack semantic segmentation and improving segmentation effect | |
JP6065656B2 (en) | Pattern processing apparatus, pattern processing method, and pattern processing program | |
CN111986111A (en) | An image segmentation method | |
CN109754378B (en) | Burr removing method for crack image | |
CN105719304B (en) | A kind of flower image dividing method based on Otsu | |
CN115797327A (en) | A defect detection method, device, terminal equipment and storage medium | |
CN114862870A (en) | Speckle pattern partitioning method, device, equipment and medium | |
CN111046727B (en) | Video feature extraction method and device, electronic equipment and storage medium | |
JPH0735532A (en) | Method of measuring length of crack on road surface | |
CN113421229A (en) | Method for detecting and repairing defect of small area of image | |
JP6637823B2 (en) | Crack detection method | |
JP2004110434A (en) | Image processing method and image processing device | |
CN111382615A (en) | Image detection method | |
CN112446818B (en) | Image refinement method and device, storage medium and electronic equipment | |
CN111462144B (en) | An Image Segmentation Method Based on Rough Sets and Rapidly Suppressing Image Fuzzy Boundaries | |
JP2010152456A (en) | Image processor and image processing method and program using image processing 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 |