Character recognition method and device

By determining the brightness and chromaticity weights in color images, the problem of indistinguishability between text areas and background areas is solved, and the accuracy of text recognition is improved, especially when the text color is similar to the background color, the recognition effect is significantly improved.

CN120451989APending Publication Date: 2025-08-08HEFEI IFLYTEK TOYCLOUD TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510568168.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the case where the brightness difference between the text area and the background area is small, it is difficult to effectively distinguish the text area and the background area, resulting in low text recognition accuracy.

Method used

By acquiring a color image, based on the brightness difference and chromaticity difference between the text area and the background area, the brightness weight and chromaticity weight are determined, and the image enhancement is performed to improve the contrast between the text area and the background area, and finally text recognition is performed.

Benefits of technology

When the text color is similar to the background color, the accuracy of text recognition is significantly improved, especially in scenarios that are difficult to deal with by traditional methods, the text outline and text can be extracted more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451989A_ABST
    Figure CN120451989A_ABST
Patent Text Reader

Abstract

The invention provides a character recognition method and device, and the method comprises the steps: obtaining a to-be-recognized color image which comprises a character region and a background region; determining a brightness weight and a chromaticity weight based on the brightness difference between the character area and the background area and the chromaticity difference between the character area and the background area; performing image enhancement on the color image based on the brightness weight, the chromaticity weight, the brightness of the color image and the chromaticity of the color image to obtain an enhanced image; and performing character recognition on the enhanced image to obtain a target character. According to the invention, image enhancement is carried out on the color image based on the brightness weight, the chromaticity weight and the brightness and chromaticity of the color image, and the contrast ratio between the character area and the background area in the enhanced image is effectively improved, so that the character contour can be extracted more accurately during character recognition, and finally the accuracy of character recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of optical character recognition, and in particular to a text recognition method and device. Background Art

[0002] Text recognition is a technology that converts text in an image into editable text. It is widely used in document digitization, license plate recognition, automatic translation and other fields, greatly improving the efficiency and automation level of information processing.

[0003] Currently, text recognition often involves capturing grayscale images and using the brightness difference between the text area and the background in the grayscale image to distinguish the two areas. This allows the text outline to be extracted from the text area and produce the recognition result. However, if the brightness difference between the text area and the background is small (for example, a light blue text area and a dark blue background), the distinction between the text and background areas cannot be effectively made, resulting in lower text recognition accuracy. Summary of the Invention

[0004] The present invention provides a text recognition method and device to solve the defects in the prior art.

[0005] The present invention provides a text recognition method, comprising the following steps: Acquire a color image to be recognized, wherein the color image includes a text area and a background area; Determining a luminance weight and a chroma weight based on a luminance difference between the text area and the background area, and a chroma difference between the text area and the background area; the luminance weight is used to represent a contribution of luminance in distinguishing the text area from the background area, and the chroma weight is used to represent a contribution of chroma in distinguishing the text area from the background area; performing image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image; Perform text recognition on the enhanced image to obtain target text.

[0006] According to a text recognition method provided by the present invention, determining the brightness weight and the chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area, includes: determining the brightness weight based on a proportion of the brightness difference in the sum of the brightness difference and the chromaticity difference; The chromaticity weight is determined based on a proportion of the chromaticity difference in the sum of the luminance difference and the chromaticity difference.

[0007] According to a text recognition method provided by the present invention, determining the brightness weight and the chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area, includes: Determining a text scene based on a brightness difference between the text area and the background area, and a chromaticity difference between the text area and the background area, wherein the text scene is used to describe a combination of the text area and the background area in terms of brightness and chromaticity; The preset brightness weight corresponding to the text scene is used as the brightness weight, and the preset chroma weight corresponding to the text scene is used as the chroma weight.

[0008] According to a text recognition method provided by the present invention, the text recognition is performed on the enhanced image to obtain the target text, and then the method further includes: When the recognition accuracy of the target text is less than a threshold, adjusting the preset brightness weight and the preset chromaticity weight; After using the adjusted preset brightness weight as the brightness weight and the adjusted preset chrominance weight as the chrominance weight, the image enhancement step and the text recognition step are returned to be executed until the recognition accuracy of the target text is greater than or equal to the threshold.

[0009] According to a text recognition method provided by the present invention, the method performs image enhancement on the color image based on the brightness weight, the chroma weight, the brightness of the color image, and the chroma of the color image to obtain an enhanced image, including: determining a grayscale value of each pixel in the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image; Based on the grayscale value of each pixel in the color image, the color image is binarized and enhanced to obtain the enhanced image.

[0010] According to a text recognition method provided by the present invention, obtaining a color image to be recognized includes: Acquire multiple color images to be stitched, wherein text areas of at least two images in the multiple color images to be stitched constitute a complete target text; The plurality of color images to be stitched are stitched together to obtain the color image.

[0011] According to a text recognition method provided by the present invention, the step of splicing the plurality of color images to be spliced to obtain the color image includes: Determining a text area in each color image to be spliced based on brightness information of each color image to be spliced; Determining the edges of the text regions in the color images to be spliced based on the chromaticity information of the color images to be spliced; The color images to be spliced are spliced based on the edges of the text areas in the color images to be spliced to obtain the color image.

[0012] The present invention also provides a text recognition device, comprising the following modules: an acquisition unit, configured to acquire a color image to be recognized, wherein the color image includes a text area and a background area; a determination unit, configured to determine a luminance weight and a chroma weight based on a luminance difference between the text area and the background area in the color image, and a chroma difference between the text area and the background area in the color image; the luminance weight being used to represent a contribution of luminance in distinguishing the text area from the background area, and the chroma weight being used to represent a contribution of chroma in distinguishing the text area from the background area; an enhancing unit, configured to perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image; The recognition unit is used to perform text recognition on the enhanced image to obtain target text.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-described text recognition methods is implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements any of the above-mentioned text recognition methods when executed by a processor.

