Text image superpixel segmentation method and system

By performing multiple iterative superpixel segmentation on text images and re-segmenting of unreasonable superpixels, the problem of inaccurate segmentation of text images in the prior art is solved, segmentation accuracy and processing efficiency are improved, and more accurate data is provided for subsequent text recognition.

CN120107291AActive Publication Date: 2025-06-06ZHONGZHI HOUDE (BEIJING) INFORMATION TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510585981.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-06-06
Estimated Expiration
2045-05-08

AI Technical Summary

Technical Problem

In the prior art, when dealing with low-resolution scanned documents, handwritten text or complex background interference, it is difficult to accurately divide characters and non-character regions, resulting in the superpixel region crossing character boundaries and reducing the recognition accuracy of the OCR engine.

Method used

The text image is divided multiple iteratively through the superpixel segmentation algorithm to obtain the initial segmentation result, and then the superpixels with unreasonable segmentation are segmented again according to the segmentation result until iterative convergence is performed to improve the segmentation accuracy.

Benefits of technology

It improves the accuracy of superpixel segmentation of text images, enhances the accuracy of image preprocessing, reduces the amount of data computing, improves processing efficiency, and provides more accurate image data for subsequent text recognition and extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107291A_ABST
    Figure CN120107291A_ABST
Patent Text Reader

Abstract

The invention discloses a text image superpixel segmentation method and system, and the method comprises the steps: obtaining a first image, and reading first image data from the first image; performing super-pixel segmentation on the first image according to the first image data to obtain a second image and second image data; and performing super-pixel segmentation on the second image again according to the first image data and the second image data to obtain a third image. According to the method, on the basis of super-pixel segmentation, partial or all super-pixels which are unreasonably segmented are subjected to super-pixel segmentation again, so that the accuracy of super-pixel segmentation is improved on the basis of saving the data operation amount and improving the data processing efficiency, and then the recognition accuracy of a text image is improved in an auxiliary manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image data processing and superpixel segmentation applications, and in particular relates to a text image superpixel segmentation method and system. Background Art

[0002] With the accelerated development of the digitalization process, text image processing technology plays an increasingly important role in document digitization, optical character recognition (OCR), image content retrieval and other fields. Text images have unique characteristic attributes: they contain a large number of high-contrast edge structures, repetitive character shapes and regular typesetting layouts. In practical applications, the actual conditions of text pages vary. For example, wrinkles and stains often appear. Direct application of traditional methods will lead to blurred text edge segmentation, especially when dealing with low-resolution scanned documents, handwritten text or complex background interference (such as stains, noise, decorative patterns). It is easy to cause super-pixel areas to cross character boundaries and fail to accurately divide characters and non-character areas, which seriously reduces the recognition accuracy of the subsequent OCR engine and the extraction of effective font parts in the original text.

[0003] Existing technologies attempt to improve text segmentation effects through binarization preprocessing or edge detection, but these methods have two defects: first, global threshold processing is difficult to adapt to text images with poor document page quality or complex backgrounds, resulting in inaccurate region division; second, edge detection based on traditional operators is sensitive to noise and is prone to produce pseudo-edge interference in low-quality text images, affecting the division and recognition of effective areas.

[0004] With the popularization of applications such as mobile terminal document scanning, digitization of historical archives, and digitization of paper documents, the industry has an increasingly urgent need for high-precision and high-efficiency text image preprocessing technology. In particular, when dealing with complex scenes such as mixed text / image layout, poor page quality, stains, and complex backgrounds, traditional region segmentation methods have significant deficiencies in eliminating background interference and interfering region segmentation. Therefore, there is an urgent need for a superpixel segmentation method designed specifically for text image features, which can improve the efficiency of region segmentation while ensuring segmentation accuracy, and provide a reliable technical foundation for subsequent intelligent document processing. Summary of the invention

[0005] In view of the above problems, the present invention provides a text image superpixel segmentation method and system to solve the above technical problems.

[0006] This application provides the following technical solutions: In a first aspect, the present invention provides a text image superpixel segmentation method, the method comprising: Acquire a first image, and read first image data therefrom; The first image is an acquired text image; the first image data is pixel feature data of the first image; Specifically, the first image is an actually collected original image or a non-original image after conventional processing; conventional processing refers to basic image processing such as denoising and splicing; According to the first image data, superpixel segmentation is performed on the first image to obtain a second image and second image data; The second image data is a segmentation result of the image obtained after the first image is segmented by superpixels; the segmentation result includes a plurality of superpixels and pixel feature data thereof; The pixel feature data at least includes color information of all pixels and superpixels in the image; The superpixel segmentation is to perform multiple iterative segmentations on the image according to the preset superpixel cluster center points through a superpixel segmentation algorithm until the iterations converge; According to the first image data and the second image data, performing superpixel segmentation on the second image again to obtain a third image; The re-superpixel segmentation is to re-superpixel segment the part or all of the superpixels that are not segmented reasonably according to the segmentation result of the second image data.

[0007] Specifically, since the third image is segmented by superpixels again, the difficulty of recognizing subsequent images can be reduced, the recognition accuracy can be improved, and the recognition speed can be accelerated.

[0008] The present invention extracts first image data including color information of all pixels from the original first image, and then uses the superpixel segmentation principle to perform multiple iterative segmentation to obtain a second image, and then, based on the segmentation result, performs superpixel segmentation again on part or all of the superpixels that are not segmented reasonably to obtain a third image, thereby providing more accurate and effective image data for the use of subsequent images. The present invention improves the accuracy of superpixel segmentation by performing superpixel segmentation again on part or all of the superpixels that are not segmented reasonably on the basis of superpixel segmentation, thereby improving the accuracy of image preprocessing. At the same time, only performing superpixel segmentation again on unreasonable superpixels not only saves data calculation amount, but also improves data processing efficiency.

