File image recognition method, device and equipment and storage medium

CN121564735BActive Publication Date: 2026-10-23QINGDAO HAIER TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511497970.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-10-23
Estimated Expiration
2045-10-17

AI Technical Summary

Technical Problem

[0005]本申请提供一种文件图像的识别方法、装置、设备和存储介质,以解决传统OCR技术无法有效消除图像中的线条干扰、光照不均及小字号模糊等问题,降低了文件图像识别的准确率的问题

Benefits of technology

[0077]本申请提供一种文件图像的识别方法、装置、设备和存储介质,对初始文件图像执行一级预处理操作,得到亮度和清晰度调整后的中间文件图像,之后,对中间文件图像执行二级预处理操作,得到文字像素调整后的目标文件图像,识别目标文件图像得到文字识别结果,并输出。通过上述方式,基于“亮度-清晰度优化”的一级预处理和“文字像素精调”的两级预处理,将线条干扰、光照不均及小字号模糊逐一剥离,使OCR面对干净、高对比的文件图像,从而提升文件图像识别的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564735B_ABST
    Figure CN121564735B_ABST
Patent Text Reader

Abstract

The application discloses a file image recognition method and device, equipment and storage medium, and relates to the technical field of image processing. The method comprises the following steps: in response to a character recognition application, performing a first pre-processing operation on an initial file image contained in the character recognition application to obtain an intermediate file image, wherein the first pre-processing operation is used for adjusting the brightness of the initial file image or the completeness of character pixels; determining a character region of the intermediate file image, and performing a second pre-processing operation on the character region to obtain a target file image to be recognized, wherein the second pre-processing operation is used for adjusting the size of the character pixels in the character region; recognizing the target file image to obtain a character recognition result, and outputting the character recognition result. In the above manner, the file image is cleaner and has higher contrast, so that the accuracy of file image recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and more specifically, to a method, apparatus, device, and storage medium for recognizing document images. Background Technology

[0002] Optical Character Recognition (OCR) technology, which converts text information in images into editable text, has been widely used in document digitization, automated information extraction, and other fields. In recent years, with the maturity of deep learning algorithms, the accuracy of OCR in general scenarios has significantly improved, and the successful deployment of open-source tools such as PaddleOCR and Tesseract has further lowered the technical threshold.

[0003] However, engineering documents and images, such as design drawings of home appliances like dishwashers, televisions, and dryers, have unique layout characteristics: text annotations vary in size and direction, and are closely intertwined with a large number of non-text elements such as lines, symbols, and cross-sections.

[0004] However, traditional OCR technology usually relies on only single image enhancement or global threshold segmentation, which cannot effectively eliminate problems such as line interference, uneven lighting, and blurring of small fonts in the image, thus reducing the accuracy of document image recognition. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for recognizing document images, in order to solve the problem that traditional OCR technology cannot effectively eliminate line interference, uneven lighting, and blurring of small fonts in images, thus reducing the accuracy of document image recognition.

[0006] In a first aspect, this application provides a method for recognizing document images, comprising:

[0007] In response to a text recognition application, a first-level preprocessing operation is performed on the initial document image contained in the text recognition application to obtain an intermediate document image, wherein the first-level preprocessing operation is used to adjust the brightness or the integrity of the text pixels in the initial document image;

[0008] The text region of the intermediate file image is determined, and a secondary preprocessing operation is performed on the text region to obtain the target file image to be identified. The secondary preprocessing operation is used to adjust the size of the text pixels within the text region.

[0009] The target file image is identified to obtain text recognition results, and the text recognition results are output.

[0010] In one possible implementation, performing a first-level preprocessing operation on the initial file image contained in the text recognition application to obtain an intermediate file image includes:

[0011] The average grayscale value of the initial file image is determined, and the brightness type of the initial file image is determined based on the average grayscale value, wherein the brightness type includes bright, dark and normal.

[0012] Based on the brightness type, perform a grayscale enhancement operation on the initial file image to obtain a candidate file image;

[0013] Perform morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image.

[0014] In one possible implementation, performing morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image includes:

[0015] Convert the candidate file image into an initial binary image;

[0016] A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image;

[0017] A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image;

[0018] The target binary image and the candidate file image are superimposed to obtain an intermediate file image.

[0019] In one possible implementation, performing a secondary preprocessing operation on the text region to obtain the target file image to be identified includes:

[0020] A first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold.

[0021] Based on the text pixels, at least one candidate region is determined, and the region pixels of each candidate region are determined;

[0022] From at least one of the candidate regions, target regions with region pixels less than or equal to a region pixel threshold are selected;

[0023] A pixel magnification operation is performed on the target area, and the magnified target area is then overlaid onto the text area to obtain the target file image to be identified.

[0024] In one possible implementation, before obtaining the text recognition result by recognizing the target file image, the method further includes:

[0025] The target file image is denoised by calling a preset denoising function to obtain the denoised target file image.

[0026] Based on the gray-level similarity between each pixel and its neighbors in the denoised target file image, a weighted average operation is performed on each pixel, wherein the weight is proportional to the gray-level similarity.

[0027] Using an 11×11 pixel sliding window, calculate the Gaussian weighted average gray level of the pixels within the window, and determine the second segmentation threshold of the target pixel in the middle position within the window based on the difference between the Gaussian weighted average gray level and a preset constant.

[0028] Based on the relationship between the second segmentation threshold and the size of the target pixel, the target pixel is marked as either a background pixel or a target pixel;

[0029] After marking all pixels, the binarized target file image is obtained.

[0030] In one possible implementation, the step of identifying the target file image to obtain text recognition results includes:

[0031] The target file image is recognized using OCR technology to obtain the original recognition result, wherein the original recognition result includes at least one text candidate box and the corresponding text sequence, and the text candidate box includes the coordinates of the four vertices of the text region where the corresponding text sequence is located;