[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned character recognition methods.

[0016] The text recognition method and device provided by the present invention determine the brightness weight and chromaticity weight through the brightness difference and chromaticity difference between the text area and the background area in the color image, and enhance the color image based on the brightness weight, chromaticity weight, brightness and chromaticity of the color image, thereby effectively improving the contrast between the text area and the background area in the enhanced image, so that the text outline can be extracted more accurately during text recognition, and ultimately the accuracy of text recognition is improved. In particular, when the text color is similar to the background color, which is difficult to handle by traditional methods, the method of the embodiment of the present invention can significantly improve the recognition effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 This is one of the flow charts of the text recognition method provided by the present invention.

[0019] Figure 2 This is the second flow chart of the text recognition method provided by the present invention.

[0020] Figure 3 This is the third flow chart of the text recognition method provided by the present invention.

[0021] Figure 4 This is the fourth flow chart of the text recognition method provided by the present invention.

[0022] Figure 5 This is the fifth flow chart of the text recognition method provided by the present invention.

[0023] Figure 6 This is the sixth flow chart of the text recognition method provided by the present invention.

[0024] Figure 7 This is the seventh flow chart of the text recognition method provided by the present invention.

[0025] Figure 8 It is a structural schematic diagram of the text recognition device provided by the present invention.

[0026] Figure 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0027] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0028] Currently, text recognition often involves capturing grayscale images with a black-and-white camera. The brightness in the grayscale image is used to determine the brightness difference between the text area and the background area in the grayscale image. This is then used to distinguish the text from the background area, extracting the text outline from the text area to obtain the recognition result. However, when the brightness difference between the text area and the background area is small (for example, when the brightness difference between a light blue text area and a dark blue background area is small), it is difficult to effectively distinguish the text area from the background, resulting in low text recognition accuracy.

[0029] To this end, the present invention provides a text recognition method. Figure 1 This is one of the flow charts of the text recognition method provided by the present invention, such as Figure 1 As shown, the method includes step 110 , step 120 , step 130 and step 140 .

[0030] Step 110: Acquire a color image to be recognized, where the color image includes a text area and a background area.

[0031] Here, the color image to be recognized refers to the color image on which text recognition is required. The color image can be acquired by real-time photography with a color camera, scanning with a scanner, or reading from a storage device. After acquiring the color image, in order to ensure the quality of the color image, preprocessing operations such as image noise reduction, image cropping, image rotation, and color correction can be performed on the color image to improve the accuracy of subsequent text recognition.

[0032] In addition, the color image includes a text area and a background area. The text area is an image area including target text, and the background area is an image area other than the text area in the color image.

[0033] The text area and background area in a color image can be determined based on the following methods: ① Setting a threshold value, where pixels in the color image with brightness greater than the threshold are considered to be pixels in the text area, and pixels in the color image with brightness less than or equal to the threshold are considered to be pixels in the background area. This threshold value can be determined using an adaptive threshold algorithm (such as the Otsu algorithm) or can be set based on actual needs, and this is not specifically limited in this embodiment of the present invention. ② Using an edge detection operator (such as Sobel, Canny, Prewitt, etc.) to perform edge detection on the color image, the text area is obtained, and the area of the color image excluding the text area is considered to be the background area. ③ Inputting the color image into a pre-trained semantic segmentation model, the semantic segmentation model identifies the text area and background area in the color image. The semantic segmentation model here can be an FCN model, a U-Net model, a Mask R-CNN model, etc. The method for determining the text area and background area is not limited to the above example, and this is not specifically limited in this embodiment of the present invention.

[0034] It should be noted that the above text regions may contain some noise or incorrectly segmented pixels, such as background pixels mistakenly identified as text pixels. In other words, the above text regions are obtained through a preliminary, coarse segmentation of the color image. While they indicate the approximate area of the target text, they cannot precisely indicate its boundaries. This means that the target text outline cannot be accurately extracted based on these text regions, and thus, the corresponding recognition results cannot be accurately obtained.

[0035] Step 120: Determine a brightness weight and a chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area; the brightness weight is used to characterize the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to characterize the contribution of chromaticity in distinguishing the text area from the background area.

[0036] Specifically, a color image contains both brightness and chrominance. Compared to a grayscale image which only contains brightness, a color image can provide more details to improve the contrast between the text area and the background area in the color image.

[0037] For example, in a grayscale image, the brightness of the light blue text area and the dark blue background area are similar, and it is difficult to distinguish the light blue text area and the dark blue background area based on brightness alone. However, in a color image, since the chromaticity of the light blue and the chromaticity of the dark blue are retained, even if the brightness of the light blue and the dark blue are similar, the text area and the background area can be distinguished by the chromaticity difference between the light blue and the dark blue.

[0038] The brightness of a color image refers to the brightness of the image, which can be obtained by converting the color image into a YUV image and using the value of the Y channel in the YUV image as the corresponding brightness. The chromaticity of a color image refers to the color and saturation of the image, which can be obtained by converting the color image into a YUV image and using the average value of the U and V channels in the YUV image as the chromaticity.

[0039] The brightness difference between the text area and the background area refers to the difference in brightness between the text area and the background area. It can be represented by the difference between the brightness mean of the text area and the brightness mean of the background area, or by the variance of the brightness histogram of the color image. This is not specifically limited in the present embodiment. The greater the brightness difference, the greater the contribution of brightness to distinguishing the text area from the background area, and the higher the corresponding brightness weight.