[0009] Furthermore, the color information is color information in RGB color mode.

[0010] Furthermore, when performing superpixel segmentation on the first image, the method for determining the initial number of superpixels includes: Acquire a total number N of pixels of the first image; Set the initial distance between superpixel cluster centers to S pixels; Calculate the initial number of superpixels K, , K is an integer; The initial number of superpixels is the total number of all superpixels formed after the first image is segmented into superpixels for the first time; The superpixel is a small area composed of multiple pixel points that are adjacent in position and have similar features.

[0011] Furthermore, after determining the initial number of superpixels, the first image is pre-segmented, and the specific method is as follows: The first image is divided into K square superpixels with a side length of S; if there is a rectangular superpixel with a side length less than S due to the pixel size, the rectangular superpixel is still processed as one superpixel.

[0012] Specifically, the pre-segmentation is the first image segmentation in the superpixel segmentation process. After multiple subsequent iterative segmentations, the superpixel area will continue to change.

[0013] Furthermore, the step of performing superpixel segmentation on the second image again according to the first image data and the second image data to obtain a third image includes: Obtaining distribution color information of each superpixel in the first image data; Acquire reference color information of each superpixel in the second image data; Determining a color synchronization rate of each superpixel according to the reference color information and the distributed color information; According to the relationship between the color synchronization rate of each superpixel and the corresponding threshold, it is determined whether each superpixel needs to be segmented again; After performing superpixel segmentation again on each superpixel that needs to be segmented again, a third image is obtained; The reference color information is the color information of the current cluster center of each superpixel in the second image data, including at least the red, green, and blue brightness values ​​of the cluster center in the RGB color mode; The distributed color information is the color information of all pixels contained in each superpixel in the first image data, including at least the red, green, and blue brightness values ​​of the pixels in the RGB color mode; The color synchronization rate is the degree of deviation between the colors of all pixels included in the superpixel and the color of the current cluster center; Specifically, since the colors of all pixels in the superpixel after superpixel segmentation will be uniformly marked as the color of the cluster center, the color synchronization rate can accurately quantify the consistency between the colors of all pixels in the superpixel and the color of the cluster center. The color synchronization rate reflects whether the color of the cluster center can represent the colors of all pixels.

[0014] The present invention determines the color synchronization rate of each superpixel through the relationship between the reference color information and the distributed color information of each superpixel, and then judges whether each superpixel needs to be re-superpixel segmented according to the relationship between the color synchronization rate of each superpixel and the corresponding threshold. In this way, by quantifying the degree of deviation between the color of all pixel points contained in each superpixel and the color of the current cluster center, not only can the rationality of each superpixel be accurately judged, but also accurate data can be provided for the subsequent re-superpixel segmentation.

[0015] Furthermore, judging whether it is necessary to perform superpixel segmentation again according to the relationship between the color synchronization rate of each superpixel and the corresponding threshold value includes: When the color synchronization rate of a superpixel is less than a preset color synchronization rate threshold, it is determined that the superpixel does not need to be segmented again and is marked as a first superpixel; When the color synchronization rate of a superpixel is greater than or equal to a preset color synchronization rate threshold, it is determined that the superpixel needs to be segmented again; and the superpixel is marked as a second superpixel; Furthermore, the color synchronization rate is specifically as follows: ; For the Color synchronization rate of super pixels; For the The total number of pixels contained in a superpixel; For the All superpixels contain Among the pixels, The red brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The green brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The blue brightness value of a pixel in RGB color mode; For the The red brightness value of the cluster center of each superpixel in RGB color mode; For the The green brightness value of the cluster center of each superpixel in RGB color mode; For the The blue brightness value of the cluster center of each superpixel in RGB color mode; Specifically, are all color information extracted from the first image data, representing the color information of pixels that have not been segmented into superpixels; They are all color information of the cluster centers of superpixels extracted from the second image data, and represent the color information of the cluster centers of superpixels after superpixel segmentation.

[0016] The present invention divides each superpixel into a first superpixel and a second superpixel through the relationship between the color synchronization rate and a preset color synchronization rate threshold. This not only can accurately identify the superpixels that need to be re-segmented, but also reduces the data processing amount of subsequent re-superpixel segmentation, thereby improving the data processing efficiency of subsequent re-superpixel segmentation.

[0017] Furthermore, the step of re-segmenting each superpixel that needs to be re-segmented into superpixels to obtain a third image includes: Obtaining the ratio of the first pixel point and the second pixel point in the second superpixel in the superpixel, as well as the first distance between each first pixel point and its cluster center, and the first distance between each second pixel point and its cluster center, to determine the re-segmentation rate of the second superpixel; Determining a specific number of divisions of the second superpixel when performing a second superpixel division according to the second superpixel division rate; Performing superpixel segmentation again on the second superpixel according to the segmentation quantity to obtain a third image; The first distance is the color distance between a pixel point in a superpixel and its cluster center, indicating the degree of color difference between a pixel point in a superpixel and its cluster center; The first pixel point is a pixel point in the superpixel whose first distance is less than or equal to the first deviation distance; The second pixel point is a pixel point in the superpixel whose first distance is greater than the first deviation distance; The first deviation distance is the maximum allowed value of the first distance between a pixel point in a superpixel and its cluster center.