[0032] The target file image is rotated by a preset degree to obtain a rotated file image, and the rotated file image is recognized by OCR technology to obtain the rotation recognition result;

[0033] Each text candidate box within the rotation recognition result is updated by performing inverse matrix operations;

[0034] The original recognition result and the updated rotation recognition result are combined to obtain the candidate character recognition result;

[0035] The candidate character recognition results are filtered to obtain the final character recognition result.

[0036] In one possible implementation, the candidate character recognition result further includes a confidence score for each character sequence, and the filtering operation on the candidate character recognition results to obtain the final character recognition result includes:

[0037] From at least one text sequence in the candidate text recognition results, select target text sequences with a confidence level greater than or equal to a confidence threshold;

[0038] The final text recognition result is determined based on the target text sequence and the corresponding text candidate boxes.

[0039] Secondly, this application provides a document image recognition device, comprising: a first processing operation, a second processing operation, and a recognition operation, wherein:

[0040] The first processing module is configured to, in response to a text recognition application, perform a first-level preprocessing operation on the initial file image contained in the text recognition application to obtain an intermediate file image, wherein the first-level preprocessing operation is used to adjust the brightness or the integrity of the text pixels of the initial file image;

[0041] The second processing module is used to determine the text region of the intermediate file image and perform a secondary preprocessing operation on the text region to obtain the target file image to be identified, wherein the secondary preprocessing operation is used to adjust the size of the text pixels within the text region;

[0042] The recognition module is used to recognize the target file image to obtain text recognition results and output the text recognition results.

[0043] In one possible implementation, the first processing module is further configured to:

[0044] The average grayscale value of the initial file image is determined, and the brightness type of the initial file image is determined based on the average grayscale value, wherein the brightness type includes bright, dark and normal.

[0045] Based on the brightness type, perform a grayscale enhancement operation on the initial file image to obtain a candidate file image;

[0046] Perform morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image.

[0047] In one possible implementation, the first processing module is further configured to:

[0048] Convert the candidate file image into an initial binary image;

[0049] A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image;

[0050] A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image;

[0051] The target binary image and the candidate file image are superimposed to obtain an intermediate file image.

[0052] In one possible implementation, the second processing module is further configured to:

[0053] A first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold.

[0054] Based on the text pixels, at least one candidate region is determined, and the region pixels of each candidate region are determined;

[0055] From at least one of the candidate regions, target regions with region pixels less than or equal to a region pixel threshold are selected;

[0056] A pixel magnification operation is performed on the target area, and the magnified target area is then overlaid onto the text area to obtain the target file image to be identified.

[0057] In one possible implementation, the second processing module is further configured to:

[0058] The target file image is denoised by calling a preset denoising function to obtain the denoised target file image.

[0059] Based on the gray-level similarity between each pixel and its neighbors in the denoised target file image, a weighted average operation is performed on each pixel, wherein the weight is proportional to the gray-level similarity.

[0060] Using an 11×11 pixel sliding window, calculate the Gaussian weighted average gray level of the pixels within the window, and determine the second segmentation threshold of the target pixel in the middle position within the window based on the difference between the Gaussian weighted average gray level and a preset constant.

[0061] Based on the relationship between the second segmentation threshold and the size of the target pixel, the target pixel is marked as either a background pixel or a target pixel;

[0062] After marking all pixels, the binarized target file image is obtained.

[0063] In one possible implementation, the identification module is further configured to:

[0064] The target file image is recognized by OCR technology to obtain the original recognition result, wherein the original recognition result includes at least one text candidate box and the corresponding text sequence, and the text candidate box includes the coordinates of the four vertices of the text region where the corresponding text sequence is located;

[0065] The target file image is rotated by a preset degree to obtain a rotated file image, and the rotated file image is recognized by OCR technology to obtain the rotation recognition result;

[0066] Each text candidate box within the rotation recognition result is updated by performing inverse matrix operations;

[0067] The original recognition result and the updated rotation recognition result are combined to obtain the candidate character recognition result;

[0068] The candidate character recognition results are filtered to obtain the final character recognition result.

[0069] In one possible implementation, the identification module is further configured to:

[0070] From at least one text sequence in the candidate text recognition results, select target text sequences with a confidence level greater than or equal to a confidence threshold;

[0071] The final text recognition result is determined based on the target text sequence and the corresponding text candidate boxes.

[0072] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0073] The memory stores computer-executed instructions;

[0074] The processor executes computer execution instructions stored in the memory to implement the file image recognition method as described in the first aspect.

[0075] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a computer, are used to implement the file image recognition method as described in the first aspect.

[0076] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps of the scheme recommendation method as described in any of the first aspects.

[0077] This application provides a method, apparatus, device, and storage medium for recognizing document images. A first-level preprocessing operation is performed on an initial document image to obtain an intermediate document image with adjusted brightness and sharpness. Then, a second-level preprocessing operation is performed on the intermediate document image to obtain a target document image with adjusted text pixels. The target document image is then recognized to obtain the text recognition result, which is then output. Through this method, based on the first-level preprocessing of "brightness-sharpness optimization" and the two-level preprocessing of "text pixel fine-tuning," line interference, uneven lighting, and blurring of small font sizes are gradually eliminated, allowing OCR to handle clean, high-contrast document images, thereby improving the accuracy of document image recognition. Attached Figure Description

[0078] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0079] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0080] Figure 1 A scenario diagram provided for an embodiment of this application;

[0081] Figure 2 A flowchart illustrating a document image recognition method provided in this application embodiment. Figure 1 ;

[0082] Figure 3 A flowchart illustrating a document image recognition method provided in this application embodiment. Figure 2 ;