[0040] The chromaticity difference between the text area and the background area refers to the color difference between the text area and the background area. It can be represented by the difference between the chromaticity mean of the text area and the chromaticity mean of the background area, or by the variance of the chromaticity histogram of the color image. This is not specifically limited in the present embodiment. The greater the chromaticity difference, the greater the contribution of chromaticity to distinguishing the text area from the background area.

[0041] If the brightness difference is greater than the chromaticity difference, it indicates that brightness contributes more to distinguishing the text area from the background area, while chromaticity contributes less. In this case, the brightness weight can be set to a higher value and the chromaticity weight can be set to a lower value. Similarly, if the chromaticity difference is greater than the brightness difference, it indicates that chromaticity contributes more to distinguishing the text area from the background area, while brightness contributes less. In this case, the chromaticity weight can be set to a higher value and the brightness weight can be set to a lower value.

[0042] Step 130 : Perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image.

[0043] After determining the luminance and chrominance weights, image enhancement is performed on the color image based on the luminance and chrominance weights, the brightness of the color image, and the chrominance of the color image to increase the contrast between the text area and the background area in the enhanced image. Contrast here refers to the difference in brightness or chrominance between the text area and the background area. The higher the contrast, the easier it is to distinguish the text area from the background area.

[0044] Among them, the following methods can be used to enhance the color image: ① Based on the brightness weight and chromaticity weight, the brightness and chromaticity of the color image are weighted to obtain an enhanced image. ② Histogram equalization is performed on the brightness and chromaticity respectively, and then the equalized brightness and chromaticity are fused according to the brightness weight and chromaticity weight to obtain an enhanced image. ③ The brightness weight, chromaticity weight and color image are input into a pre-trained image enhancement model to obtain an enhanced image. The enhancement method of the color image is not limited to the above example, and the embodiment of the present invention does not specifically limit the enhancement method of the color image.

[0045] After image enhancement is performed on a color image, the contrast between the text area and the background area in the enhanced image is higher than the contrast between the text area and the background area in the color image. That is to say, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0046] Step 140: Perform text recognition on the enhanced image to obtain target text.

[0047] Specifically, after image enhancement, the contrast between the text area and the background area in the enhanced image is improved, making it easier to distinguish the text area and the background area in the enhanced image during text recognition, thereby improving the accuracy of text recognition. When performing text recognition on the enhanced image, optical character recognition (OCR) technology, deep learning models (such as CRNN models, Transformer models, etc.), or other methods may be used, which are not specifically limited in the embodiments of the present invention.

[0048] For example, in a text scene with a light blue text area and a dark blue background area, traditional grayscale images find it difficult to distinguish between the text area and the background area. The contrast between the light blue text area and the dark blue background area in the enhanced image obtained using the method of the embodiment of the present invention is higher, thereby making it easier and more accurate to identify the light blue text and avoid misidentifying the dark blue background as text.

[0049] The text recognition method provided by the embodiment of the present invention determines the brightness weight and chromaticity weight through the brightness difference and chromaticity difference between the text area and the background area in the color image, and enhances the color image based on the brightness weight, chromaticity weight, brightness and chromaticity of the color image, thereby effectively improving the contrast between the text area and the background area in the enhanced image, so that the text outline can be extracted more accurately during text recognition, and ultimately the accuracy of text recognition is improved. In particular, when the text color is similar to the background color, which is difficult to handle by traditional methods, the method of the embodiment of the present invention can significantly improve the recognition effect.

[0050] Based on the above embodiments, Figure 2 This is the second flow chart of the text recognition method provided by the present invention. Figure 2 As shown, the method includes step 210 , step 220 , step 230 and step 240 .

[0051] Step 210: Acquire a color image to be recognized, where the color image includes a text area and a background area.

[0052] Specifically, the color image to be recognized contains text and background areas. The color image can be acquired through a camera, scanner, storage device, etc. After acquisition, the color image can be pre-processed (such as noise reduction, cropping, color correction, etc.) to improve the accuracy of text recognition.

[0053] Step 220: Determine a luminance weight based on the proportion of the luminance difference in the sum of the luminance difference and the chromaticity difference; determine a chromaticity weight based on the proportion of the chromaticity difference in the sum of the luminance difference and the chromaticity difference.

[0054] Specifically, the sum of the brightness difference and the chromaticity difference represents the combined contribution of brightness and chromaticity to distinguishing text from background areas. The proportion of brightness difference in the sum of the brightness difference and chromaticity difference represents the proportion of brightness difference in the total contribution. In other words, the brightness weight is equal to the proportion of brightness difference in the total contribution. The higher the proportion, the higher the brightness weight.

[0055] The proportion of chromaticity difference in the sum of brightness difference and chromaticity difference refers to the proportion of chromaticity difference in the total contribution degree, that is, the chromaticity weight is equal to the proportion of chromaticity difference in the total contribution degree. The higher the proportion, the higher the chromaticity weight.

[0056] As an optional embodiment, the luminance weight and the chrominance weight may be determined based on the following formula: Luminance weight = Luminance difference / (Luminance difference + Chroma difference) Chroma weight = Chroma difference / (Luminance difference + Chroma difference) It should be noted that when determining weights based solely on brightness differences or chromaticity differences, extreme situations may occur. For example, if the brightness difference is very large, the calculated brightness weight may be too large, and the role of chromaticity is ignored; vice versa. To this end, the embodiment of the present invention uses a proportion method to normalize the weights of brightness and chromaticity to between 0 and 1, avoiding excessive weight of a certain feature, thereby better balancing the contribution of brightness and chromaticity. In addition, the embodiment of the present invention uses a proportion method to reflect the relative importance between brightness and chromaticity, rather than simply considering how large the brightness difference is or how large the chromaticity difference is, but considering how much the brightness difference accounts for in the total difference and how much the chromaticity difference accounts for in the total difference. This consideration of relative importance is more in line with actual conditions, thereby further improving the recognition effect.