[0018] Furthermore, the method for determining the re-segmentation rate of the superpixel is as follows: ; in, For the The re-segmentation rate of superpixels; The re-segmentation rate is the degree to which a superpixel needs to be re-segmented; is the first deviation distance; The first deviation distance is the maximum allowable value of the first distance between a pixel point in a superpixel and its cluster center; The first distance is the color distance between a pixel point in a superpixel and its cluster center, indicating the degree of color difference between a pixel point in a superpixel and its cluster center; Specifically, if the first distance is less than or equal to the first deviation distance, it means that the color difference between the pixel point in the superpixel and its cluster center is small; If the first distance is greater than the first deviation distance, it means that the color difference between the pixel point in the superpixel and its cluster center is large; For the The number of first pixels in superpixels; For the The number of second pixels in a superpixel; The first pixel point is a pixel point in the superpixel whose first distance is less than or equal to the first deviation distance; The second pixel point is a pixel point in the superpixel whose first distance is greater than the first deviation distance; For the In the superpixel The first distance of the first pixel point, where ; For the In the superpixel The first distance of the second pixel point, where ; The method for obtaining the first distance is as follows: ; in, For the In the superpixel The first distance of pixels, where , .

[0019] Furthermore, the method for determining the specific number of segmentations during the second superpixel segmentation is as follows: like ,but ; like ,but ; in, The specific number of divisions when performing a second superpixel division for the second superpixel; is the initial value of the number of segmentations for the preset superpixel segmentation again, ,and The result of the square root operation is an integer.

[0020] Specifically, if the re-segmentation rate of a superpixel is greater than zero, it means that the superpixel needs a larger number of segmentations to meet the color synchronization rate requirement; If the re-segmentation rate of a superpixel is less than or equal to zero, it means that the superpixel needs a smaller number of segmentations to meet the color synchronization rate requirement.

[0021] Specifically, the re-superpixel segmentation, in theory, can be performed a second time on the superpixel after a re-superpixel segmentation, or the re-superpixel segmentation step can be repeated until all superpixels meet the color synchronization rate, but this will increase the amount of data calculation and reduce data processing efficiency. Therefore, usually a re-superpixel segmentation step is performed once to achieve a more satisfactory accuracy and achieve a balance between processing effect and processing efficiency.

[0022] The present invention divides the specific number of divisions when the second superpixel is divided into two cases, namely, a larger number of divisions and a smaller number of divisions, according to the re-division rate of each superpixel. The specific number of divisions is accurately quantified according to the preset initial value of the number of divisions for the re-superpixel division, thereby providing accurate data for the re-superpixel division.

[0023] In a second aspect, the present application provides a text image superpixel segmentation system, the system comprising: An image data reading module, used to acquire a first image and read first image data therefrom; the first image data is pixel feature data of the first image; the pixel feature data at least includes color information of all pixels and superpixels in the image; The first superpixel segmentation module is used to perform superpixel segmentation on the first image according to the first image data to obtain a second image and second image data; the second image data is the segmentation result of the image obtained after the first image is subjected to superpixel segmentation; the segmentation result includes a plurality of superpixels and pixel feature data thereof; the superpixel segmentation is to perform multiple iterative segmentations on the image according to a preset superpixel cluster center point through a superpixel segmentation algorithm until the iterations converge; A second superpixel segmentation module is used to perform a second superpixel segmentation on the second image according to the first image data and the second image data to obtain a third image; the second superpixel segmentation is to perform a second superpixel segmentation on part or all of the superpixels that are not reasonably segmented according to the segmentation result of the second image data; The system is used to execute the text image superpixel segmentation method as described in the first aspect.

[0024] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0025] In a fourth aspect, the present application provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to implement the method described in the first aspect when executing the computer program.

[0026] To sum up, since the present invention can perform superpixel segmentation on the first image based on the superpixel segmentation principle, and finally obtain the third image, therefore, by performing superpixel segmentation on part or all of the superpixels with unreasonable segmentation on the basis of superpixel segmentation, the accuracy of superpixel segmentation is improved, thereby improving the accuracy of image preprocessing, providing a more accurate and effective data basis for subsequent image data information utilization, and at the same time, only performing superpixel segmentation again on unreasonable superpixels not only saves data calculation amount but also improves data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] For ease of explanation, the present application is described in detail through the following specific implementations and drawings.

[0028] Figure 1 This is one of the method flow diagrams of this scheme; Figure 2 This is the second schematic diagram of the method flow of this scheme; Figure 3 This is a schematic diagram of the comparison of the text image segmentation effect of this scheme, where a is the original stain image, b is the initial super pixel segmentation effect diagram, and c is the second super image segmentation effect diagram; Figure 4 This is a schematic diagram of the system structure of this solution; Figure 5 A schematic diagram of a computer-readable storage medium of the present invention; Figure 6 Schematic diagram of the computer device of this solution. DETAILED DESCRIPTION

[0029] The following will be combined with the figures in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] Embodiment 1 like Figure 1 As shown, this embodiment provides a text image superpixel segmentation method, the method comprising: Acquire a first image, and read first image data therefrom; The first image is an acquired text image; the first image data is pixel feature data of the first image; Specifically, the first image is an actually collected original image or a non-original image after conventional processing; conventional processing refers to basic image processing such as denoising and splicing; For example, the first image is a low-quality text image or a text image with a complex background, stains, etc.; Specifically, superpixel segmentation has obvious advantages in the image preprocessing and regional analysis stages, especially in text detection, segmentation and enhancement tasks in complex scenes. For example, when low-quality text images or text images with stains have poor results using traditional recognition methods, superpixel segmentation can be used for preprocessing, and then the text data can be recognized and extracted to achieve better recognition results. The specific reasons are as follows: (1) For low-quality text images, such as old document scans with stains, fading, or local blur, superpixel segmentation can suppress local noise (such as merging the stained area into a superpixel) while retaining the text edge. The superpixels can then be binarized or enhanced to improve OCR accuracy.