[0083] Figure 4 A schematic diagram of the structure of a document image recognition device provided in an embodiment of this application;

[0084] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0085] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0086] General OCR can recognize text with high accuracy in normal scenarios, but when faced with text in device file images that has arbitrary orientation, different font size and is intertwined with lines and symbols, the accuracy of traditional methods drops significantly due to the lack of targeted enhancement and interference removal methods.

[0087] This application provides a document image recognition method. First, a primary preprocessing operation is performed on an initial document image to obtain an intermediate document image with adjusted brightness and sharpness. Then, a secondary preprocessing operation is performed on the intermediate document image to obtain a target document image with adjusted text pixels. The target document image is then recognized to obtain the text recognition result, which is then output. Through this method, based on the primary preprocessing of "brightness-sharpness optimization" and the two-stage preprocessing of "text pixel fine-tuning," line interference, uneven lighting, and blurring of small font sizes are gradually eliminated, allowing OCR to handle clean, high-contrast document images, thereby improving the accuracy of document image recognition.

[0088] Figure 1 This is a schematic diagram of a scenario provided for an embodiment of this application. For example... Figure 1 As shown, the initial document image to be recognized is obtained based on the text recognition application; this initial document image is a front view of a washing machine. First-level and second-level preprocessing operations are performed on the initial document image to obtain the target document image to be recognized. Comparing the target document image and the initial document image, the dimension label "a" for the drum diameter in the initial document image is enlarged after the two-level preprocessing operations, and the dimension label for the washing machine height is completed after the two-level preprocessing operations. Then, OCR recognition is performed on the target document image to obtain the text recognition result containing the drum diameter and the washing machine height.

[0089] Figure 2 A flowchart illustrating a document image recognition method provided in this application embodiment. Figure 1 .like Figure 2 As shown, the method includes:

[0090] S201. In response to the text recognition application, perform a first-level preprocessing operation on the initial file image contained in the text recognition application to obtain an intermediate file image.

[0091] The first-level preprocessing operation is used to adjust the brightness of the initial file image or the integrity of the text pixels.

[0092] In this step, Optical Character Recognition (OCR) technology, by converting text information in an image into editable text, has been widely used in document digitization, automated information extraction, and other fields. In recent years, with the maturity of deep learning algorithms, the accuracy of OCR in general scenarios has significantly improved, and the successful deployment of open-source tools such as PaddleOCR and Tesseract has further lowered the technical threshold. However, document images in the engineering field, such as design drawings for home appliances like dishwashers, televisions, and dryers, have unique layout characteristics: text annotations vary in size and direction, and are tightly interwoven with numerous lines, symbols, cross-sectional lines, and other non-text elements. However, traditional OCR technology typically relies solely on single image enhancement or global threshold segmentation, which cannot effectively eliminate problems such as line interference, uneven lighting, and blurring of small font sizes in the image, thus reducing the accuracy of document image recognition. Therefore, this embodiment performs two levels of targeted preprocessing on the document image before recognizing it using OCR technology.

[0093] Based on experience with image scanning, scanned document images often suffer from three types of problems due to uneven lighting and equipment aging: loss of detail in dark areas (lines in shadow areas blend into the background); overexposure in bright areas (dimmed dimension labels in bright areas); and blurring and degradation (ink smudging causing unclear text boundaries). Therefore, to avoid these three problems affecting document image recognition, it is necessary to adjust the brightness distribution of the image, enhance key lines, and improve the contrast between text and background. Grayscale enhancement can adaptively adjust the image's brightness distribution, making the contrast between lines and background more pronounced, ensuring that OCR or line detection algorithms can accurately extract information. Therefore, grayscale enhancement is included in the first-level preprocessing operation.

[0094] Furthermore, during document image recognition, even after grayscale enhancement, lines on the document image, such as contour lines and center lines in mechanical drawings, may still interfere with key information like text and symbols, affecting the accuracy of subsequent OCR recognition. Line suppression aims to weaken or eliminate the interference of redundant lines while preserving necessary information such as text and annotations. Therefore, before recognizing the document image, a primary preprocessing operation is needed to weaken or eliminate the interference of redundant lines while preserving necessary information such as text and annotations. Considering that morphological closing operations can fill gaps within characters, ensuring continuous character strokes and avoiding recognition errors caused by broken lines, while morphological opening operations can effectively filter out excessively thin lines, such as dimension auxiliary lines or noise, while protecting the integrity of the text structure, the primary preprocessing operation in this embodiment also includes morphological closing and morphological opening operations.

[0095] Therefore, upon receiving a text recognition application, an initial file image requiring preprocessing is determined from the application, and a first-level preprocessing operation is performed on this initial file image: determining the average grayscale value of the initial file image, and determining the brightness type of the initial file image based on the average grayscale value, wherein the brightness type includes bright, dark, and normal; performing a grayscale enhancement operation on the initial file image based on the brightness type to obtain a candidate file image; and performing morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image.

[0096] Average grayscale value: The average grayscale value of all pixels in the document image, where 0 represents pure black and 255 represents pure white, used to quantify the overall brightness of the document image. For example, a gear image scanned at night may have an average grayscale value of only 62 due to insufficient lighting. Brightness types include bright, dark, and normal. Preset grayscale values ​​for area brightness types can be selected according to actual conditions. For example, when the average grayscale value is less than 85, the corresponding brightness type is dark; when the average grayscale value is greater than 170, the corresponding brightness type is bright; and when the average grayscale value is between the two, the corresponding brightness type is normal. In the dark brightness type, there may be a loss of detail, such as difficulty in identifying threaded profiles in shadows; in the bright brightness type, there may be overexposure, such as whitening of dimensional numbers under strong light; and in the normal brightness type, there may be blurred line boundaries, such as ink smudging causing text to adhere to the background.