[0057] Step 230 : Based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image, perform image enhancement on the color image to obtain an enhanced image.

[0058] After determining the brightness weight and the chromaticity weight, the color image is enhanced based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image to improve the contrast between the text area and the background area in the enhanced image. That is, the contrast between the text area and the background area in the obtained enhanced image is higher than the contrast between the text area and the background area in the color image. That is, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0059] Step 240: Perform text recognition on the enhanced image to obtain target text.

[0060] Specifically, image enhancement improves the contrast between text and background in an image, making it easier for text recognition to distinguish between text and background areas, thereby improving recognition accuracy. The specific method for text recognition is not limited and can utilize OCR technology, deep learning models (such as CRNN, Transformer, etc.), or other feasible solutions.

[0061] This demonstrates that the embodiments of the present invention can adaptively determine luminance and chromaticity weights based on the luminance and chromaticity information of a color image, and perform image enhancement accordingly, thereby more effectively improving the contrast between text and background areas. Compared to traditional text recognition methods, the embodiments of the present invention are more adaptable to different text scenarios, particularly when the text and background colors are similar, significantly improving text recognition accuracy.

[0062] Based on any of the above embodiments, Figure 3This is the third flow chart of the text recognition method provided by the present invention, as shown in FIG. Figure 3 As shown, the method includes step 310 , step 320 , step 330 and step 340 .

[0063] Step 310: Acquire a color image to be recognized.

[0064] Specifically, the color image to be recognized contains both text and background areas. Compared to grayscale images, color images contain both luminance and chrominance information, providing greater detail and improving the contrast between text and background. For example, light blue text and a dark blue background, which are difficult to distinguish in a grayscale image, can be distinguished in a color image based on chrominance information. Color images can be acquired through cameras, scanners, storage devices, and other means. After acquisition, they can undergo preprocessing (such as noise reduction, cropping, and color correction) to improve text recognition accuracy.

[0065] Step 320: Determine a text scene based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area. The text scene is used to describe the combination of the text area and the background area in terms of brightness and chromaticity. Use the preset brightness weight corresponding to the text scene as the brightness weight, and use the preset chromaticity weight corresponding to the text scene as the chromaticity weight.

[0066] Specifically, the text scene refers to the specific combination of brightness and chromaticity of the text area and the background area in the color image. For example, the text scene may include light blue text and dark blue background, black text and white background, gray text and gray background, etc.

[0067] Considering that brightness differences and chromatic differences can reflect the differences in brightness and color between the text area and the background area, the text scene of the color image can be determined based on brightness differences and chromatic differences. Optionally, corresponding rules can be set to judge the text scene based on brightness differences and chromatic differences. For example, if the brightness difference is small (the brightness and darkness are similar), and the blue component of the text area is higher than the blue component of the background area (the colors are different), it can be judged as a scene of light blue text and dark blue background. In addition, a large amount of sample data can be trained through machine learning algorithms (such as decision trees, support vector machines, etc.) to obtain a text scene classification model to judge the text scene. For example, brightness differences and chromatic differences are input as features into a trained text scene classification model, and the model outputs the corresponding text scene.

[0068] For different text scenes, the contribution of brightness and chromaticity to distinguishing text areas from background areas may vary. For example, in a text scene with light blue text and a dark blue background, chromaticity is more important than brightness. In a text scene with black text and a white background, brightness is more important than chromaticity.

[0069] Based on this, the embodiment of the present invention uses the preset brightness weight of the text scene as the brightness weight, and the preset chroma weight as the chroma weight. The preset brightness weight refers to a weight that is pre-set for a specific text scene to represent the importance of brightness, and the preset chroma weight refers to a weight that is pre-set for a specific text scene to represent the importance of chroma. For example, for a text scene with light blue text and a dark blue background, the corresponding preset brightness weight is lower and the preset chroma weight is higher; for a text scene with black text and a white background, brightness is more important than chroma, and the corresponding preset brightness weight is higher and the preset chroma weight is lower.

[0070] Step 330: Perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image.

[0071] After determining the brightness weight and the chromaticity weight, the color image is enhanced based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image to improve the contrast between the text area and the background area in the enhanced image. That is, the contrast between the text area and the background area in the obtained enhanced image is higher than the contrast between the text area and the background area in the color image. That is, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0072] Step 340: Perform text recognition on the enhanced image to obtain target text.

[0073] Specifically, by enhancing color images, the contrast between text and background in the enhanced image is improved, making it easier for text recognition to distinguish between text and background areas, thereby improving recognition accuracy. The specific method for text recognition is not limited and can use OCR technology, deep learning models (such as CRNN, Transformer, etc.), or other feasible solutions.

[0074] Based on any of the above embodiments, Figure 4 This is the fourth flow chart of the text recognition method provided by the present invention, such as Figure 4 As shown, the method includes step 410 , step 420 , step 430 and step 440 .

[0075] Step 410: Acquire a color image to be recognized.

[0076] Specifically, the color image to be recognized contains text and background areas. The color image can be acquired through a camera, scanner, storage device, etc., and can be pre-processed (such as noise reduction, cropping, color correction, etc.) to improve text recognition accuracy.

