A method of region division based on image contour

By processing and refining the image contours and labeling the connecting domains of the contour images, the problems of low efficiency and insufficient stability of image area division in the prior art are solved, and efficient and stable area division effects are achieved.

CN115131378BActive Publication Date: 2025-03-18HUNAN RUIZHI IND EQUIP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210674541.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-15
Publication Date
2025-03-18
Estimated Expiration
2042-06-15

AI Technical Summary

Technical Problem

In the prior art, the image area division method is inefficient and has insufficient stability, making it difficult to effectively process isolated points and glitch points in the image, resulting in inaccurate and time-consuming region division.

Method used

The region division method based on image contour is adopted to reduce the algorithm workload and improve efficiency by processing and refining the singular points of the image contour; the connecting domain of the contour image is marked, and the connecting domain marking algorithm is improved to improve efficiency and stability.

Benefits of technology

It realizes efficient and stable image area division, reduces the workload and time-consuming of the algorithm, and improves the accuracy and efficiency of area division.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115131378B_ABST
    Figure CN115131378B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for region division based on image contour. It specifically comprises the following steps: (1) processing singular points of image contour and thinning the contour based on the digital image contour; (2) marking the connected domain of the contour image to obtain a region division result map; (3) extracting each region of the original image separately according to the region division result map to obtain a region image. The beneficial effects of the present invention are: firstly processing singular points of the contour and thinning the contour to reduce the workload of the algorithm and reduce the time consumption; marking the connected domain of the contour image to improve the low efficiency and long time consumption of the original connected domain marking algorithm, and the present algorithm is more efficient and more stable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field related to image processing, and in particular to a region division method based on image contours. Background Art

[0002] In the study of digital images, a complete image is generally considered to be a set of pixels that are meaningfully arranged and connected to each other, and the partial areas or objects in the image contain the characteristic information of the pixels. Finding the area containing the target, i.e. the foreground, and distinguishing the remaining area in the image, i.e. the background, is a very critical issue in the computer graphics processing process. Image region division is to connect and combine pixels that are related and similar, so as to divide the entire digital image into several small areas according to certain rules determined by humans, and provide effective and clear pixel information for subsequent image description, image understanding and image analysis.

[0003] Although image region division is a key issue in image processing and machine vision, there is no clear quantitative evaluation standard. There are many methods for region division, and the number of methods is increasing every year. Each method has different forms of expression, but generally operates according to the discontinuity of grayscale values ​​(region boundaries) and similarity (same region). For discontinuous pixel grayscale, the image is segmented according to its mutation; for similar pixel grayscale, the image is divided into similar regions according to certain criteria. Image region division methods can be divided into: region division based on edge detection, region division based on region, threshold-based region division, region division based on cluster analysis, etc. according to their principles.

[0004] The region segmentation method based on edge detection uses the edge of the object as the boundary of the image region segmentation to divide the target and background of the digital image. The key lies in how to find the location where the image information features change, so as to obtain the required information. Region-based region segmentation is to divide the image into several parts based on similar features and certain rules, including region growing, region splitting and aggregation, morphological watershed segmentation, etc. Its advantage is that it can use the connectivity properties of pixels to make the divided image regions continuous and smooth, but it is usually inefficient and prone to over-division. The threshold-based region segmentation method is based on the histogram of the image. The pixels in the image are compared with one or more artificially determined thresholds to divide the pixels into several categories. Such pixels of the same type are usually divided into one region. This method has a significant segmentation effect in images with large grayscale values ​​and obvious fluctuations in the histogram, but it is very dependent on the selection of the threshold. When the grayscale changes of the image are not obvious, the effect is poor and may even be distorted. The region division method based on clustering analysis is to find the region division boundaries of the image according to known samples, and effectively classify the samples according to their characteristics. General clustering methods include K-means method, fuzzy C-means method and spatial pattern clustering. This method does not require iteration and is relatively simple, but the results are greatly affected by the initial parameters of the classification. Summary of the invention

[0005] The present invention aims to overcome the above-mentioned deficiencies in the prior art and provides a method for region division based on image contours with high efficiency and high stability.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] A region division method based on image contours specifically comprises the following steps:

[0008] (1) Processing of singular points and contour refinement based on the digital image contour;

[0009] (2) Mark the connected domain of the contour image to obtain the region division result map;

[0010] (3) According to the region division result map, each region of the original image is extracted separately to obtain a regional image.