[0031] (2) Text images with complex backgrounds, such as scanned documents or natural scene images (such as billboards, product packaging), have complex backgrounds with textures, noise, or non-text interference elements (such as patterns, shadows). Traditional methods based on sliding windows or edge detection are inefficient, and direct binarization may result in the inability to extract text areas. If superpixel segmentation is used, background interference (such as stains) can be merged into a few large areas by superpixels, while text areas form independent superpixels due to high contrast, which is convenient for subsequent filtering. For example, after color clustering of superpixels, areas with grayscale values ​​close to text (such as black) can be retained, effectively improving the accuracy and extraction efficiency of subsequent text recognition.

[0032] The above application scenarios all need to be based on the accuracy of the previous superpixel segmentation. The text image superpixel segmentation method of the present invention divides the image into a first superpixel and a second superpixel, identifies the superpixels that need to be segmented again, and then allocates different segmentation numbers to the superpixels that need to be segmented again according to the re-segmentation rate. Therefore, on the basis of improving the accuracy of superpixel segmentation, it can further reduce the amount of data calculation and improve data processing efficiency.

[0033] Next, according to the first image data, superpixel segmentation is performed on the first image to obtain a second image and second image data; The second image data is a segmentation result of the image obtained after the first image is segmented by superpixels; the segmentation result includes a plurality of superpixels and pixel feature data thereof; The pixel feature data at least includes color information of all pixels and superpixels in the image; The superpixel segmentation is to perform multiple iterative segmentations on the image according to the preset superpixel cluster center points through a superpixel segmentation algorithm until the iterations converge; According to the first image data and the second image data, performing superpixel segmentation on the second image again to obtain a third image; The re-superpixel segmentation is to re-superpixel segment the part or all of the superpixels that are not segmented reasonably according to the segmentation result of the second image data.

[0034] Specifically, since the third image is segmented again by superpixels, it can reduce the difficulty of subsequent image recognition, improve recognition accuracy, and speed up recognition. For example, if the first image is a stained text image, the third image can be divided into regions and recognized through a trained neural network, and the recognition results obtained can provide accurate image data for subsequent text recognition, text conversion and other application fields.

[0035] The present invention extracts first image data including color information of all pixels from the original first image, and then uses the superpixel segmentation principle to perform multiple iterative segmentation to obtain a second image, and then, based on the segmentation result, performs superpixel segmentation again on part or all of the superpixels that are not segmented reasonably to obtain a third image, thereby providing more accurate and effective image data for the use of subsequent images. For example, if the first image is a low-quality text image or a text image with stains / complex background, the obtained third image can provide more accurate and effective text image data for subsequent text recognition. The present invention improves the accuracy of superpixel segmentation by performing superpixel segmentation again on part or all of the superpixels that are not segmented reasonably on the basis of superpixel segmentation, thereby improving the accuracy of image preprocessing. At the same time, only performing superpixel segmentation again on unreasonable superpixels not only saves data calculation amount, but also improves data processing efficiency.

[0036] Furthermore, the color information is color information in RGB color mode.

[0037] Specifically, the RGB color mode, also known as the three-primary color mode or natural color mode, mixes various colors by adjusting the brightness of the three colors of red, green, and blue. There are an infinite number of different colors in nature, but the human eye can only distinguish a limited number of different colors. The RGB mode can represent more than 16 million different colors, which is very close to the colors of nature in the eyes of the human eye.

[0038] The RGB color model can be represented by a cube of unit length. In this model, black is usually located at the origin of the three-dimensional rectangular coordinate system, red, green, and blue are located on the three coordinate axes, and white is located at the corner farthest from the origin. The entire cube is placed in the first quadrant, which contains most of the colors that the human eye can distinguish. In addition, cyan and red, purple and green, and yellow and blue are complementary colors, and they are located in opposite positions on the cube. In the RGB color model, any color can be represented by a point in three-dimensional space. The coordinates of this point are composed of the intensity values ​​of the three components of red, green, and blue, and are usually represented by integers in the range of 0-255, where 0 represents the minimum intensity (no color) and 255 represents the maximum intensity (the brightest color). Different colors can be obtained by adjusting the intensity values ​​of these three components.

[0039] The RGB color model is a color standard in the industry. It obtains a variety of colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents the colors of the three channels of red, green, and blue. This standard covers almost all colors that can be perceived by human vision and is one of the most widely used color systems at present.

[0040] The RGB color mode adopted by the present invention is very close to the colors of nature and can provide close to real color information for subsequent image data processing.

[0041] Furthermore, when performing superpixel segmentation on the first image, the method for determining the initial number of superpixels includes: Acquire a total number N of pixels of the first image; Set the initial distance between superpixel cluster centers to S pixels; Calculate the initial number of superpixels K, , K is an integer; The initial number of superpixels is the total number of all superpixels formed after the first image is segmented into superpixels for the first time; The superpixel is a small area composed of multiple pixel points that are adjacent in position and have similar features.