[0077] Step 420: Determine a text scene based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area. The text scene is used to describe the combination of the text area and the background area in terms of brightness and chromaticity. Use the preset brightness weight corresponding to the text scene as the brightness weight, and use the preset chromaticity weight corresponding to the text scene as the chromaticity weight.

[0078] Step 430: Perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image.

[0079] After determining the brightness weight and the chromaticity weight, the color image is enhanced based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image to improve the contrast between the text area and the background area in the enhanced image. That is, the contrast between the text area and the background area in the obtained enhanced image is higher than the contrast between the text area and the background area in the color image. That is, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0080] Step 440: Perform text recognition on the enhanced image to obtain the target text; when the recognition accuracy of the target text is less than a threshold, adjust the preset brightness weight and the preset chromaticity weight; use the adjusted preset brightness weight as the brightness weight, and the adjusted preset chromaticity weight as the chromaticity weight, and then return to execute the image enhancement step and the text recognition step until the recognition accuracy of the target text is greater than or equal to the threshold.

[0081] Specifically, the recognition accuracy of the target text refers to the degree of correctness of the target text recognition. It can be determined by calculating the edit distance between the recognition result and the actual text, or by a confidence score or probability value. This is not specifically limited in the present embodiment. If the recognition accuracy is less than the threshold, it indicates that the current brightness weight and chromaticity weight fail to effectively highlight the text area, resulting in poor text recognition. In this case, it is necessary to adjust the preset brightness weight and the preset chromaticity weight to find a brightness and chromaticity weight combination that is more suitable for the current image, thereby improving the image enhancement effect and improving text recognition accuracy.

[0082] After adjusting the preset luminance weights and the preset chrominance weights, the adjusted preset chrominance weights are used as the chrominance weights, and the image enhancement step (i.e., step 430) and the text recognition step (i.e., step 440) are executed again until the recognition accuracy is greater than or equal to the threshold, indicating that a relatively ideal weight combination has been found and the target text can be recognized with high accuracy. At this point, the recognition result can be output, completing the text recognition task. In other words, if the recognition accuracy obtained after returning to the image enhancement step (i.e., step 430) and the text recognition step (i.e., step 440) is still less than the threshold, the preset luminance weights and the preset chrominance weights are continuously adjusted until the accuracy requirement is met or the maximum number of iterations is reached.

[0083] It can be seen that the embodiment of the present invention iteratively adjusts the weights of brightness and chromaticity and uses recognition accuracy as feedback to automatically optimize the weight settings, thereby achieving the best image enhancement effect and ultimately improving the accuracy and robustness of text recognition.

[0084] Based on any of the above embodiments, Figure 5 This is the fifth flow chart of the text recognition method provided by the present invention, such as Figure 5 As shown, the method includes step 510 , step 520 , step 530 and step 540 .

[0085] Step 510: Acquire a color image to be recognized.

[0086] Specifically, the color image to be recognized contains text and background areas. Compared to grayscale images, color images contain both luminance and chromaticity information, providing greater detail and improving the contrast between text and background. For example, light blue text and a dark blue background, which are difficult to distinguish in a grayscale image, can be distinguished in a color image based on chromaticity information. Color images can be acquired through cameras, scanners, storage devices, and other means.

[0087] Step 520: Determine a brightness weight and a chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area; the brightness weight is used to characterize the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to characterize the contribution of chromaticity in distinguishing the text area from the background area.

[0088] Specifically, color images contain both luminance and chrominance. Compared to grayscale images, which only contain luminance, color images can provide more detail and improve the contrast between text and background areas. The luminance information of a color image refers to the brightness of the image. This information can be obtained by converting the color image into a YUV image and using the value of the Y channel in the YUV image as the corresponding luminance. The chrominance of a color image refers to the color and saturation of the image. This information can be obtained by converting the color image into a YUV image and using the average value of the U and V channels in the YUV image as the chrominance.

[0089] The brightness difference between the text area and the background area refers to the difference in brightness between the text area and the background area. It can be expressed as the difference in brightness mean or the variance of the brightness histogram. The greater the brightness difference, the greater the brightness contribution to distinguishing the text area from the background area, and the corresponding brightness weight is higher.

[0090] The chromaticity difference between the text area and the background area refers to the color difference between the text area and the background area, which can be expressed as the difference in chromaticity means or the variance of the chromaticity histogram. The greater the chromaticity difference, the greater the contribution of chromaticity to distinguishing the text area from the background area.

[0091] If the luminance difference is greater than the chrominance difference, the luminance weight is set to a higher value and the chrominance weight is set to a lower value; otherwise, the chrominance weight is set to a higher value and the luminance weight is set to a lower value.

[0092] Step 530: Determine the grayscale value of each pixel in the color image based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image; and perform binary enhancement on the color image based on the grayscale value of each pixel in the color image to obtain an enhanced image.

[0093] Considering that binary images are easier to use for text recognition and can effectively reduce the amount of information in the image, an embodiment of the present invention performs binary enhancement on a color image to convert the color image into a grayscale image, thereby reducing the complexity of text recognition and improving the efficiency of text recognition.

[0094] Specifically, the embodiment of the present invention first determines the gray value of each pixel in the color image based on the brightness weight, the chromaticity weight, and the brightness and chromaticity of the color image. For example, the gray value Gray of each pixel can be determined based on the following formula: Gray = luminance weight × luminance + chroma weight × chroma The brightness may be the Y channel value, and the chroma may be the average value of the U channel value and the V channel value.