[0097] Furthermore, to avoid blindly brightening areas with a grayscale type, leading to increased noise, or over-enhancing areas with a bright scale, causing overexposure, the initial image needs to be graded for brightness. Dynamic CLAHE (Contrast Limit Adaptive Histogram Equalization) is then used to apply high-intensity local brightening to areas with a grayscale type, for example, `clip_limit=3.0`. This ensures that only areas with a grayscale type are enhanced, without affecting areas with a bright scale, maintaining a natural transition. Specifically, CLAHE is used to divide the initial image into 8×8 or 16×16 blocks, flatten the grayscale distribution of each block individually, and then use `clip_limit` to limit the magnification to prevent local overexposure. In areas with a normal brightness type, the probability of fogging is higher. Fog indicates an overall grayish appearance and reduced contrast in the image. Adjusting local contrast reduces brightness diffusion, making the text and background more clearly separated. Simultaneously, adaptive sharpening focuses on areas of abrupt brightness changes at the edges of text, such as the 20-80% brightness range, using the Laplacian operator to enhance edge gradients and improve OCR readability. Subsequently, normalization processing ensures the validity of the grayscale values ​​in the initial file image, preventing overflow in subsequent size extraction algorithms.

[0098] First, the average grayscale value of the initial file image is determined. Based on this value, the image is categorized into brightness types (bright, dark, or normal). The grayscale enhancement parameters are then dynamically adjusted based on the classification results. For dark images, a higher contrast enhancement intensity is used to improve shadow details; for bright images, the enhancement amplitude is appropriately reduced to avoid overexposure of highlights; and for normal images, an equalization strategy is used to ensure a natural overall transition. During the enhancement process, the dynamic range of the image is optimized by coordinating the adjustment of contrast and brightness. Simultaneously, sharpening is adaptively applied based on the sharpness detection results, ultimately generating candidate file images with rich details and distinct layers.

[0099] For example, based on the initial file image a of refrigerator a, the average grayscale value is calculated to be 62, which is lower than the preset grayscale value of 85 used to distinguish between normal and dark types. Therefore, the brightness type of the initial file image a is determined to be dark. Using the 8×8 block CLAHE algorithm, clip_limit=2.8 is set to enhance the lines in the dark type areas, such as the small text in dimension labels. At this time, the background grayscale of the initial file image a increases from 30 to 45, but the highlighted title bar does not appear white. The presence of haze in the initial file image a is detected. When detecting haze in the circuit trace area, histogram expansion with α=1.05 and brightness compensation with β=+5 are applied, increasing the grayscale difference between trace spacing from 8 to 12. Simultaneously, the Laplacian variance of the temperature control knob edge is detected to be 1.5. USM sharpening with a radius of 1.2 pixels and an intensity of 60% is applied, improving the clarity of the scale lines by 25%. Finally, the pixel standardization values ​​of the initial file image a are used to obtain the candidate file image a of refrigerator a.

[0100] Furthermore, after obtaining the candidate file images, morphological closing and morphological opening operations need to be performed on the candidate file images to obtain intermediate file images. The specific process is as follows:

[0101] Convert the candidate file image into an initial binary image;

[0102] A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image;

[0103] A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image;

[0104] The target binary image and the candidate file image are superimposed to obtain an intermediate file image.

[0105] It's important to note that morphological closing operations involve dilating the image before eroding it. This fills small holes and smooths object contours while maintaining the original object size. Morphological opening operations, on the other hand, involve eroding first and then dilating. This is primarily used to eliminate small noise points and separate adhered objects while preserving key structural features. Kernel size refers to the pixel size of the neighborhood window used in morphological operations. In initial 300-400 dpi images like those used in home appliance design drawings, a thin 0.25mm line occupies approximately 3-4 pixels, while scattered ink dust and scanning noise typically only occupy 1-2 pixels. Using a 3×3 kernel for morphological closing operations effectively fills in 1-2 pixel gaps caused by broken lines or light gray areas, without thickening a 3-pixel wide vertical character line to 5 pixels. Following this, a morphological opening operation is performed on the result of the morphological closing operation using a 2×2 kernel. This allows for the precise removal of isolated white dots of 1 pixel. Strokes that are 3 pixels wide are "thinned" by 1 pixel and then "fatten" back up, with almost no perceptible change in width. Thus, text edge preservation and noise reduction are completed simultaneously.

[0106] In this embodiment, a 3×3 core is used to perform a closing operation on the initial binary image. This size is mainly considered to effectively fill the common 0.2-0.5mm width broken line defects in engineering images. The subsequent use of a 2×2 core to perform an opening operation is to filter out noise of 1-2 pixels generated during image scanning. This size setting can eliminate scattered noise without excessively eroding the effective lines.

[0107] Specifically, global thresholding is performed on the candidate document image to obtain an initial binary image. At this initial binary image, lines may contain cracks or burrs. Then, a morphological closing operation is performed on the initial binary image using a 3×3 square structuring element (i.e., a 3×3 kernel) to obtain an intermediate binary image, filling in 1-2 pixel cracks caused by scanning creases. Next, a morphological opening operation is performed on the intermediate binary image using a 2×2 square structuring element (i.e., a 2×2 kernel) to obtain the target binary image, removing isolated 1-pixel noise. Finally, the target binary image is used as a mask and superimposed pixel-by-pixel on the grayscale-enhanced candidate document image: for positions marked as target pixels in the mask (i.e., positions indicating text or lines), the corresponding grayscale value in the candidate document image is retained; while for positions marked as non-target pixels in the mask (i.e., positions indicating background areas), a preset background value is uniformly assigned, resulting in the intermediate document image. The preset background value can be determined according to the actual application scenario, for example, 0 or 255.

[0108] S202. Determine the text region of the intermediate file image and perform a secondary preprocessing operation on the text region to obtain the target file image to be identified.