[0042] Specifically, the generation process of superpixels usually involves pixel clustering operations. In an image, pixels with similar features are grouped together to form a superpixel. Since the color, brightness, texture and other features of pixels within a superpixel are similar, a small number of superpixels can be used to replace a large number of pixels to express the features of the image, which greatly reduces the complexity of image processing. At the same time, these small areas mostly retain effective information for further image segmentation and generally do not destroy the boundary information of objects in the image.

[0043] Superpixels have a wide range of applications, including but not limited to computer vision tasks such as image segmentation, target tracking, target recognition, and pose estimation. In these tasks, superpixels can be used as a preprocessing step to provide a more concise and effective image representation for subsequent processing. In addition, superpixels can also be used in areas such as image compression and image denoising to improve processing efficiency and effectiveness.

[0044] In general, superpixel is an important image processing technology that forms a higher-level image representation unit by clustering pixels with similar features. Each superpixel can serve as an independent processing unit, which facilitates subsequent image processing tasks.

[0045] Specifically, the superpixel segmentation algorithm, especially the SLIC (Simple Linear Iterative Clustering) superpixel segmentation algorithm, is a widely used technology in image processing. It simplifies the complexity of the image by dividing the image into superpixel blocks with similar colors and spatial positions. The following are the steps of the SLIC superpixel segmentation algorithm: Step 1: Initialize cluster centers First, select the cluster center: according to the set number of superpixels K, pre-split it into K superpixels of the same size, and evenly distribute K cluster centers on the image.

[0046] Secondly, optimize the location of cluster centers: in the n×n neighborhood of each cluster center (usually n is 3), calculate the gradient values ​​of all pixels and move the cluster center to the place with the smallest gradient. This is done to avoid the cluster center falling on the edge of the image or noise points, which will affect the subsequent clustering effect.

[0047] Step 2: Assign pixels to the nearest cluster center First, search the neighborhood: for each pixel in the image, search for the nearest cluster center within its 2S×2S neighborhood. This range is larger than the expected size S of the superpixel to ensure that each pixel can find a suitable cluster center.

[0048] Secondly, assign labels: assign each pixel to the nearest cluster center based on color similarity and spatial proximity; this step is similar to the pixel assignment process in K-means clustering, but the search range of the SLIC algorithm is limited to the local neighborhood, which accelerates the convergence of the algorithm.

[0049] Step 3: Iteratively update the cluster center position First, calculate the new cluster center: for each superpixel, calculate the average or weighted average of the color and spatial information of all pixels inside it as the new cluster center position.

[0050] Secondly, iterative convergence: repeat steps 2 and 3 until the position change of the cluster center is less than the preset threshold or the maximum number of iterations is reached. During the iteration process, the shape and boundary of the superpixel will gradually become clear and stable.

[0051] Through the above steps, the SLIC superpixel segmentation algorithm can divide the image into superpixel blocks with similar features, providing a powerful tool for subsequent image analysis and processing.

[0052] The superpixel segmentation method of this embodiment is based on the SLIC superpixel segmentation algorithm. By dividing the image into a first superpixel and a second superpixel, superpixels that need to be segmented again are identified. Then, different segmentation numbers are assigned to the superpixels that need to be segmented again according to the re-segmentation rate. This not only retains important details and boundary information of the image, but also achieves a good balance between processing speed and segmentation quality.

[0053] Similarly, if the text superpixel segmentation method of the present invention is used on the basis of other existing superpixel segmentation algorithms (except SLIC), by dividing the image into the first superpixel and the second superpixel, the superpixel that needs to be re-segmented is identified, and then, according to the re-segmentation rate, different segmentation numbers are assigned to the superpixel that needs to be re-segmented, which can also achieve the effect of retaining important details and boundary information of the image and achieving a better balance between processing speed and segmentation quality. In practice, according to the characteristics of different superpixel segmentation algorithms, the text superpixel segmentation method of the present invention can be used as the basis of a suitable superpixel segmentation algorithm to obtain better results.

[0054] Furthermore, after determining the initial number of superpixels, the first image is pre-segmented, and the specific method is as follows: The first image is divided into K square superpixels with a side length of S; if there is a rectangular superpixel with a side length less than S due to the pixel size, the rectangular superpixel is still processed as one superpixel.

[0055] Specifically, the pre-segmentation is the first image segmentation in the superpixel segmentation process. After multiple subsequent iterative segmentations, the superpixel area will continue to change.

[0056] Further, such as Figure 2 As shown, the second image is segmented again into superpixels according to the first image data and the second image data to obtain a third image, including: Obtaining distribution color information of each superpixel in the first image data; Acquire reference color information of each superpixel in the second image data; Determining a color synchronization rate of each superpixel according to the reference color information and the distributed color information; According to the relationship between the color synchronization rate of each superpixel and the corresponding threshold, it is determined whether each superpixel needs to be segmented again; After performing superpixel segmentation again on each superpixel that needs to be segmented again, a third image is obtained; The reference color information is the color information of the current cluster center of each superpixel in the second image data, including at least the red, green, and blue brightness values ​​of the cluster center in the RGB color mode; The distributed color information is the color information of all pixels contained in each superpixel in the first image data, including at least the red, green, and blue brightness values ​​of the pixels in the RGB color mode; The color synchronization rate is the degree of deviation between the colors of all pixels included in the superpixel and the color of the current cluster center; Specifically, since the colors of all pixels in the superpixel after superpixel segmentation will be uniformly marked as the color of the cluster center, the color synchronization rate can accurately quantify the consistency between the colors of all pixels in the superpixel and the color of the cluster center. The color synchronization rate reflects whether the color of the cluster center can represent the colors of all pixels.