[0011] Region marking plays an indispensable role in image processing and computer vision, and is widely used in text recognition and image region division. The region marking methods based on pixel points can be mainly divided into sequential method, region growing method and contour tracking method. The sequential method requires two scans of the image, which takes a long time and has poor effect when encountering U-shaped and E-shaped connected regions; the region growing method usually adopts the seed filling method, which is relatively inefficient and can have better effect when the image is small; the contour tracking method is also time-consuming due to the contour search strategy, so this method improves this, firstly processes the singular points of the contour and refines it, reduces the workload of the algorithm and reduces the time consumption; marks the connected domain of the contour image, improves the low efficiency and long time consumption of the original connected domain marking algorithm, and the algorithm is more efficient and more stable. That is, the region division method based on the image contour is adopted to calibrate the image region, and an improved method is proposed to make the image region division effect more obvious.

[0012] Preferably, in step (1), when the singular point of the image contour is an isolated point, the grayscale of the isolated point is completely different from the grayscale of the surrounding pixels. In the binary image, its own pixel is 1, and the pixels of the eight neighborhoods are all 0. The processing of the isolated point is: scanning the entire image from left to right and from top to bottom, and deleting the points whose eight neighborhoods are all 0.

[0013] Preferably, in step (1), when the singular point of the image contour is a burr point, the burr point refers to an extra point existing at the segment of the image contour, and the method for processing the burr point in the contour is as follows:

[0014] (11) Traverse the contour image from left to right and from top to bottom to determine the starting point of the contour;

[0015] (12) Mark the number of eight neighborhood points of the scanned point as ;

[0016] (13) If the starting pixel , the starting point is temporarily changed to 0, and its neighboring points are judged one by one whether they are isolated points. If so, they are directly deleted, and then the starting pixel is restored to 1, and the next point is scanned;

[0017] (14) In the subsequent point, if , temporarily change the pixel point to 0, determine whether its neighboring points are isolated points one by one, exclude the pixel points connected to the previous contour, and delete them directly if they are isolated points, then restore the starting pixel point to 1, and continue scanning the next point until the contour ends.

[0018] Preferably, in step (1), the image contour is refined by continuously iteratively calculating to remove the boundary pixels of the contour and retain only the skeleton pixels of the contour image. The specific refinement method is as follows:

[0019] (a) Establish an eight-neighborhood of the target pixel, where the center point P0 is the target pixel, and subsequent operations will be performed with it as the center. The remaining points P1, P2, P3, P4, P5, P6, P7, and P8 are neighborhood points, where P1 is placed directly above P0 and arranged in order around P0 in a clockwise direction;

[0020] (b) The pixels with a value of 1 in the contour image are called foreground points, and the pixels with a value of 0 are called background points. They are operated according to the following formula:

[0021]

[0022]

[0023] In the formula is the number of non-zero points in the eight-neighborhood of the target pixel, that is, ,and Sort the pixels in the neighborhood of the target pixel into a sequence The number of times 0 is converted to 1 in ;

[0024] (c) If the target pixel satisfies one of the above two equations, point P0 is regarded as a pixel point not in the center of the skeleton and is deleted; the contour image is traversed from left to right and from top to bottom, and the points that meet the formula conditions are deleted. The remaining points are the skeleton points after the contour is refined.

[0025] Preferably, in step (2), in the digital image, connectivity is divided into four neighborhoods and eight neighborhoods, where four neighborhoods refer to a coordinate The pixel at has four adjacent pixels above, below, left and right, and its coordinates can be expressed as:

[0026]

[0027] The eight-neighborhood is the four-neighborhood plus four diagonally adjacent pixels, with coordinates as follows:

[0028]

[0029] If the target pixel If the pixel points in the neighborhood are both 0 or 1, it means that the target pixel point and the points in the neighborhood are the same connected domain; therefore, the method for marking the connected domain of the contour image is as follows:

[0030] (21) Both the four-neighborhood and the eight-neighborhood have the same feature, that is, the pixel scanning is to traverse and mark the pixel points in the connected domain of the digital image from left to right and from top to bottom; when the target pixel is encountered during the traversal process, it is marked, and its neighborhood is checked from all directions of the pixel to see if it is the same as the target pixel. If it is the same, a temporary connected domain label is obtained;

[0031] (22) The structure obtained in step (21) may contain several sub-connected domains in the same connected domain. It is then necessary to integrate the sub-connected domains and merge the same sub-connected domains.

[0032] Preferably, in step (22), the method for integrating each sub-connected domain is as follows:

[0033] The pixel The label is set to , pixel The neighborhood of