[0109] The secondary preprocessing operation is used to adjust the size of the text pixels within the text area.

[0110] In this step, during the scanning of home appliance images, size symbols as small as 1.5mm often occupy only a 4×6 pixel area, making it difficult for the OCR engine to distinguish between "3" and "8" at this resolution. By magnifying the text, the pixels within the text area can be enlarged while maintaining the grayscale transition, significantly enhancing the text edge features and thus improving recognition accuracy.

[0111] Therefore, a text region is determined in the intermediate file image, a first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold; at least one candidate region is determined based on the text pixels, and the region pixels of each candidate region are determined; from the at least one candidate region, target regions with region pixels less than or equal to the region pixel threshold are selected; a pixel magnification operation is performed on the target regions, and the magnified target regions are overlaid onto the text region to obtain the target file image to be identified.

[0112] Specifically, text regions in intermediate image files are located through edge detection or connected component analysis. Then, the mean local grayscale value and standard deviation of all pixels within the text region are calculated. Based on these values, a first segmentation threshold is determined for the text region. This threshold is used to distinguish all pixels within the corresponding text region as either text pixels or background pixels. Only text pixels may require pixel magnification.

[0113] Further, after determining the text pixels within the text region, at least one candidate region is determined along the connected edges of each text pixel, and each candidate region contains at least one group of text pixels. The region pixel count for each candidate region is calculated, and a region pixel threshold is determined. The region pixel threshold can be selected according to the actual application scenario; for example, the region pixel threshold can be 2800-3000. Based on this region pixel threshold, target regions with region pixels less than or equal to the region pixel threshold are selected from the at least one candidate region. Then, a pixel magnification operation is performed on the aforementioned selected target regions; the magnification ratio corresponding to the pixel magnification operation can be determined based on the region pixels and the region pixel threshold. The magnified target region is then overlaid onto the text region to obtain the target file image.

[0114] In one possible implementation, to make the pixel magnification operation more reliable, additional filter pixels can be set to filter sensor noise and isolated points, such as scanning dust. The number of filter pixels can be 20-30. In other words, only the candidate areas corresponding to the region pixels that fall between the filter pixels and the region pixel threshold can be determined as the target area for which pixel magnification operation needs to be performed.

[0115] In another possible implementation, during the primary and secondary preprocessing operations, grayscale enhancement has raised the text pixels in the dark areas to the visible grayscale range, and morphological closing and opening operations are used to eliminate line breaks and isolated noise. Simultaneously, pixel enlargement operations in small regions expand the pixel size of characteristic characters, such as "Φ3.2", to 9×13. However, all of the above operations are performed in the grayscale domain. The enlargement and interpolation process introduces sub-pixel artifacts, and the background area after morphological processing still retains 1-2 levels of grayscale fluctuation. Although this low- to mid-frequency noise does not affect manual interpretation, it causes the local grayscale mean of the text area to fluctuate by ±3-5, thus affecting the accuracy of the first segmentation threshold set based on the local grayscale mean, leading to misjudgment of text edge pixels and background pixels. Therefore, this embodiment employs fast nonlocal mean denoising technology as the final texture smoothing method. While maintaining the integrity of the enlarged text's geometric features, it suppresses residual grayscale fluctuations to within ±1. Subsequently, Gaussian adaptive threshold binarization is used, and a second segmentation threshold is recalculated for each text region based on a Gaussian weighted algorithm. This achieves sub-pixel-level precise separation of text pixels from background pixels in the binarized image, effectively avoiding missed or false detections caused by subtle grayscale disturbances during optical character recognition. The specific steps are as follows:

[0116] The target file image is denoised by calling a preset denoising function to obtain the denoised target file image.

[0117] Based on the gray-level similarity between each pixel and its neighbors in the denoised target file image, a weighted average operation is performed on each pixel, wherein the weight is proportional to the gray-level similarity.

[0118] Using an 11×11 pixel sliding window, calculate the Gaussian weighted average gray level of the pixels within the window, and determine the second segmentation threshold of the target pixel in the middle position within the window based on the difference between the Gaussian weighted average gray level and a preset constant.

[0119] Based on the relationship between the second segmentation threshold and the size of the target pixel, the target pixel is marked as either a background pixel or a target pixel;

[0120] After marking all pixels, the binarized target file image is obtained.

[0121] The target pixel is the text pixel, and the preset noise reduction function is FastNlMeansDenoising.

[0122] S203. Recognize the target file image to obtain the text recognition result, and output the text recognition result.

[0123] In this step, the target file image obtained above is recognized using OCR technology to obtain the corresponding text recognition result. The steps for obtaining the text recognition result based on OCR technology will be explained in detail in subsequent embodiments, and will not be elaborated upon here.

[0124] Furthermore, considering the diverse formats of file images, such as PDF vector graphics and JPEG / PNG raster images, with resolutions ranging from 150dpi to 600dpi, maintaining a separate local recognition script for each format would not only be complex to deploy but also continuously expand as the number of file image sources increases. The Flask framework, being lightweight, having few dependencies, and being cross-platform, can be started with a single click on Windows industrial PCs, Linux servers, or Docker containers; therefore, it was chosen for construction. Simultaneously, the core OCR logic is encapsulated as an HTTP service. On-site, any file image of any format only needs to be converted to a Base64 string, and a single POST request will yield a unified JSON format text recognition result, without needing to concern oneself with underlying models or environmental differences. In this way, regardless of the variety of file image types, only a single service address is needed for "plug-and-play" operation, significantly reducing integration and maintenance costs and truly achieving "one interface, adaptable to all types of file images."