[0095] After determining the grayscale value of each pixel, the color image is binarized and enhanced to suppress the background area and highlight the text area to obtain an enhanced image. When binarizing the color image, a fixed threshold can be set to set pixels with grayscale values greater than the threshold to white (255) and pixels with grayscale values less than the threshold to black (0) to obtain an enhanced image. The threshold here can be set based on experience, or it can be determined using an adaptive threshold method, such as the Otsu algorithm, Mean-C algorithm, Gaussian algorithm, etc.

[0096] Step 540: Perform text recognition on the enhanced image to obtain target text.

[0097] Specifically, image enhancement improves the contrast between text and background in an image, making it easier for text recognition to distinguish between text and background areas, thereby improving recognition accuracy. The specific method for text recognition is not limited and can utilize OCR technology, deep learning models (such as CRNN, Transformer, etc.), or other feasible solutions.

[0098] Based on any of the above embodiments, Figure 6 This is the sixth flow chart of the text recognition method provided by the present invention, such as Figure 6 As shown, the method includes step 610 , step 620 , step 630 and step 640 .

[0099] Step 610: Acquire multiple color images to be stitched, wherein the text areas of at least two images in the multiple color images to be stitched constitute a complete target text; stitch the multiple color images to be stitched to obtain a color image.

[0100] Specifically, in some cases, it may not be possible to obtain the entire target text using a single color image. For example, the target text is too large to be completely contained in a single image. Therefore, it is necessary to obtain multiple color images to be stitched together and stitch them together to obtain a color image so that the target text is completely contained in the color image.

[0101] For example, consider recognizing the text "OPEN" on a billboard. Because the billboard is too large to be fully captured in a single photo, two color images can be obtained for stitching: the first containing the letters "OP" and the second containing the letters "EN."

[0102] The color image to be stitched is a color image containing a portion of the target text, and the multiple color images to be stitched can be captured by a color camera at different angles, such as from left to right, or from top to bottom.

[0103] Among them, the following methods can be used to stitch the color images to be stitched: ① Feature point-based image stitching, that is, by extracting the feature points of the color images to be stitched (such as SIFT features, ORB features, etc.), and then calculating the transformation matrix between the images based on the matching relationship of the feature points, and finally stitching the color images to be stitched. ② Region-based image stitching, that is, first segmenting the color images to be stitched, and then finding the overlapping areas between the images based on the segmented region information, and finally stitching the color images to be stitched. ③ Deep learning-based image stitching, that is, inputting multiple color images to be stitched into a pre-trained neural network model, and the neural network model automatically completes the image stitching. The above is an example of an image stitching method, and the embodiment of the present invention does not specifically limit the image stitching method.

[0104] Step 620: Determine a brightness weight and a chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area; the brightness weight is used to characterize the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to characterize the contribution of chromaticity in distinguishing the text area from the background area.

[0105] Specifically, color images contain both luminance and chrominance. Compared to grayscale images, which only contain luminance, color images provide more detail and improve the contrast between text and background areas. The luminance of a color image refers to the brightness of the image, while the chrominance of a color image refers to the color and saturation of the image.

[0106] The brightness difference between the text area and the background area refers to the difference in brightness between the text area and the background area. It can be expressed as the difference in brightness mean or the variance of the brightness histogram. The greater the brightness difference, the greater the brightness contribution to distinguishing the text area from the background area, and the corresponding brightness weight is higher.

[0107] The chromaticity difference between the text area and the background area refers to the color difference between the text area and the background area, which can be expressed as the difference in chromaticity means or the variance of the chromaticity histogram. The greater the chromaticity difference, the greater the contribution of chromaticity to distinguishing the text area from the background area.

[0108] Step 630: Perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image.

[0109] After determining the brightness weight and the chromaticity weight, the color image is enhanced based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image to improve the contrast between the text area and the background area in the enhanced image. That is, the contrast between the text area and the background area in the obtained enhanced image is higher than the contrast between the text area and the background area in the color image. That is, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0110] Step 640: Perform text recognition on the enhanced image to obtain target text.

[0111] Specifically, image enhancement improves the contrast between text and background in an image, making it easier for text recognition to distinguish between text and background areas, thereby improving recognition accuracy. The specific method for text recognition is not limited and can utilize OCR technology, deep learning models (such as CRNN, Transformer, etc.), or other feasible solutions.

[0112] Based on any of the above embodiments, Figure 7 This is the seventh flow chart of the text recognition method provided by the present invention, such as Figure 7 As shown, the method includes step 710 , step 720 , step 730 and step 740 .

[0113] Step 710: Acquire multiple color images to be stitched together; determine the text area in each color image to be stitched together based on the brightness information of each color image to be stitched together; determine the edge of the text area in each color image to be stitched together based on the chromaticity information of each color image to be stitched together; and stitch the color images to be stitched together based on the edge of the text area in each color image to be stitched together to obtain a color image.

[0114] Considering that brightness often provides a rough outline of an image's structure and contours, using brightness first to determine text areas can quickly locate potential text areas within the image, narrowing the scope for subsequent processing. Chroma, being more sensitive to color differences, can more accurately determine the edges of text areas, especially when the text and background have similar brightness levels. By combining chroma, the blurred or inaccurate edges that may occur when using brightness alone can be compensated.

[0115] To address this, the present invention first identifies the text region within each color image to be stitched based on brightness. This text region may contain noise or a background color similar to the text. Furthermore, the chromaticity is combined to distinguish the color difference between the text and the background. This allows for accurate determination of the text region's edges, preventing the background from being mistaken for text or the text edges from being missed.

[0116] As an optional embodiment, after obtaining the edges of the text region, the edges of the text region are used as features, and feature matching is then performed between the different color images to be stitched. Based on the matched edges, the transformation matrix between the color images to be stitched is calculated, and the pixel values of the color images to be stitched are fused using an image fusion algorithm to obtain a color image.