[0034] Since the pixel scanning method also traverses pixels from left to right and from top to bottom, the pixel points When marking, its label has been determined. According to the following marking formula, the label of each pixel is obtained:

[0035] .

[0036] The beneficial effects of the present invention are: firstly, singular points of the contour are processed and refined, so as to reduce the workload of the algorithm and reduce the time consumption; the connected domain of the contour image is marked, so as to improve the low efficiency and long time consumption of the original connected domain marking algorithm, and the present algorithm has higher efficiency and stronger stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flowchart of region division based on image contour;

[0038] Figure 2 It is a schematic diagram of isolated points and burr points of the contour;

[0039] Figure 3 is a schematic diagram of the eight-neighborhood of the target pixel;

[0040] Figure 4 This is the effect picture of the cartoon image before and after the outline is refined;

[0041] Figure 5 This is the outline refinement and magnification effect diagram;

[0042] Figure 6 It is a schematic diagram of four-neighborhood and eight-neighborhood;

[0043] Figure 7 It is a simple test image;

[0044] Figure 8 is a complex test image diagram;

[0045] Fig. 9 This is the effect diagram of a complex cartoon image before and after area division. DETAILED DESCRIPTION

[0046] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.

[0047] like Figure 1 In the embodiment described, a method for dividing a region based on an image contour specifically comprises the following steps:

[0048] (1) Based on the digital image contour, the singular points of the image contour are processed and the contour is refined; the purpose of singular point processing and contour refinement of the digital image contour is to remove noise such as isolated points and burrs, as well as unnecessary contour points, and only retain its skeleton points. On this basis, the regional calibration of the contour is improved to overcome its low efficiency and time-consuming problems.

[0049] When the singular point of the image contour is an isolated point, the grayscale of the isolated point is completely different from the grayscale of the surrounding pixels. In the binary image, its own pixel is 1, and the pixels of the eight neighborhoods are all 0, such as Figure 2 As shown in the middle pixel 2 and pixel 9; the processing of isolated points is: scan the entire image from left to right and from top to bottom, and delete the points whose eight neighborhoods are all 0.

[0050] When the singular points of the image contour are burr points, the burr points refer to the redundant points existing in the segmentation of the image contour "skeleton". For example, pixel points 1 and 11 in Figure 2 are burr points. The method for processing the burr points in the contour is as follows:

[0051] (11) Traverse the contour image from left to right and from top to bottom to determine the starting point of the contour;

[0052] (12) Mark the number of eight neighborhood points of the scanned point as ;

[0053] (13) If the starting pixel , the starting point is temporarily changed to 0, and its neighboring points are judged one by one whether they are isolated points. If so, they are directly deleted, and then the starting pixel is restored to 1, and the next point is scanned;

[0054] (14) In the subsequent point, if , temporarily change the pixel point to 0, determine whether its neighboring points are isolated points one by one, exclude the pixel points connected to the previous contour, and delete them directly if they are isolated points, then restore the starting pixel point to 1, and continue scanning the next point until the contour ends.

[0055] Image contour refinement is to remove the boundary pixels of the contour through continuous iterative calculation, and only retain the skeleton pixels of the contour image. Figure 2 Pixel 3 and pixel 6 form a two-pixel-wide edge. The two-pixel-wide contour edge will affect the efficiency and accuracy of the connected domain calibration. Refining the image contour can make the image area division relationship clearer on the one hand, and remove a lot of interference information on the other hand, leaving only the most basic contour skeleton information. The use of parallel algorithms can make the contour skeleton highly connected, faster in calculation speed, and more resistant to noise interference. This method uses a parallel refinement algorithm to refine the digital image contour. The specific refinement method is as follows:

[0056] (a) Establish an eight-neighborhood of the target pixel, where the center point P0 is the target pixel, and the subsequent operations will be performed with it as the center. The remaining points P1, P2, P3, P4, P5, P6, P7, and P8 are neighborhood points, where P1 is placed directly above P0 and arranged in order around P0 in a clockwise direction, as shown in the following figure: Figure 3 As shown;

[0057] (b) The pixels with a value of 1 in the contour image are called foreground points, and the pixels with a value of 0 are called background points. They are operated according to the following formula:

[0058]

[0059]

[0060] In the formula is the number of non-zero points in the eight-neighborhood of the target pixel, that is, ,and Sort the pixels in the neighborhood of the target pixel into a sequence The number of times 0 is converted to 1 in ;