[0057] The present invention determines the color synchronization rate of each superpixel through the relationship between the reference color information and the distributed color information of each superpixel, and then judges whether each superpixel needs to be re-superpixel segmented according to the relationship between the color synchronization rate of each superpixel and the corresponding threshold. In this way, by quantifying the degree of deviation between the color of all pixel points contained in each superpixel and the color of the current cluster center, not only can the rationality of each superpixel be accurately judged, but also accurate data can be provided for the subsequent re-superpixel segmentation.

[0058] Furthermore, judging whether it is necessary to perform superpixel segmentation again according to the relationship between the color synchronization rate of each superpixel and the corresponding threshold value includes: When the color synchronization rate of a superpixel is less than a preset color synchronization rate threshold, it is determined that the superpixel does not need to be segmented again and is marked as a first superpixel; When the color synchronization rate of a superpixel is greater than or equal to a preset color synchronization rate threshold, it is determined that the superpixel needs to be segmented again; and the superpixel is marked as a second superpixel; The color synchronization rate is specifically as follows: ; For the Color synchronization rate of super pixels; For the The total number of pixels contained in a superpixel; For the All superpixels contain Among the pixels, The red brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The green brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The blue brightness value of a pixel in RGB color mode; For the The red brightness value of the cluster center of each superpixel in RGB color mode; For the The green brightness value of the cluster center of each superpixel in RGB color mode; For the The blue brightness value of the cluster center of each superpixel in RGB color mode; Specifically, are all color information extracted from the first image data, representing the color information of pixels that have not been segmented into superpixels; They are all color information of the cluster centers of superpixels extracted from the second image data, and represent the color information of the cluster centers of superpixels after superpixel segmentation.

[0059] The present invention divides each superpixel into a first superpixel and a second superpixel through the relationship between the color synchronization rate and a preset color synchronization rate threshold. This not only can accurately identify the superpixels that need to be re-segmented, but also reduces the data processing amount of subsequent re-superpixel segmentation, thereby improving the data processing efficiency of subsequent re-superpixel segmentation.

[0060] Furthermore, the step of re-segmenting each superpixel that needs to be re-segmented into superpixels to obtain a third image includes: Obtaining the ratio of the first pixel point and the second pixel point in the second superpixel in the superpixel, as well as the first distance between each first pixel point and its cluster center, and the first distance between each second pixel point and its cluster center, to determine the re-segmentation rate of the second superpixel; Determining a specific number of divisions of the second superpixel when performing a second superpixel division according to the second superpixel division rate; Performing superpixel segmentation again on the second superpixel according to the segmentation quantity to obtain a third image; The first distance is the color distance between a pixel point in a superpixel and its cluster center, indicating the degree of color difference between a pixel point in a superpixel and its cluster center; The first pixel point is a pixel point in the superpixel whose first distance is less than or equal to the first deviation distance; The second pixel point is a pixel point in the superpixel whose first distance is greater than the first deviation distance; The first deviation distance is the maximum allowed value of the first distance between a pixel point in a superpixel and its cluster center.

[0061] Furthermore, the method for determining the re-segmentation rate of the superpixel is as follows: ; in, For the The re-segmentation rate of superpixels; The re-segmentation rate is the degree to which a superpixel needs to be re-segmented; is the first deviation distance; The first deviation distance is the maximum allowable value of the first distance between a pixel point in a superpixel and its cluster center; The first distance is the color distance between a pixel point in a superpixel and its cluster center, indicating the degree of color difference between a pixel point in a superpixel and its cluster center; Specifically, if the first distance is less than or equal to the first deviation distance, it means that the color difference between the pixel point in the superpixel and its cluster center is small; If the first distance is greater than the first deviation distance, it means that the color difference between the pixel point in the superpixel and its cluster center is large; For the The number of first pixels in superpixels; For the The number of second pixels in a superpixel; The first pixel point is a pixel point in the superpixel whose first distance is less than or equal to the first deviation distance; The second pixel point is a pixel point in the superpixel whose first distance is greater than the first deviation distance; For the In the superpixel The first distance of the first pixel point, where ; For the In the superpixel The first distance of the second pixel point, where ; The method for obtaining the first distance is as follows: ; in, For the In the superpixel The first distance of pixels, where , .

[0062] The present invention determines the re-segmentation rate of a superpixel by the ratio of a first pixel point to a second pixel point in its superpixel, the first distance between each first pixel point and its cluster center, and the first distance between each second pixel point and its cluster center, and further determines the specific number of segmentations required for re-superpixel segmentation according to the re-segmentation rate of the superpixel; the present invention accurately quantifies the number of segmentations required for each superpixel that needs to be re-superpixel segmented according to the segmentation rate of the superpixel, and then provides a clear selection direction for determining the number of segmentations in the next step according to the quantized value of the segmentation rate of the superpixel, which not only improves the accuracy of the number of segmentations during re-superpixel segmentation, but also speeds up the execution efficiency of re-superpixel segmentation.

[0063] Furthermore, the method for determining the specific number of segmentations during the second superpixel segmentation is as follows: like ,but ; like ,but ; in, The specific number of divisions when performing a second superpixel division for the second superpixel; is the initial value of the number of segmentations for the preset superpixel segmentation again, ,and The result of the square root operation is an integer.

[0064] Specifically, if the re-segmentation rate of a superpixel is greater than zero, it means that the superpixel needs a larger number of segmentations to meet the color synchronization rate requirement; If the re-segmentation rate of a superpixel is less than or equal to zero, it means that the superpixel needs a smaller number of segmentations to meet the color synchronization rate requirement.