[0117] It can be seen that the embodiment of the present invention first roughly determines the text area in each color image to be stitched based on the brightness of each color image to be stitched, and then finely determines the edge of the text area in each color image to be stitched based on the chroma of each color image to be stitched. Through this strategy of first roughly positioning and then fine-tuning, the color images to be stitched can be accurately stitched to obtain a color image containing the complete target text.

[0118] Step 720: Determine a brightness weight and a chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area; the brightness weight is used to characterize the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to characterize the contribution of chromaticity in distinguishing the text area from the background area.

[0119] Specifically, color images contain both luminance and chrominance. Compared to grayscale images, which only contain luminance, color images provide more detail and improve the contrast between text and background areas. The luminance of a color image refers to the brightness of the image, while the chrominance of a color image refers to the color and saturation of the image.

[0120] The brightness difference between the text area and the background area refers to the difference in brightness between the text area and the background area. It can be expressed as the difference in brightness mean or the variance of the brightness histogram. The greater the brightness difference, the greater the brightness contribution to distinguishing the text area from the background area, and the corresponding brightness weight is higher.

[0121] The chromaticity difference between the text area and the background area refers to the color difference between the text area and the background area, which can be expressed as the difference in chromaticity means or the variance of the chromaticity histogram. The greater the chromaticity difference, the greater the contribution of chromaticity to distinguishing the text area from the background area.

[0122] Step 730: Perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image.

[0123] After determining the brightness weight and the chromaticity weight, the color image is enhanced based on the brightness weight, the chromaticity weight, the brightness of the color image, and the chromaticity of the color image to improve the contrast between the text area and the background area in the enhanced image. That is, the contrast between the text area and the background area in the obtained enhanced image is higher than the contrast between the text area and the background area in the color image. That is, the text area and the background area in the enhanced image are easier to distinguish, the text area is more prominent, and the background area is weaker, thereby improving the accuracy of subsequent text recognition.

[0124] Step 740: Perform text recognition on the enhanced image to obtain target text.

[0125] Specifically, image enhancement improves the contrast between text and background in an image, making it easier for text recognition to distinguish between text and background areas, thereby improving recognition accuracy. The specific method for text recognition is not limited and can utilize OCR technology, deep learning models (such as CRNN, Transformer, etc.), or other feasible solutions.

[0126] Based on any of the above embodiments, the present invention further provides a text recognition method, the method comprising: Multiple color images to be stitched in YUV format are obtained, wherein the text regions of at least two of the multiple color images to be stitched constitute a complete target text. The text regions of each color image to be stitched are determined based on the Y channel values of each color image to be stitched, and the edges of the text regions of each color image to be stitched are corrected based on the U and V channel values of each color image to be stitched. Next, the color images to be stitched are stitched based on the corrected edges of the text regions to obtain a color image.

[0127] Perform image segmentation on the color image to determine the text area and background area. Calculate the Y channel mean of the text area ( )、U channel mean( ) and V channel mean ( ), and calculate the Y channel mean of the background area ( )、U channel mean( ) and V channel mean ( ).

[0128] Quantify the contrast difference between channels: , , Calculate the weight of each channel: in, represents the weight of the Y channel, represents the weight of the U channel, represents the weight of the V channel. For example, if , , ,but , , , indicating that the U channel contributes the most to distinguishing the text area from the background area.

[0129] In addition, the weight of each channel can also be determined based on the following steps: input the color image into the pre-trained model to determine the text scene, and determine the weight of each channel based on the mapping relationship between the pre-set text scene and the weight of each channel. For example, for the "blue background and blue text" text scene, you can set , , .

[0130] Then, based on the weight of each channel, the channel value of each pixel in the color image is weightedly added to obtain a grayscale value, and the color image is binarized and enhanced based on the grayscale value to obtain an enhanced image. The contrast between the text area and the background area in the enhanced image is higher than the contrast between the text area and the background area in the color image, so that when text recognition is performed on the enhanced image, accurate text recognition results can be obtained.

[0131] The text recognition device provided by the present invention is described below. The text recognition device described below and the text recognition method described above can be referenced to each other.

[0132] Based on any of the above embodiments, Figure 8 Schematic diagram of the structure of the text recognition device provided by the present invention. Figure 8 As shown, the device includes: An acquisition unit 810 is configured to acquire a color image to be recognized, where the color image includes a text area and a background area; a determination unit 820 for determining a luminance weight and a chroma weight based on a luminance difference between the text region and the background region in the color image, and a chroma difference between the text region and the background region in the color image; the luminance weight being used to represent a contribution of luminance in distinguishing the text region from the background region, and the chroma weight being used to represent a contribution of chroma in distinguishing the text region from the background region; an enhancement unit 830 for performing image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image; The recognition unit 840 is used to perform text recognition on the enhanced image to obtain target text.

[0133] Based on any of the above embodiments, determining the brightness weight and the chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area, includes: Determine the brightness weight based on the proportion of the brightness difference in the sum of the brightness difference and the chromaticity difference; The chromaticity weight is determined based on the proportion of the chromaticity difference in the sum of the brightness difference and the chromaticity difference.

[0134] Based on any of the above embodiments, determining the brightness weight and the chromaticity weight based on the brightness difference between the text area and the background area, and the chromaticity difference between the text area and the background area, includes: Determine the text scene based on the brightness difference and chromaticity difference between the text area and the background area. The text scene is used to describe the combination of the text area and the background area in terms of brightness and chromaticity. The preset brightness weight corresponding to the text scene is used as the brightness weight, and the preset chroma weight corresponding to the text scene is used as the chroma weight.