[0125] This application provides a document image recognition method that sequentially performs adaptive grayscale enhancement, line suppression, local magnification, noise reduction, and adaptive threshold binarization on the initial document image. This method can effectively suppress line interference and scanning noise without destroying the original grayscale levels of the document image, highlight and magnify small font size annotations, make the text edges clear and significantly improve the separation from the background. Subsequently, OCR can achieve accurate recognition on the highly clean and feature-rich target document image, improve the accuracy and reliability of document image recognition, and significantly reduce the false negative and false positive rates.

[0126] Figure 3 A flowchart illustrating a document image recognition method provided in this application embodiment. Figure 2 This embodiment provides a detailed explanation of the steps involved in obtaining text recognition results from target file images using OCR. For example... Figure 3 As shown, the method includes:

[0127] S301. The target file image is identified using OCR technology to obtain the original recognition result.

[0128] The original recognition result includes at least one text candidate box and a corresponding text sequence. The text candidate box contains the coordinates of the four vertices of the text region where the corresponding text sequence is located.

[0129] In this step, in practical application scenarios, the digital acquisition of document images often faces complex shooting environment limitations. Due to on-site space constraints or equipment installation location limitations, operators may have to use unconventional angles for shooting, resulting in varying degrees of rotational shifts in the acquired document images. Traditional OCR recognition technology is usually based on recognition models trained on horizontal text, which exhibit significant performance degradation for text recognition in rotated images, especially when the rotation angle exceeds 15°, the recognition accuracy drops significantly. Therefore, this embodiment introduces a "dual-path" recognition strategy: on the one hand, keeping the original target document image unchanged, and on the other hand, rotating it by preset angles, such as 90°, 180°, and 270° clockwise, to obtain a rotated document image. The two paths are fed into the same OCR engine, resulting in two sets of recognition results. Since the recognition results obtained by the rotation path are also rotated, they need to be mapped back to the original target document image for easy viewing by the user, that is, mapped back to the original coordinates. The recognition results need to include the position information of the text, that is, the text candidate box and the text sequence within the text candidate box. The text candidate box is used to indicate the coordinates of the four vertices of the text region where the text sequence is located.

[0130] Therefore, the primary approach is to use OCR to recognize the target file image and obtain the original recognition result. The specific recognition process is as follows: The text regions within the target file image are located using PaddleOCR's DB (Differentiable Binarization) algorithm. Based on the located text regions, corresponding text candidate boxes are determined. Then, the SVTR (SceneTextRecognition) model is used to recognize the aforementioned text regions, obtaining the text sequence within those regions. The original recognition result is determined based on the text candidate boxes and the corresponding text sequence.

[0131] It should be noted that since OCR outputs a confidence score for the recognition result when recognizing document images, this confidence score indicates whether the recognition result is reliable. Furthermore, since this embodiment recognizes text candidate boxes and text sequences, a first confidence score indicating the reliability of the text candidate boxes and a second confidence score indicating the reliability of the text sequences are also obtained. The average confidence score of the first and second confidence scores is used as the confidence score for the corresponding text candidate boxes and text sequences. This confidence score is used for subsequent fusion of recognition results and filtering of recognition results.

[0132] S302. Rotate the target file image by a preset degree to obtain a rotated file image, and use OCR technology to recognize the rotated file image to obtain a rotation recognition result.

[0133] In this step, the target document image is rotated by a preset angle to obtain a rotated document image. The preset angle can be selected according to actual conditions, for example: 270°, 90°, etc. The rotated document image is recognized through OCR technology to obtain a rotated recognition result. The specific recognition process is the same as the above-mentioned step of obtaining the original recognition result, which will not be further described here.

[0134] S303. Update each text candidate frame in the rotated recognition result through inverse matrix operation.

[0135] In this step, after the rotated recognition result is obtained, an inverse matrix operation is performed on each text candidate frame in the rotated recognition result based on a preset degree, and the corresponding text candidate frame is updated according to the inverse matrix operation result.

[0136] S304. Merge the original recognition result and the updated rotated recognition result to obtain a candidate text recognition result.

[0137] In this step, after obtaining the original recognition result and the rotated recognition result subjected to inverse rotation transformation, the string content of the text sequence is first used as the unique key value to perform deduplication and difference detection between the two result sets: if any text sequence in the rotated recognition result is completely missing from the original recognition result, the text sequence together with its text candidate frame mapped back to the original coordinate system is added to the original recognition result, so as to avoid missed detection caused by the shooting angle. Subsequently, for duplicate text sequences detected in both paths, two copies are no longer simply retained. Instead, the respective corresponding confidence values are compared, and only the copy with higher confidence and its text candidate frame are retained, so as to suppress low-confidence entries caused by character fracture or stroke adhesion due to image rotation, and obtain a simplified and highly reliable candidate text recognition result.

[0138] For example, in a dishwasher pump body pipeline diagram that is rotated 12° clockwise due to oblique shooting by a mobile phone, the original recognition result detects "DN15, MAX0.6MPa", while the rotated recognition result additionally finds the severely tilted "Φ3.2", which is merged into "中3.2" and discarded in the original path due to the too narrow character spacing. This string is added to the original recognition result, and the original recognition result becomes "DN15Φ3.2, MAX0.6MPa". At the same time, "MAX0.6MPa" is detected in both paths, where the confidence of the original path is 0.78 and the confidence of the rotation path is 0.91, and the system retains the latter and replaces the corresponding text candidate frame.

[0139] S305. Perform a filtering operation on the candidate text recognition result to obtain a final text recognition result.

[0140] In this step, any text sequence with a confidence level below the confidence threshold in the OCR output of the target file image may correspond to critical parameters such as size, pressure, and voltage. Errors in these parameters can lead to mismatches in subsequent procurement, processing, or on-site installation, resulting in rework, scrapping, or even safety hazards. Therefore, after obtaining the candidate text recognition results, it is essential to immediately filter each text sequence based on its confidence level: only text sequences with a confidence level above the confidence threshold and their corresponding candidate text boxes are retained; the rest are marked as "awaiting manual review" or directly removed. This intercepts potential errors before the results enter the downstream construction management system. The specific steps are as follows:

[0141] From at least one text sequence in the candidate text recognition results, select target text sequences with a confidence level greater than or equal to a confidence threshold;

[0142] The final text recognition result is determined based on the target text sequence and the corresponding text candidate boxes.

[0143] This application provides a method for recognizing document images. First, the target document image is forward-facing to obtain the original recognition result. Then, the target document image is rotated for secondary recognition. The rotated text candidate boxes are corrected using an inverse matrix to obtain the rotated recognition result. The two recognition results are merged and filtered to output the final text recognition result. By employing a dual-path recognition of "original-rotation" and confidence filtering, the method solves the problems of character breakage, missed detection, and low-confidence recognition caused by the tilted shooting angle of document images. The rotation path completes the text that may have been missed in the original path, and the inverse matrix mapping ensures that all results revert to the unrotated coordinates, facilitating subsequent review. Subsequently, confidence-based filtering eliminates unreliable text sequences, retaining only highly reliable text sequences and their text candidate boxes. Therefore, the accuracy of recognizing key parameters such as size and specifications in document images is significantly improved, significantly reducing processing errors and the risk of on-site rework caused by erroneous data.

[0144] Figure 4 This is a schematic diagram of the structure of a document image recognition device provided in an embodiment of this application. Figure 4 As shown, the image recognition device 40 includes: a first processing operation 401, a second processing operation 402, and a recognition operation 403, wherein:

[0145] The first processing module 401 is configured to, in response to a text recognition application, perform a first-level preprocessing operation on the initial file image contained in the text recognition application to obtain an intermediate file image, wherein the first-level preprocessing operation is used to adjust the brightness or the integrity of the text pixels of the initial file image.

[0146] The second processing module 402 is used to determine the text region of the intermediate file image and perform a secondary preprocessing operation on the text region to obtain the target file image to be identified, wherein the secondary preprocessing operation is used to adjust the size of the text pixels within the text region;

[0147] The recognition module 403 is used to recognize the target file image to obtain text recognition results and output the text recognition results.

[0148] In one possible implementation, the first processing module 401 is further configured to:

[0149] The average grayscale value of the initial file image is determined, and the brightness type of the initial file image is determined based on the average grayscale value, wherein the brightness type includes bright, dark and normal.

[0150] Based on the brightness type, perform a grayscale enhancement operation on the initial file image to obtain a candidate file image;

[0151] Perform morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image.

[0152] In one possible implementation, the first processing module 401 is further configured to:

[0153] Convert the candidate file image into an initial binary image;

[0154] A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image;

[0155] A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image;

[0156] The target binary image and the candidate file image are superimposed to obtain an intermediate file image.

[0157] In one possible implementation, the second processing module 402 is further configured to:

[0158] A first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold.

[0159] Based on the text pixels, at least one candidate region is determined, and the region pixels of each candidate region are determined;

[0160] From at least one of the candidate regions, target regions with region pixels less than or equal to a region pixel threshold are selected;

[0161] A pixel magnification operation is performed on the target area, and the magnified target area is then overlaid onto the text area to obtain the target file image to be identified.

[0162] In one possible implementation, the second processing module 402 is further configured to:

[0163] The target file image is denoised by calling a preset denoising function to obtain the denoised target file image.

[0164] Based on the gray-level similarity between each pixel and its neighbors in the denoised target file image, a weighted average operation is performed on each pixel, wherein the weight is proportional to the gray-level similarity.

[0165] Using an 11×11 pixel sliding window, calculate the Gaussian weighted average gray level of the pixels within the window, and determine the second segmentation threshold of the target pixel in the middle position within the window based on the difference between the Gaussian weighted average gray level and a preset constant.

[0166] Based on the relationship between the second segmentation threshold and the size of the target pixel, the target pixel is marked as either a background pixel or a target pixel;

[0167] After marking all pixels, the binarized target file image is obtained.

[0168] In one possible implementation, the identification module 403 is further configured to:

[0169] The target file image is recognized by OCR technology to obtain the original recognition result, wherein the original recognition result includes at least one text candidate box and the corresponding text sequence, and the text candidate box includes the coordinates of the four vertices of the text region where the corresponding text sequence is located;

[0170] The target file image is rotated by a preset degree to obtain a rotated file image, and the rotated file image is recognized by OCR technology to obtain the rotation recognition result;

[0171] Each text candidate box within the rotation recognition result is updated by performing inverse matrix operations;

[0172] The original recognition result and the updated rotation recognition result are combined to obtain the candidate character recognition result;

[0173] The candidate character recognition results are filtered to obtain the final character recognition result.

[0174] In one possible implementation, the identification module 403 is further configured to:

[0175] From at least one text sequence in the candidate text recognition results, select target text sequences with a confidence level greater than or equal to a confidence threshold;

[0176] The final text recognition result is determined based on the target text sequence and the corresponding text candidate boxes.

[0177] This embodiment provides a document image recognition device that can execute the document image recognition method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0178] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 50 includes a processor 501 and a memory 502 communicatively connected to the processor 501. Optionally, the electronic device 50 further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.

[0179] The memory 502 stores computer-executed instructions;

[0180] The processor 501 executes computer execution instructions stored in the memory 502 to implement the file image recognition method as described above.

[0181] At least one processor 501 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.

[0182] Optionally, in specific implementations, the processor 501 and memory 502 are implemented independently. In this case, the processor 501 and memory 502 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.

[0183] Optionally, in a specific implementation, if the processor 501 and the memory 502 are integrated on a single chip, the processor 501 and the memory 502 can communicate through an internal interface.