[0065] Specifically, the re-superpixel segmentation, in theory, can be performed a second time on the superpixel after a re-superpixel segmentation, or the re-superpixel segmentation step can be repeated until all superpixels meet the color synchronization rate, but this will increase the amount of data calculation and reduce data processing efficiency. Therefore, usually a re-superpixel segmentation step is performed once to achieve a more satisfactory accuracy and achieve a balance between processing effect and processing efficiency.

[0066] The present invention divides the specific number of divisions when the second superpixel is divided into two cases, namely, a larger number of divisions and a smaller number of divisions, according to the re-division rate of each superpixel. The specific number of divisions is accurately quantified according to the preset initial value of the number of divisions for the re-superpixel division, thereby providing accurate data for the re-superpixel division.

[0067] Combination Figure 3 As shown, in this embodiment, taking an old document image contaminated by stains as an example, the original image is as follows Figure 3 As shown in a, after extracting the basic data from the original image, the first superpixel segmentation is performed, and the effect is as follows Figure 3 As shown in Figure b, it can be seen that due to the large number of mixed pixels in some areas of the image, there will be a large number of noise pixels left after superpixel segmentation in some areas, which will cause unnecessary increase in the amount of data in subsequent image processing. On this basis, the re-superpixel segmentation method of this scheme is continued to be applied, and the effect after re-segmentation is as follows Figure 3 As shown in c, most of the noise pixels have been removed, and the edges of the area are more neat and clear, which is more conducive to the subsequent effective area segmentation and extraction of image data, as well as the recognition of text information, and improves the efficiency of effective text area extraction.

[0068] Example 2 like Figure 4 As shown, this embodiment provides a text image superpixel segmentation system, the system comprising: An image data reading module, used to acquire a first image and read first image data therefrom; the first image data is pixel feature data of the first image; the pixel feature data at least includes color information of all pixels and superpixels in the image; The first superpixel segmentation module is used to perform superpixel segmentation on the first image according to the first image data to obtain a second image and second image data; the second image data is the segmentation result of the image obtained after the first image is subjected to superpixel segmentation; the segmentation result includes a plurality of superpixels and pixel feature data thereof; the superpixel segmentation is to perform multiple iterative segmentations on the image according to a preset superpixel cluster center point through a superpixel segmentation algorithm until the iterations converge; A second superpixel segmentation module is used to perform a second superpixel segmentation on the second image according to the first image data and the second image data to obtain a third image; the second superpixel segmentation is to perform a second superpixel segmentation on part or all of the superpixels that are not reasonably segmented according to the segmentation result of the second image data; The system is used to execute the text image superpixel segmentation method as described in Example 1.

[0069] Example 3 like Figure 5 As shown, this embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in Embodiment 1 is implemented.

[0070] Example 4 like Figure 6As shown, this embodiment provides a computer device, including a memory and a processor; the memory is used to store a computer program; the processor is used to implement the method described in Example 1 when executing the computer program.

[0071] In summary, since the present invention can perform superpixel segmentation on the part or all of the superpixels that are not reasonably segmented on the basis of performing superpixel segmentation on the first image using the superpixel segmentation principle, and finally obtain a third image, image data is provided for subsequent text area division, text recognition, etc. Therefore, by performing superpixel segmentation on the part or all of the superpixels that are not reasonably segmented on the basis of superpixel segmentation, the accuracy of superpixel segmentation is improved, thereby improving the accuracy of image preprocessing. At the same time, only performing superpixel segmentation on unreasonable superpixels not only saves data calculation amount, but also improves data processing efficiency.

[0072] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, media, devices, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0073] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0074] The modules or units described as separate components may or may not be physically separated, and the components displayed as modules or units may or may not be physical modules or units, that is, they may be located in one place, or they may be distributed on multiple network modules or units. Some or all of the modules or units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0075] In addition, each functional module or unit in each embodiment of the present application may be integrated into one processing module or unit, or each module or unit may exist physically separately, or two or more modules or units may be integrated into one module or unit. The above-mentioned integrated modules or units may be implemented in the form of hardware or in the form of software functional units.

[0076] The integrated system, module, unit, etc., if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A text image superpixel segmentation method, characterized in that: The method comprises: Acquire a first image, and read first image data therefrom; The first image is an acquired text image; the first image data is pixel feature data of the first image; According to the first image data, superpixel segmentation is performed on the first image to obtain a second image and second image data; The second image data is a segmentation result of the image obtained after the first image is segmented by superpixels; the segmentation result includes a plurality of superpixels and pixel feature data thereof; The pixel feature data at least includes color information of all pixels and superpixels in the image; According to the first image data and the second image data, performing superpixel segmentation on the second image again to obtain a third image; The re-superpixel segmentation is to re-superpixel segment the part or all of the superpixels that are not segmented reasonably according to the segmentation result of the second image data.

2. The text image superpixel segmentation method according to claim 1, characterized in that: The color information is color information in RGB color mode.

3. The text image superpixel segmentation method according to claim 1, characterized in that: When performing superpixel segmentation on the first image, the method for determining the number of initial superpixels includes: Acquire a total number N of pixels of the first image; Set the initial distance between superpixel cluster centers to S pixels; Calculate the initial number of superpixels K, , K is an integer; The initial number of superpixels is the total number of all superpixels formed after the first image is segmented into superpixels for the first time; The superpixel is a small area composed of multiple pixel points that are adjacent in position and have similar features.