[0135] Based on any of the above embodiments, text recognition is performed on the enhanced image to obtain target text, and then the following steps are further included: When the recognition accuracy of the target text is less than the threshold, adjusting the preset brightness weight and the preset chromaticity weight; After using the adjusted preset brightness weight as the brightness weight and the adjusted preset chrominance weight as the chrominance weight, the image enhancement step and the text recognition step are returned to be executed until the recognition accuracy of the target text is greater than or equal to the threshold.

[0136] Based on any of the above embodiments, performing image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image includes: Determining a grayscale value of each pixel in the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image; Based on the grayscale value of each pixel in the color image, the color image is binarized and enhanced to obtain an enhanced image.

[0137] Based on any of the above embodiments, obtaining a color image to be recognized includes: Acquire multiple color images to be stitched, wherein text areas of at least two of the multiple color images to be stitched constitute a complete target text; Multiple color images to be stitched are stitched together to obtain a color image.

[0138] Based on any of the above embodiments, stitching a plurality of color images to be stitched together to obtain a color image includes: Determining a text area in each color image to be spliced based on brightness information of each color image to be spliced; Determining the edges of the text regions in the color images to be spliced based on the chromaticity information of the color images to be spliced; Based on the edges of the text areas in the color images to be spliced, the color images to be spliced are spliced to obtain a color image.

[0139] Figure 9 Schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930, and a communication bus 940. The processor 910, the communication interface 920, and the memory 930 communicate with each other via the communication bus 940. The processor 910 may call logic instructions in the memory 930 to execute the text recognition method.

[0140] Furthermore, the logic instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion 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, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0141] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the text recognition methods provided by the above methods.

[0142] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented to execute the text recognition method provided by the above methods when the computer program is executed by a processor.

[0143] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0144] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.

[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 various embodiments of the present invention.

Claims

1. A method for character recognition, characterized in that: include: Acquire a color image to be recognized, wherein the color image includes a text area and a background area; Determining a luminance weight and a chroma weight based on a luminance difference between the text area and the background area, and a chroma difference between the text area and the background area; The brightness weight is used to represent the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to represent the contribution of chromaticity in distinguishing the text area from the background area; performing image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image; Perform text recognition on the enhanced image to obtain target text.

2. The character recognition method according to claim 1, wherein: The determining of the brightness weight and the chroma weight based on the brightness difference between the text area and the background area, and the chroma difference between the text area and the background area, comprises: determining the brightness weight based on a proportion of the brightness difference in the sum of the brightness difference and the chromaticity difference; The chromaticity weight is determined based on a proportion of the chromaticity difference in the sum of the luminance difference and the chromaticity difference.

3. The character recognition method according to claim 1, wherein: The determining of the brightness weight and the chroma weight based on the brightness difference between the text area and the background area, and the chroma difference between the text area and the background area, comprises: Determining a text scene based on a brightness difference between the text area and the background area, and a chromaticity difference between the text area and the background area, wherein the text scene is used to describe a combination of the text area and the background area in terms of brightness and chromaticity; The preset brightness weight corresponding to the text scene is used as the brightness weight, and the preset chroma weight corresponding to the text scene is used as the chroma weight.

4. The character recognition method according to claim 3, wherein: The enhanced image is subjected to text recognition to obtain target text, and then the method further includes: When the recognition accuracy of the target text is less than a threshold, adjusting the preset brightness weight and the preset chromaticity weight; After using the adjusted preset brightness weight as the brightness weight and the adjusted preset chrominance weight as the chrominance weight, the image enhancement step and the text recognition step are returned to be executed until the recognition accuracy of the target text is greater than or equal to the threshold.

5. The character recognition method according to claim 1, wherein: The step of performing image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image includes: determining a grayscale value of each pixel in the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image; Based on the grayscale value of each pixel in the color image, the color image is binarized and enhanced to obtain the enhanced image.

6. The character recognition method according to claim 1, wherein: The step of obtaining a color image to be identified includes: Acquire multiple color images to be stitched, wherein text areas of at least two images in the multiple color images to be stitched constitute a complete target text; The plurality of color images to be stitched are stitched together to obtain the color image.

7. The character recognition method according to claim 6, characterized in that: The step of stitching the plurality of color images to be stitched together to obtain the color image includes: Determining a text area in each color image to be spliced based on brightness information of each color image to be spliced; Determining the edges of the text regions in the color images to be spliced based on the chromaticity information of the color images to be spliced; The color images to be spliced are spliced based on the edges of the text areas in the color images to be spliced to obtain the color image.

8. A text recognition device, characterized in that: include: an acquisition unit, configured to acquire a color image to be recognized, wherein the color image includes a text area and a background area; a determining unit, configured to determine a luminance weight and a chroma weight based on a luminance difference between the text area and the background area in the color image, and a chroma difference between the text area and the background area in the color image; The brightness weight is used to represent the contribution of brightness in distinguishing the text area from the background area, and the chromaticity weight is used to represent the contribution of chromaticity in distinguishing the text area from the background area; an enhancing unit, configured to perform image enhancement on the color image based on the luminance weight, the chrominance weight, the luminance of the color image, and the chrominance of the color image to obtain an enhanced image; The recognition unit is used to perform text recognition on the enhanced image to obtain target text.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the text recognition method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the text recognition method according to any one of claims 1 to 7 is implemented.

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the text recognition method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Image enhancing method and apparatus

    CN107424124A

  • Target segmentation method based on HSI enhanced model

    CN108711160A

  • Image shadow elimination method based on content perception information

    CN113269694A