[0061] (c) If the target pixel satisfies one of the above equations (1) and (2), point P0 is regarded as a pixel point not in the center of the skeleton and is deleted. The contour image is traversed from left to right and from top to bottom, and the points that meet the conditions of the formula are deleted. The remaining points are the skeleton points after the contour is refined.

[0062] Taking cartoon images as an example, the contour refinement effect is as follows Figure 4 As shown, Figure 4 The part in the box is enlarged to show the effect of contour refinement more clearly. The result is as follows Figure 5, it can be seen that this algorithm has an obvious effect on the refinement of the image contour, and there is no breakpoint in the middle.

[0063] (2) Mark the connected domain of the contour image to obtain the region division result map;

[0064] Connectivity means that any two points in a pixel subset area of ​​a digital image can form a connected path. The connected domain labeling algorithm marks the pixels in the image that meet the rules as a target according to a certain pixel adjacency rule. The connected domain labeling is usually performed in a binary image, in which there are only black and white pixels, black pixels are represented by 0, and white pixels are represented by 1.

[0065] In digital images, connectivity is divided into four neighborhoods and eight neighborhoods. The specific representations of these two types of connectivity are as follows: Figure 6 As shown; the four neighbors refer to a coordinate The pixel at has four adjacent pixels above, below, left and right, and its coordinates can be expressed as:

[0066] (3)

[0067] The eight-neighborhood is the four-neighborhood plus four diagonally adjacent pixels, with coordinates as follows:

[0068] (4)

[0069] If the target pixel If the pixel points in the neighborhood are both 0 or 1, it means that the target pixel point and the points in the neighborhood are the same connected domain; therefore, the method for marking the connected domain of the contour image is as follows:

[0070] (21) Both the four-neighborhood and the eight-neighborhood have the same feature, that is, the pixel scanning is to traverse and mark the pixel points in the connected domain of the digital image from left to right and from top to bottom; when the target pixel is encountered during the traversal process, it is marked, and its neighborhood is checked from all directions of the pixel to see if it is the same as the target pixel. If it is the same, a temporary connected domain label is obtained;

[0071] (22) The structure obtained in step (21) may contain several sub-connected domains in the same connected domain. It is then necessary to integrate the sub-connected domains and merge the same sub-connected domains.

[0072] The first step of most connected domain labeling algorithms is similar, and in the process of integrating each sub-connected domain, several types of processing modes are generated. Pixel scanning method is an efficient processing method, which can be specifically divided into: sequential scanning method, recursive labeling method, and region growing method. The method used in this application is sequential scanning method because of its stable performance and intuitive and easy to understand. The method for integrating each sub-connected domain is as follows:

[0073] The pixel The label is set to , pixel The neighborhood of Since the pixel scanning method also traverses pixels from left to right and from top to bottom, the pixel points When marking, its label has been determined. According to the following marking formula, the label of each pixel is obtained:

[0074]

[0075] (3) According to the region division result map, each region of the original image is extracted separately to obtain a regional image. Region labeling plays an indispensable role in image processing and computer vision, and is widely used in text recognition and image region division. The region labeling method based on pixel points can be mainly divided into sequential method, region growing method and contour tracking method. The sequential method requires two scans of the image, which takes a long time and is not effective when encountering U-shaped and E-shaped connected regions; the region growing method usually uses a seed filling method, which is relatively inefficient and can have better results when the image is small; the contour tracking method is also time-consuming due to the contour search strategy. Therefore, this application makes improvements to this by first processing and refining the singular points of the contour to reduce the workload of the algorithm and reduce time consumption.

[0076] This example selects 20 digital images to test the algorithm, which are divided into two groups: simple images and complex images. For details of the simple test images, see Figure 7 , see the complex test image for details Figure 8 We still selected simple calligraphy images with obvious edge features and clear backgrounds and complex cartoon images with more contours and background color interference for region segmentation analysis. The results show that Fig. 9 shown.

[0077] The algorithm in this paper is compared with the traditional sequential method, region growing method and contour tracking method using 20 digital images. The results are shown in the following table.

[0078] Test environment:

[0079] System Model: Dell OptiPlex 3020

[0080] Processor: Intel(R) Pentium(R) CPU G3220 @ 3.00GHz 3.00 GHz

[0081] Memory: 8192MB RAM

[0082] Operating system: Windows 10 Professional 64-bit

[0083] Operating environment: VisualStudio 2010, Opencv2.4.9, Debug mode

[0084]

[0085] From the above table, we can see that when dividing the image into regions, the average time used by the proposed algorithm is shorter and the variance is smaller than that of the sequential method, region growing method and contour tracking method, which shows that the proposed algorithm is more efficient and stable in dividing the image into regions.