4. The text image superpixel segmentation method according to claim 3, characterized in that: After determining the initial number of superpixels, the first image is pre-segmented, specifically by: The first image is divided into K square superpixels with a side length of S; if there is a rectangular superpixel with a side length less than S due to the pixel size, the rectangular superpixel is still processed as one superpixel.

5. The text image superpixel segmentation method according to claim 1, characterized in that: The step of performing superpixel segmentation on the second image again according to the first image data and the second image data to obtain a third image comprises: Obtaining distribution color information of each superpixel in the first image data; Acquire reference color information of each superpixel in the second image data; Determining a color synchronization rate of each superpixel according to the reference color information and the distributed color information; According to the relationship between the color synchronization rate of each superpixel and the corresponding threshold, it is determined whether each superpixel needs to be segmented again; After performing superpixel segmentation again on each superpixel that needs to be segmented again, a third image is obtained; The reference color information is the color information of the current cluster center of each superpixel in the second image data, including at least the red, green, and blue brightness values ​​of the cluster center in the RGB color mode; The distributed color information is the color information of all pixels contained in each superpixel in the first image data, including at least the red, green, and blue brightness values ​​of the pixels in the RGB color mode; The color synchronization rate is the degree of deviation between the colors of all pixels included in the superpixel and the color of the current cluster center.

6. The text image superpixel segmentation method according to claim 5, characterized in that: The step of judging whether to perform superpixel segmentation again according to the relationship between the color synchronization rate of each superpixel and the corresponding threshold value includes: When the color synchronization rate of a superpixel is less than a preset color synchronization rate threshold, it is determined that the superpixel does not need to be segmented again and is marked as a first superpixel; When the color synchronization rate of a superpixel is greater than or equal to a preset color synchronization rate threshold, it is determined that the superpixel needs to be segmented again; and the superpixel is marked as a second superpixel; The color synchronization rate is as follows: ; For the Color synchronization rate of super pixels; For the The total number of pixels contained in a superpixel; For the All superpixels contain Among the pixels, The red brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The green brightness value of a pixel in RGB color mode; For the All superpixels contain Among the pixels, The blue brightness value of a pixel in RGB color mode; For the The red brightness value of the cluster center of each superpixel in RGB color mode; For the The green brightness value of the cluster center of each superpixel in RGB color mode; For the The blue brightness value of the cluster center of each superpixel in RGB color mode.

7. The text image superpixel segmentation method according to claim 6, characterized in that: The step of re-segmenting each superpixel that needs to be re-segmented into superpixels to obtain a third image comprises: Obtaining the ratio of the first pixel point and the second pixel point in the second superpixel in the superpixel, as well as the first distance between each first pixel point and its cluster center, and the first distance between each second pixel point and its cluster center, to determine the re-segmentation rate of the second superpixel; Determining a specific number of divisions of the second superpixel when performing a second superpixel division according to the second superpixel division rate; Performing superpixel segmentation again on the second superpixel according to the segmentation quantity to obtain a third image; The first distance is the color distance between a pixel point in a superpixel and its cluster center, indicating the degree of color difference between a pixel point in a superpixel and its cluster center; The first pixel point is a pixel point in the superpixel whose first distance is less than or equal to the first deviation distance; The second pixel point is a pixel point in the superpixel whose first distance is greater than the first deviation distance; The first deviation distance is the maximum allowed value of the first distance between a pixel point in a superpixel and its cluster center.

8. The text image superpixel segmentation method according to claim 7, characterized in that: The method for determining the re-segmentation rate of the superpixel is as follows: ; in , for The re-segmentation rate of superpixels; The re-segmentation rate is the degree to which a superpixel needs to be re-segmented; is the first deviation distance; For the The number of first pixels in superpixels; For the The number of second pixels in a superpixel; For the In the superpixel The first distance between the first pixel and its cluster center, where ; For the In the superpixel The first distance between the second pixel and its cluster center, where ; The method for obtaining the first distance is as follows: ; in, For the In the superpixel The first distance of pixels, where , .

9. The text image superpixel segmentation method according to claim 7, characterized in that: The method for determining the specific number of segmentations during the second superpixel segmentation is as follows: like ,but ; like ,but ; in, The specific number of divisions when performing a second superpixel division for the second superpixel; is the initial value of the number of segmentations for the preset superpixel segmentation again, ,and The result of the square root operation is an integer.

10. A text image superpixel segmentation system, characterized in that: The system comprises: An image data reading module is used to obtain a first image and read first image data therefrom; the first image is an obtained text image; the first image data is pixel feature data of the first image; the pixel feature data at least includes color information of all pixels and superpixels in the image; The first superpixel segmentation module is used to perform superpixel segmentation on the first image according to the first image data to obtain a second image and second image data; the second image data is the segmentation result of the image obtained after the first image is subjected to superpixel segmentation; the segmentation result includes a plurality of superpixels and pixel feature data thereof; the superpixel segmentation is to perform multiple iterative segmentations on the image according to a preset superpixel cluster center point through a superpixel segmentation algorithm until the iterations converge; The second superpixel segmentation module is used to perform a second superpixel segmentation on the second image according to the first image data and the second image data to obtain a third image; the second superpixel segmentation is to perform a second superpixel segmentation on part or all of the superpixels that are unreasonable according to the segmentation result of the second image data.

Citation Information

Patent Citations

  • Image segmentation method fusing depth and color information

    CN110610505A

  • Superpixel segmentation method and device based on edge constraint and segmentation boundary search

    CN112164087A

  • Image segmentation method and device

    CN117876387A

  • Superpixel- and multivariate color space-based body outline extraction method

    WO2019062092A1