[0184] This application also provides a computer storage medium storing computer execution instructions, which, when executed by a processor, implements the aforementioned file image recognition method.

[0185] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The computer-readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0186] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Alternatively, the readable storage medium can be an integral part of the processor. The processor and the readable storage medium can reside in an application-specific integrated circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the control device of a garment handling apparatus.

[0187] The division of units described herein is merely a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0188] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0189] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0190] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0191] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0192] The technical solutions of this application have been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it is readily understood by those skilled in the art that the scope of protection of this application is obviously not limited to these specific embodiments. The above embodiments are only used to illustrate the technical solutions of this application and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for recognizing document images, characterized in that, include: In response to a text recognition application, a first-level preprocessing operation is performed on the initial document image contained in the text recognition application to obtain an intermediate document image, wherein the first-level preprocessing operation is used to adjust the brightness or the integrity of the text pixels in the initial document image; The text region of the intermediate file image is determined, and a secondary preprocessing operation is performed on the text region to obtain the target file image to be identified. The secondary preprocessing operation is used to adjust the size of the text pixels within the text region. The target file image is identified to obtain text recognition results, and the text recognition results are output. The average grayscale value of the initial file image is determined, and the brightness type of the initial file image is determined based on the average grayscale value, wherein the brightness type includes bright, dark and normal. Based on the brightness type, perform a grayscale enhancement operation on the initial file image to obtain a candidate file image; Perform morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image; Convert the candidate file image into an initial binary image; A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image; A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image; The target binary image and the candidate file image are superimposed to obtain an intermediate file image; A first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold. Based on the text pixels, at least one candidate region is determined, and the region pixels of each candidate region are determined; From at least one of the candidate regions, target regions with region pixels less than or equal to a region pixel threshold are selected; A pixel magnification operation is performed on the target area, and the magnified target area is then overlaid onto the text area to obtain the target file image to be identified.

2. The document image recognition method according to claim 1, characterized in that, Before obtaining the text recognition result by recognizing the target file image, the method further includes: The target file image is denoised by calling a preset denoising function to obtain the denoised target file image. Based on the gray-level similarity between each pixel and its neighbors in the denoised target file image, a weighted average operation is performed on each pixel, wherein the weight is proportional to the gray-level similarity. Using an 11×11 pixel sliding window, calculate the Gaussian weighted average gray level of the pixels within the window, and determine the second segmentation threshold of the target pixel in the middle position within the window based on the difference between the Gaussian weighted average gray level and a preset constant. Based on the relationship between the second segmentation threshold and the size of the target pixel, the target pixel is marked as either a background pixel or a target pixel; After marking all pixels, the binarized target file image is obtained.

3. The document image recognition method according to claim 1, characterized in that, The process of obtaining text recognition results by recognizing the target file image includes: The target file image is recognized by OCR technology to obtain the original recognition result, wherein the original recognition result includes at least one text candidate box and the corresponding text sequence, and the text candidate box includes the coordinates of the four vertices of the text region where the corresponding text sequence is located; The target file image is rotated by a preset degree to obtain a rotated file image, and the rotated file image is recognized by OCR technology to obtain the rotation recognition result; Each text candidate box within the rotation recognition result is updated by performing inverse matrix operations; The original recognition result and the updated rotation recognition result are combined to obtain the candidate character recognition result; The candidate character recognition results are filtered to obtain the final character recognition result.

4. The document image recognition method according to claim 3, characterized in that, The candidate character recognition results also include the confidence score for each character sequence. The filtering operation performed on the candidate character recognition results to obtain the final character recognition result includes: From at least one text sequence in the candidate text recognition results, select target text sequences with a confidence level greater than or equal to a confidence threshold; The final text recognition result is determined based on the target text sequence and the corresponding text candidate boxes.

5. A document image recognition device, characterized in that, include: The system comprises a first processing module, a second processing module, and a recognition module, wherein: The first processing module is configured to, in response to a text recognition application, perform a first-level preprocessing operation on the initial file image contained in the text recognition application to obtain an intermediate file image, wherein the first-level preprocessing operation is used to adjust the brightness or the integrity of the text pixels of the initial file image; The second processing module is used to determine the text region of the intermediate file image and perform a secondary preprocessing operation on the text region to obtain the target file image to be identified, wherein the secondary preprocessing operation is used to adjust the size of the text pixels within the text region; The recognition module is used to recognize the target file image to obtain text recognition results and output the text recognition results; The average grayscale value of the initial file image is determined, and the brightness type of the initial file image is determined based on the average grayscale value, wherein the brightness type includes bright, dark and normal. Based on the brightness type, perform a grayscale enhancement operation on the initial file image to obtain a candidate file image; Perform morphological closing and morphological opening operations on the candidate file image to obtain an intermediate file image; Convert the candidate file image into an initial binary image; A morphological closing operation is performed on the initial binary image based on a 3×3 kernel to obtain an intermediate binary image; A morphological opening operation is performed on the intermediate binary image based on a 2×2 kernel to obtain the target binary image; The target binary image and the candidate file image are superimposed to obtain an intermediate file image; A first segmentation threshold is dynamically set based on the local grayscale mean of the text region, and text pixels and background pixels are determined within the text region based on the first segmentation threshold. Based on the text pixels, at least one candidate region is determined, and the region pixels of each candidate region are determined; From at least one of the candidate regions, target regions with region pixels less than or equal to a region pixel threshold are selected; A pixel magnification operation is performed on the target area, and the magnified target area is then overlaid onto the text area to obtain the target file image to be identified.

6. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the file image recognition method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Optical character recognition method based on digital image processing

    CN103530625A

  • Apparatus and method for character recognition byselecting character region in camera document imagecaptured by portable camera

    KR1020060065197A