[0086] In summary, based on the processing and refinement of singular points of digital image contours, the connected domains of contour images are marked to improve the low efficiency and long time consumption of the original connected domain marking algorithm. The final experimental results also show that the algorithm in this paper is more efficient and more stable.

Claims

1. A region division method based on image contour, characterized in that: The specific steps include: (1) Processing of singular points and contour refinement based on the digital image contour; (2) Mark the connected domain of the contour image to obtain the region division result map; (3) Extracting each region of the original image separately according to the region division result map to obtain a regional image; In step (1), when the singular point of the image contour is a burr point, the burr point refers to the redundant point existing in the segment of the image contour. The method for processing the burr point in the contour is as follows: (11) Traverse the contour image from left to right and from top to bottom to determine the starting point of the contour; (12) Mark the number of eight neighborhood points of the scanned point as ; (13) If the starting pixel , the starting point is temporarily changed to 0, and its neighboring points are judged one by one whether they are isolated points. If so, they are directly deleted, and then the starting pixel is restored to 1, and the next point is scanned; (14) In the subsequent point, if , temporarily change the pixel point to 0, determine whether its neighboring points are isolated points one by one, exclude the pixel points connected to the previous contour, and directly delete them if they are isolated points, then restore the starting pixel point to 1, and continue to scan the next point until the contour ends; In step (1), image contour refinement is performed by continuously iterative calculation to remove the boundary pixels of the contour and retain only the skeleton pixels of the contour image. The specific refinement method is as follows: (a) Establish an eight-neighborhood of the target pixel, where the center point P0 is the target pixel, and subsequent operations will be performed with it as the center. The remaining points P1, P2, P3, P4, P5, P6, P7, and P8 are neighborhood points, where P1 is placed directly above P0 and arranged in order around P0 in a clockwise direction; (b) The pixels with a value of 1 in the contour image are called foreground points, and the pixels with a value of 0 are called background points. They are operated according to the following formula: In the formula is the number of non-zero points in the eight-neighborhood of the target pixel, that is, ,and Sort the pixels in the neighborhood of the target pixel into a sequence The number of times 0 is converted to 1 in ; (c) If the target pixel satisfies one of the above two equations, point P0 is regarded as a pixel point not in the center of the skeleton and is deleted; the contour image is traversed from left to right and from top to bottom, and the points that meet the formula conditions are deleted. The remaining points are the skeleton points after the contour is refined.

2. The method for region division based on image contour according to claim 1, characterized in that In step (1), when the singular point of the image contour is an isolated point, the grayscale of the isolated point is completely different from the grayscale of the surrounding pixels. In the binary image, its own pixel is 1, and the pixels of the eight neighborhoods are all 0. The processing of the isolated point is: scan the entire image from left to right and from top to bottom, and delete the points whose eight neighborhoods are all 0.

3. The method for region division based on image contour according to claim 1, characterized in that In step (2), in the digital image, connectivity is divided into four neighborhoods and eight neighborhoods. The four neighborhoods refer to the coordinates of The pixel at has four adjacent pixels above, below, left and right, and its coordinates can be expressed as: The eight-neighborhood is the four-neighborhood plus four diagonally adjacent pixels, with coordinates as follows: If the target pixel If the pixel points in the neighborhood are both 0 or 1, it means that the target pixel point and the points in the neighborhood are the same connected domain; therefore, the method for marking the connected domain of the contour image is as follows: (21) Both the four-neighborhood and the eight-neighborhood have the same feature, that is, the pixel scanning is to traverse and mark the pixel points in the connected domain of the digital image from left to right and from top to bottom; when the target pixel is encountered during the traversal process, it is marked, and its neighborhood is checked from all directions of the pixel to see if it is the same as the target pixel. If it is the same, a temporary connected domain label is obtained; (22) The structure obtained in step (21) may contain several sub-connected domains in the same connected domain. It is then necessary to integrate the sub-connected domains and merge the same sub-connected domains.

4. The method for region division based on image contour according to claim 3, characterized in that: In step (22), the method for integrating each sub-connected domain is as follows: The pixel The label is set to , pixel The neighborhood of Since the pixel scanning method also traverses pixels from left to right and from top to bottom, the pixel points When marking, its label has been determined. According to the following marking formula, the label of each pixel is obtained:

Citation Information

Patent Citations

  • Shallow embossment object identification processing method based on RGB monocular image

    CN110097626A

  • Image speckle processing method

    WO2017113422A1