Text recognition method, device, electronic device and storage medium

By image processing on the image, the area proportion, angle and text density of the area to be identified are determined, and only recognized when specific conditions are met, the problem of low effectiveness and efficiency in the prior art is solved, and more efficient Text recognition.

CN112906686BActive Publication Date: 2024-11-15BEIJING XIAOMI MOBILE SOFTWARE CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202110265269.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-11
Publication Date
2024-11-15
Estimated Expiration
2041-03-11

AI Technical Summary

Technical Problem

When existing OCR technology recognizes text in images, it is difficult to distinguish between effective text and noisy text, resulting in low recognition efficiency and effectiveness.

Method used

By performing image processing on the acquired original image, the area proportion, angle and text density of the area to be identified are determined, and text recognition is performed only when a specific threshold condition is met, reducing the recognition of invalid text areas.

Benefits of technology

It improves the effectiveness and efficiency of text recognition, reduces the recognition of invalid text areas, and enhances the accuracy of recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112906686B_ABST
    Figure CN112906686B_ABST
Patent Text Reader

Abstract

The present disclosure is about a processing method, device, electronic device and storage medium for text recognition, the method comprising: performing image processing on an acquired original image to obtain a region to be recognized containing text; determining the area ratio of the region to be recognized and the original image; determining the angle between the region to be recognized and a preset direction; determining the text density of the region to be recognized; in response to the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, performing text recognition on the text in the region to be recognized. In this way, the effectiveness of text recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of computer image processing, and in particular to a text recognition method, device, electronic device and storage medium. Background Art

[0002] In the related art, OCR optical character recognition technology is usually used to recognize text in images. However, when OCR technology is used for text recognition, all text appearing in the image will be recognized. For some images, especially those extracted from some specific videos, there will be a lot of noise text, such as the ingredient list of a product that is not highlighted in an advertising video or the text in the application interface that is not highlighted in the advertisement. If OCR technology is used for text recognition, these noise texts will also be recognized, making the effectiveness of the obtained text information low. Therefore, how to improve the effectiveness of text recognition has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] The present invention provides a text recognition method, device, electronic device and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a text recognition method is provided, which is applied to an electronic device, including:

[0005] Performing image processing on the acquired original image to obtain the area to be recognized containing the text;

[0006] Determining the area ratio of the to-be-identified area to the original image;

[0007] Determine the angle between the area to be identified and a preset direction;

[0008] Determining the text density of the area to be recognized;

[0009] In response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be recognized.

[0010] Optionally, the method further comprises:

[0011] Determine a first average grayscale value of each pixel in the area to be identified, and a second average grayscale value of each pixel in a preset area extending outward from the area to be identified;

[0012] Determine a binarization threshold according to the first average gray value and the second average gray value;

[0013] The step of performing text recognition on the text in the to-be-recognized area includes:

[0014] The region to be identified is binarized according to the binarization threshold, and text recognition is performed on the text in the region to be identified after the binarization.

[0015] Optionally, determining the area ratio of the to-be-identified region to the original image includes:

[0016] Determine the maximum inscribed rectangle of the area to be identified;

[0017] Determining the area of ​​the to-be-identified region according to the area of ​​the largest inscribed rectangle;

[0018] According to the area of ​​the area to be identified, the area and proportion of the area to be identified and the original image are determined.

[0019] Optionally, the method further comprises:

[0020] Determine the height and width of the area to be identified;

[0021] In response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, performing text recognition on the text in the to-be-recognized area includes:

[0022] In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, and the angle being less than an angle threshold, text recognition is performed on the text in the area to be recognized.

[0023] Optionally, determining the text density in the area to be identified includes:

[0024] Determine the number of characters in the area to be recognized;

[0025] The character density of the area to be recognized is determined according to the number of characters.

[0026] Optionally, determining the number of characters in the to-be-recognized area includes:

[0027] Projecting the area to be recognized in a set direction to obtain a projection area, wherein the set direction is the direction of the row where the text in the area to be recognized is located;

[0028] Determining a pixel density distribution of the projection area;

[0029] The number of characters in the area to be recognized is determined according to the pixel density distribution.

[0030] Optionally, the method further comprises:

[0031] According to the axis frame period, a frame image corresponding to the current axis frame period is extracted from the video to be processed as the original image.

[0032] Optionally, the method further comprises:

[0033] The axis frame period is determined according to the total duration of the video to be processed.

[0034] Optionally, the performing text recognition on the text in the area to be recognized includes:

[0035] Performing optical character recognition on the text in the to-be-recognized area to obtain first text information;

[0036] Perform error correction processing on the first text information to obtain second text information.

[0037] According to a second aspect of an embodiment of the present disclosure, there is provided a text recognition device, comprising:

[0038] The module is used to process the original image to obtain the region to be identified containing the text;

[0039] A first determination module, used to determine the area ratio of the to-be-identified area to the original image;

[0040] A second determination module is used to determine the angle between the to-be-identified area and a preset direction;

[0041] A third determination module is used to determine the text density of the area to be identified;

[0042] The recognition module is used to perform text recognition on the text in the to-be-recognized area in response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold.

[0043] Optionally, the device further comprises:

[0044] A fourth determination module is used to determine a first average grayscale value of each pixel in the to-be-identified area and a second average grayscale value of each pixel in a preset area extending outward from the to-be-identified area;

[0045] The identification module is further used for:

[0046] The region to be identified is binarized according to the binarization threshold, and text recognition is performed on the text in the region to be identified after the binarization.

[0047] Optionally, the first determining module is further configured to:

[0048] Determine the maximum inscribed rectangle of the area to be identified;

[0049] Determining the area of ​​the to-be-identified region according to the area of ​​the largest inscribed rectangle;

[0050] The area ratio of the to-be-recognized area to the original image is determined according to the area of ​​the to-be-recognized area.

[0051] Optionally, the device further comprises:

[0052] A sixth determination module, used to determine the height and width of the area to be identified;

[0053] The identification module is further used for:

[0054] In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified.

[0055] Optionally, the third determining module is further used to:

[0056] Determine the number of characters in the area to be recognized;

[0057] The character density of the area to be recognized is determined according to the number of characters.

[0058] Optionally, the third determining module is further used to:

[0059] Projecting the area to be recognized in a set direction to obtain a projection area, wherein the set direction is the direction of the row where the text in the area to be recognized is located;

[0060] Determining a pixel density distribution of the projection area;

[0061] The number of characters in the area to be recognized is determined according to the pixel density distribution.

[0062] Optionally, the device further comprises:

[0063] As a module, it is used to extract the frame image corresponding to the current frame extraction period from the video to be processed according to the frame extraction period as the original image.

[0064] Optionally, the identification module is further used to:

[0065] Performing optical character recognition on the text in the to-be-recognized area to obtain first text information;

[0066] Perform error correction processing on the first text information to obtain second text information.

[0067] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0068] processor;

[0069] a memory for storing instructions executable by the processor;

[0070] Wherein, the processor is configured to: implement any of the above-mentioned text recognition methods when running the executable instructions.

[0071] According to a fourth aspect of an embodiment of the present disclosure, there is provided a non-temporary computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement any of the method steps described above.

[0072] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0073] In the embodiment of the present disclosure, the area to be identified containing text is obtained by performing image processing on the acquired original image; the area ratio of the area to be identified and the original image is determined; the angle between the area to be identified and the preset direction is determined; the text density of the area to be identified is determined; in response to the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified. Compared with the related art in which text recognition is performed on all areas to be identified containing text, since the embodiment of the present disclosure also judges the area ratio, angle and text density of the area to be identified, the text in the area to be identified is recognized only when the area ratio, angle and text density of the area to be identified meet the conditions. In this way, the recognition of invalid text areas can be reduced, and the effectiveness of text recognition can be improved; and since invalid text areas are not recognized, the efficiency of text recognition can also be improved.

[0074] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0076] Figure 1 is a flow chart of a text recognition method according to an exemplary embodiment;

[0077] Figure 2 It is a schematic diagram of a scene for determining the area of ​​a to-be-recognized area in text recognition in the related art;

[0078] Figure 3is a schematic diagram of a scenario for determining the area of ​​a to-be-identified region according to an exemplary embodiment;

[0079] Figure 4 is another flow chart of a text recognition method according to an exemplary embodiment;

[0080] Figure 5 is a schematic diagram of a scenario for determining text density according to an exemplary embodiment;

[0081] Figure 6 is a flow chart of a text recognition method according to a specific embodiment;

[0082] Figure 7 is a block diagram of a text recognition device according to an exemplary embodiment;

[0083] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0084] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0085] OCR (Optical Character Recongnition) refers to the process in which an electronic device examines symbols on paper or images, determines their shapes by detecting patterns of light and dark, and then uses character recognition methods to translate the shapes into computer text. That is, for printed characters, the text in the image is converted into a black and white dot matrix image file using an optical method, and the text in the image is converted into a text format through recognition software for further editing and processing by word processing software.

[0086] Existing OCR technology can recognize all the text in the image. However, in some scenarios, such as some images used for advertising, due to the presence of product details, these details are not actually the content of the advertisement. If these texts are also recognized, it will obviously increase the recognition content, thus affecting the recognition efficiency. For example, in some TV dramas or movies, especially some life-related TV dramas, there may be printed objects or backgrounds with text, but these texts are not the texts that need to be recognized. Similarly, if these texts are also recognized, it will obviously increase the recognition content, thus affecting the recognition efficiency. At the same time, due to the recognition of a large number of invalid texts, the effectiveness of text recognition is not ideal. Of course, in some scenarios, invalid texts appear in the background of the subject. If these texts are also recognized, it will also affect the effectiveness of text recognition.

[0087] Based on this, Figure 1 is a flowchart of a text recognition method according to an exemplary embodiment. Figure 1 As shown, the method comprises the following steps:

[0088] Step 101: performing image processing on the acquired original image to obtain a region to be recognized containing text;

[0089] It should be noted that the method of the embodiment of the present disclosure can be applied to electronic devices. The electronic devices here include: mobile devices or fixed devices. Among them, mobile devices may include: mobile phones, tablet computers, wearable devices, etc.; fixed devices may include: desktop computers, all-in-one machines, smart home devices, etc. In short, any electronic device with a processor that can process input images or stored images and recognize text can be used.

[0090] Here, the original image may include: a color image, for example, an RGB image. Of course, in other embodiments, the original image may also include: a grayscale image.

[0091] Here, the acquired original image may include: an original image acquired from the electronic device itself; or may include: an original image acquired from other electronic devices.

[0092] Furthermore, the original image obtained from the electronic device itself may also include: an original image obtained from images currently stored in the electronic device; or an original image captured from a played video.

[0093] It is understandable that if it is necessary to obtain an area to be identified that contains text, the image should be processed, that is, at least the area where the text is located in the image should be distinguished from the area where the non-text is located. And to distinguish the area where the text is located from the area where the non-text is located in the image, it is necessary to identify each object in the image, so it is necessary to extract features from the image. In some embodiments, when the original image is a color image, due to the large amount of information in the color image, the amount of information that needs to be analyzed in the feature extraction process is large, which will inevitably affect the efficiency of image processing, thereby affecting the efficiency of text recognition. Based on this, in some embodiments, the image processing of the acquired original image may include:

[0094] The acquired original image is grayed to obtain a grayscale image.

[0095] In some other embodiments, the image processing is performed on the acquired original image to obtain the area to be recognized containing text, including:

[0096] Performing image processing on the acquired original image to obtain the contours of each object in the original image;

[0097] According to the outlines of each object in the original image, the area to be recognized containing text is determined.

[0098] It is understandable that the area to be recognized containing text, that is, the area where the text is located, is characterized by having very neat edges and being connected to form a long rectangle. Thus, by first determining the outlines of each object, the area to be recognized containing text can be quickly determined.

[0099] Based on this, the step of performing image processing on the acquired original image to obtain the contours of each object in the original image may include:

[0100] Perform edge detection on the acquired original image to determine the outline of each object.

[0101] Preferably, performing edge detection on the acquired original image includes: performing edge detection on the grayscale image.

[0102] Here, edge detection on the grayscale image may include: using the Sobel operator to perform edge detection on the grayscale image. Of course, in other embodiments, the Canny operator may also be used for edge detection, wherein the Canny operator uses a double threshold to detect edges and performs non-maximum suppression.

[0103] In order to improve the accuracy of the obtained edge, in some embodiments, after determining the contour of each object, the method further includes: performing binarization processing on the contour.

[0104] Here, the binarization process refers to setting the grayscale value of the pixel in the image to 0 or 255. In other words, the obtained contour is further adjusted in grayscale value, so as to reduce the noise points in the edge detection process and improve the accuracy of edge detection.

[0105] In some other embodiments, in order to further accurately distinguish between the text area and the non-text area, the method further includes: dilating and / or corroding the binarized contour.

[0106] Exemplarily, the contour subjected to dilation and / or erosion is subjected to denoising, wherein the denoising includes removing jagged contours.

[0107] For example, since the area to be detected containing text, that is, the area where the text is located, has very neat edges and can be connected to form a long rectangle, in some embodiments, determining the area to be identified containing text according to the contours of each object in the original image may include:

[0108] According to the outline of each object in the original image, if the outline is a long rectangle or close to a long rectangle, the area where the object corresponding to the outline that is a long rectangle or close to a long rectangle is located is determined as the area to be recognized containing text.

[0109] In this way, by performing image processing on the acquired original image, all regions containing text in the original image can be obtained.

[0110] Step 102: Determine the area ratio of the to-be-recognized area to the original image;

[0111] Step 103: Determine the angle between the area to be identified and a preset direction;

[0112] Step 104: Determine the text density of the area to be recognized;

[0113] It should be noted that the order of the above-mentioned step 102, step 103 and step 104 is not limited. In some embodiments, step 102 may be executed first, then step 103, and then step 104; in other embodiments, step 103 may be executed first, then step 104, and then step 102; in other embodiments, step 104 may be executed first, then step 103, and then step 102.

[0114] Here, the preset direction refers to the direction of the text to be recognized. Exemplarily, the preset direction may be the direction of the bottom edge of the image in the electronic device. Usually, since the electronic device is placed vertically on the ground, and the image of the electronic device is usually also vertical to the ground for the user to view, based on this, in some embodiments, the preset direction may include a horizontal direction.

[0115] It is understandable that since the above-identified area to be identified containing text includes all areas where text is located, as mentioned above, in some scenarios, some text does not need to be identified, for example, noise text such as product details in advertising videos.

[0116] It is understandable that the characteristics of the text area of ​​the noise text are usually different from the characteristics of the text area of ​​the valid text. Usually, the area occupied by the noise text is smaller, or the position in the image is tilted, or the density of the noise text is larger. Based on this, step 105: in response to the area ratio being greater than the ratio threshold, the angle being less than the angle threshold, and the text density being less than the density threshold, text recognition is performed on the text in the to-be-recognized area.

[0117] The percentage threshold here can be set through manual experience. It is understandable that for different recognition requirements, the font size of the text to be recognized is different. For example, for the extracted images in film and television videos, the main thing to be recognized is the subtitles in the film and television videos. Based on this, the percentage threshold here can be set according to the common size of the subtitles; and for advertising images, because different advertisements want to promote different content, some advertisements may need to use exaggerated techniques to display the promotional content. Obviously, if this type of image uses an automatic threshold setting method or a fixed threshold setting, it will obviously exclude the text area that is really wanted to be recognized. Therefore, setting it through manual experience can reduce the phenomenon of misrecognition of valid text as invalid text under this special text recognition requirement, and setting it through manual experience can adapt to the current recognition needs, which is beneficial to the effectiveness of text recognition.

[0118] It should be added that, in the above embodiment, the area of ​​the original image may be the area of ​​the screen of the electronic device. It is understandable that the area of ​​the screen of the electronic device is positively correlated with the proportion threshold. Based on this, in some embodiments, the proportion threshold may be set according to the area of ​​the screen of the electronic device.

[0119] In other embodiments, the percentage threshold can be set automatically, for example, it can be directly determined according to the user's historical settings. In some embodiments, the percentage threshold can be automatically determined according to the type of image to be identified. It is understandable that different types of images can set different percentage thresholds. For example, for images of office or learning documents, the percentage threshold can be set with the area occupied by the size of a size 4 font as a reference; and for images of documents such as posters, the percentage threshold can be set with the area occupied by a larger font as a reference. In other embodiments, the percentage threshold can also be automatically determined according to the recognition requirements. For example, if the recognition requirements indicate that the subtitles in the image are to be recognized, the percentage threshold can be determined by detecting the currently set subtitle font size and the position of the subtitles. In this way, since the percentage threshold can be set automatically, it can be set without relying on manual experience, which simplifies manual operation and makes the electronic device more intelligent.

[0120] Here, the angle threshold may be an angle close to being parallel to the preset direction, so that those areas to be identified that are greatly inclined to the preset direction can be excluded.

[0121] The text density here can also be set by manual experience or automatically. Specifically, it can be directly determined by the user's historical settings or automatically determined according to the type of image to be recognized. It is understandable that different types of images can be set with different text densities. For example, the text density of images of office or learning documents is obviously greater than that of images of poster documents.

[0122] In the disclosed embodiment, not only the area ratio of the area to be identified and the original image is taken as a factor to determine whether it is an area where valid text is located, but also the angle between the area to be identified and the preset direction and the text density are taken as factors to improve the accuracy of determining whether it is an area where valid text is located, thereby providing a basis for improving the effectiveness of text recognition. In the disclosed embodiment, text recognition is performed on the area to be identified whose area ratio is greater than the ratio threshold, whose angle is less than the angle threshold, and whose text density is less than the density threshold, while the area to be identified whose area ratio is less than or equal to the ratio threshold, or whose angle is greater than or equal to the angle threshold, or whose text density is greater than or equal to the density threshold is determined as the area where noise text is located, and thus text recognition is not performed on these areas to be identified. In this way, the recognition of the area where noise text is located can be reduced, that is, the recognition of the invalid text area can be reduced, and the effectiveness of text recognition can be improved. Moreover, since the invalid text area is not recognized, the efficiency of text recognition can also be improved.

[0123] In the related art, in order to quickly obtain the area of ​​the region to be identified, the minimum bounding rectangle of the region to be identified is usually found, and the area of ​​the minimum bounding rectangle is used as the area of ​​the region to be identified. Figure 2 ,like Figure 2 As shown, in some cases, due to the appearance of some noise points when depicting the outline of the object, these noise points protrude from the area where the text is located, forming a protruding area 201, and the protruding area 201 and the area 202 where the text is located are identified as the area to be identified 20. In this case, if the area of ​​the minimum circumscribed rectangle 30 is used as the area of ​​the area to be identified 20, there will obviously be a large error. In some optional embodiments, the step 102, i.e., determining the area ratio of the area to be identified and the original image, includes:

[0124] Determine the maximum inscribed rectangle of the area to be identified;

[0125] Determining the area of ​​the to-be-identified region according to the area of ​​the largest inscribed rectangle;

[0126] The area ratio of the to-be-recognized area to the original image is determined according to the area of ​​the to-be-recognized area.

[0127] Specifically, see Figure 3 ,like Figure 3 As shown, the area to be identified 20 may include: an area 202 where the text is located and a protruding area 201, and the maximum inscribed rectangle 40 of the area to be identified 20 is found. Obviously, the area of ​​the maximum inscribed rectangle 40 here is close to the area of ​​the area 202 where the text is located in the area to be identified 20. Therefore, in this embodiment, by determining the maximum inscribed rectangle of the area to be identified, and determining the area of ​​the area to be identified based on the area of ​​the maximum inscribed rectangle, the area of ​​the area to be identified can be obtained more accurately, thereby more accurately obtaining the area ratio of the area of ​​the area to be identified to the area of ​​the original image, thereby providing a basis for accurately determining whether the area to be identified is an area where valid text is located.

[0128] In some embodiments, in order to more accurately determine the area of ​​the to-be-recognized area, determining the area of ​​the to-be-recognized area according to the area of ​​the largest inscribed rectangle may include:

[0129] The area of ​​the to-be-identified region is determined according to the area of ​​the maximum inscribed rectangle and the area error.

[0130] The area error here can be obtained through big data statistics, or based on other recognition methods. In short, the area error is used to compensate the area of ​​the largest inscribed rectangle to be closer to the area of ​​the area to be recognized, so that the area of ​​the area to be recognized can be determined more accurately.

[0131] In some embodiments, the step of performing text recognition on the text in the to-be-recognized area includes:

[0132] Binarize the area to be identified.

[0133] It should be added that before performing OCR text recognition on the area to be recognized, the area to be recognized may be binarized first.

[0134] Here, binarization processing refers to setting the grayscale value of the pixel points in the image to 0 or 255. In practical applications, binarization processing refers to setting the grayscale value of the pixel points whose grayscale value is greater than or equal to the binarization threshold to 255, and setting the grayscale value of the pixel points whose grayscale value is less than the binarization threshold to 0, so that the specific object can be distinguished from the background. Here, the purpose of binarization processing is to highlight the pixel points where the text is located so that OCR can perform text recognition. Preferably, binarization processing of the area to be recognized may include: binarization processing of the grayscale image of the area to be recognized.

[0135] Thus, in the embodiment of the present disclosure, by first performing a binarization process on the area to be recognized, the area to be recognized and the area outside the area to be recognized can be better distinguished, thereby facilitating subsequent text recognition.

[0136] The binarization threshold here is fixed and can be set based on experience or a commonly used binarization threshold obtained from the cloud.

[0137] In some optional embodiments, the binarization threshold can be adaptively determined by the grayscale value of the area to be recognized. In this way, the adaptively determined binarization threshold can better distinguish the text part from the background part, thereby improving the text recognition efficiency and the accuracy of text recognition.

[0138] For example, see Figure 4 , Figure 4 is another flow chart of a method for character recognition according to an exemplary embodiment, wherein the method may further include:

[0139] Step 401: determining a first average grayscale value of each pixel in the area to be identified, and a second average grayscale value of each pixel in a preset area extending outward from the area to be identified;

[0140] Step 402: determining a binarization threshold according to the first average gray value and the second average gray value;

[0141] The step 105, i.e., performing text recognition on the text in the to-be-recognized area, includes:

[0142] Step 1051: binarize the area to be identified according to the binarization threshold, and perform text recognition on the text in the area to be identified after the binarization processing.

[0143] In the embodiment of the present disclosure, the first average grayscale value of each pixel point in the area to be identified and the second average grayscale value of each pixel in a preset area extending outward from the area to be identified are used as consideration parameters for determining the binarization threshold. This allows the binarization threshold to be used as the binarization threshold for the current binarization processing of the area to be identified, which can be more suitable for the current area to be identified, thereby making the binarization processing more accurate.

[0144] The preset area here may be a closed area extending outward by a predetermined distance, or may be a semi-closed area extending outward along a predetermined direction.

[0145] In some embodiments, the performing text recognition on the binarized text in the to-be-recognized area may further include:

[0146] Perform dilation and denoising on the binarized area to be identified;

[0147] Perform text recognition on the text in the area to be recognized after binarization and dilation denoising.

[0148] Thus, in this embodiment, the binarized area to be identified will be subjected to another dilation denoising process, which can reduce the phenomenon of text omission caused by the coverage of text by rough edges generated by the binarization process, ensure the integrity of the text in the area to be identified, and thus ensure the accuracy of text recognition.

[0149] In some optional embodiments, the method further includes:

[0150] Determine the height and width of the area to be identified;

[0151] The step 105, i.e., in response to the area proportion being greater than the proportion threshold, the angle being less than the angle threshold, and the text density being less than the density threshold, performing text recognition on the text in the to-be-recognized area, may further include:

[0152] In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified.

[0153] The height threshold and / or width threshold here can be set based on experience or determined based on the type of image.

[0154] In this embodiment, by taking the height and width of the area to be recognized as factors, the accuracy of determining that the area to be recognized is the area where valid text is located can be further improved.

[0155] In some optional embodiments, the step 104, i.e., determining the text density in the area to be recognized, may include:

[0156] Determine the number of characters in the area to be recognized;

[0157] The character density of the area to be recognized is determined according to the number of characters.

[0158] Here, the determination of the number of characters in the area to be identified may be performed by traversing the pixel points of the area to be identified to determine the number of characters in the area to be identified. Exemplarily, the determination of the number of characters in the area to be identified by traversing the pixel points of the area to be identified may include: traversing the pixel points of the area to be identified, when a blank pixel point appears, determining it as a word interval; and determining the number of characters in the area to be identified according to the number of word intervals. It can be understood that the number of characters is positively correlated with the character density.

[0159] It should be added that, in some scenarios, still taking the image of an advertising video as an example, in the image of the advertising video, since the product details and the product are in the same horizontal direction when the product is displayed, although the area where the text of the product details is located is an invalid text area, it may still be judged as a valid text area because the area ratio and angle meet the conditions, and the system is required to perform text recognition in the area to be recognized, which will obviously increase the recognition amount and is not conducive to the effectiveness and efficiency of text recognition.

[0160] Based on this, by taking text density as a factor in determining whether the area to be identified is an area where valid text is located, the phenomenon of invalid text areas being judged as valid text areas because their area ratio is greater than the ratio threshold and their angle is less than the angle threshold but their text density is too high can be reduced, thereby accurately determining whether the area to be identified is an area where valid text is located.

[0161] The disclosed embodiment determines the text density by determining the number of characters, which is simple and convenient to operate, has a simple algorithm, and is easy to operate.

[0162] It should be added that, for the method of determining the number of characters in the area to be recognized by traversing the pixel points in the area to be recognized, since the space between characters is determined when there is a blank in the pixel points, and due to the particularity of Chinese characters, some Chinese characters may have blanks during the scanning process. For example, for the character "为", or characters with left and right radicals may be determined to have two or three intervals, resulting in inaccurate recognition of the number of characters. Based on this, in some alternative embodiments, determining the number of characters in the area to be recognized may include:

[0163] Project the area to be recognized in the set direction to obtain a projected area;

[0164] Determine the pixel density distribution of the projected area;

[0165] Determine the number of characters in the area to be recognized according to the pixel density distribution.

[0166] The set direction here may be the direction of the line where the characters in the area to be recognized are located. In some embodiments, the set direction may be the horizontal direction. Exemplarily, please refer to Figure 5 , Figure 5 is a schematic diagram of a scenario for determining the character density shown according to an exemplary embodiment. As Figure 5 shown, the set direction is the direction where the X-axis is located. Here, the direction where the X-axis is located is the direction where a line of characters is located.

[0167] Taking two areas to be recognized as the first area to be recognized 51 and the second area to be recognized 52 as an example, the character density of the first area to be recognized 51 is greater than that of the second area to be recognized 52. Here, projecting the area to be recognized in the set direction to obtain a projected area can be understood as pressing the area to be recognized vertically downward along the X-axis. That is, the pixel points with characters will have a shadow part after being projected onto the X-axis, while the pixel points without characters will have no shadow part after being projected onto the X-axis. Specifically, after the first area to be recognized 51 is projected onto the X-axis, 6 shadow parts appear, indicating that there are 6 characters in the first area to be recognized 51, while after the second area to be recognized 52 is projected onto the X-axis, 2 shadow parts appear, indicating that there are 2 characters in the second area to be recognized 52. Here, the pixel density distribution of the projected area is the distribution of the shadow parts. Obviously, the more the pixel density distribution, the more the number of characters.

[0168] In the embodiments of the present disclosure, by projecting the area to be recognized in the set direction to determine the number of characters in the area to be recognized, the number of characters in the area to be recognized can be determined more accurately, reducing the phenomenon that some special characters are traversed as multiple characters.

[0169] Hereinafter, take the original image as an original image intercepted from the played video as an example.

[0170] In some optional embodiments, the method may further include:

[0171] According to the axis frame period, a frame image corresponding to the current axis frame period is extracted from the video to be processed as the original image.

[0172] The video to be processed here can be any video containing noisy text, such as advertising videos or film and television videos. For example, in life-related film and television videos, many scenes contain objects or backgrounds with text, and these texts are all noise texts. Therefore, for this type of video, it is necessary to remove the area with noise text before performing text recognition, which can improve the efficiency and effectiveness of text recognition.

[0173] Exemplarily, the axis frame period is at least smaller than the minimum interval of picture change. For example, if the picture changes every five seconds, then the frame extraction period is at least smaller than five seconds. In this way, it can be ensured that each picture can be acquired, thereby being able to identify valid text in the entire video to be processed.

[0174] In some other optional embodiments, the method may further include:

[0175] The axis frame period is determined according to the total duration of the video to be processed.

[0176] Exemplarily, the total duration of the video to be processed is positively correlated with the axis frame period, that is, the longer the total duration of the video to be processed, the longer the axis frame period can be set, and conversely, the shorter the total duration of the video to be processed, the shorter the axis frame period can be set.

[0177] In the disclosed embodiment, by automatically adjusting the axis frame period according to the total duration of the video to be processed, the phenomenon of low text recognition efficiency in long-duration videos due to the processing and recognition of more frame images can be reduced, thereby improving the text recognition efficiency of the video.

[0178] In some optional embodiments, in step 105, the step of performing text recognition on the text in the to-be-recognized area may further include:

[0179] Performing optical character recognition on the text in the to-be-recognized area to obtain first text information;

[0180] Perform error correction processing on the first text information to obtain second text information.

[0181] Here, the performing error correction processing on the first text information may include: inputting the first text information into a pre-trained language model, and performing error correction processing on the first text information using the language model.

[0182] The language model here can be any pre-trained language model used for error correction processing. In order to improve the accuracy of text recognition, the language model here can be the language model with the highest usage rate or the lowest error rate in the market.

[0183] Thus, compared with obtaining text recognition results by only performing optical character recognition on text in a recognition area, the embodiment of the present disclosure also performs error correction processing on the recognized first text information, thereby improving the accuracy of text recognition.

[0184] Furthermore, the present disclosure provides a specific embodiment to further understand the text recognition method provided by the embodiment of the present disclosure.

[0185] The applicable scenarios of this embodiment include: extracting subtitles for TV series, movies, etc. on video websites; extracting effective text from advertising videos by advertisers for subsequent advertising classification, accurate advertising delivery, etc.

[0186] See also Figure 6 , Figure 6 is a flowchart of a text recognition method according to an exemplary embodiment. Figure 6 As shown, the method may include:

[0187] Step 601: Axis the video to be processed to obtain an original image;

[0188] Here, the video to be processed may be an advertisement video, or a video of a film or TV series, etc. Here, the original image may be an RGB image.

[0189] It should be added that in order to cover all text information of the video to be processed, the frame extraction of the video to be processed may include: framing the video to be processed according to the framing period to obtain the original images of all frames, and performing the following image processing and text recognition on each frame of the original image.

[0190] Step 602: grayscale the original image to obtain a grayscale image;

[0191] Step 603: performing edge detection and binarization processing on the grayscale image to obtain each object with a contour;

[0192] Step 604: dilate and / or erode the object with the contour to obtain a plurality of regions to be identified;

[0193] Step 605: Determine the area and horizontal angle of the area to be identified, and delete the area to be identified whose area ratio is less than the area threshold and whose horizontal angle is greater than the angle threshold;

[0194] Here, the area of ​​the region to be identified may be the area of ​​the largest inscribed rectangle of the region to be identified.

[0195] The area threshold here can be determined according to the type of video. For example, if it is a TV series, movie, etc., for the extraction of subtitles, the area ratio occupied by the currently set subtitle font size can be used as the area threshold.

[0196] Step 606: Determine the width and height of the area to be identified, and delete the area to be identified whose height is less than or equal to the height threshold and / or whose width is less than or equal to the width threshold;

[0197] The height threshold and width threshold here can also be determined according to the type of video. Taking TV series and movie videos as an example, the height threshold and width threshold can be respectively the height and width corresponding to the currently set subtitle font size as the height threshold and width threshold.

[0198] Step 607: Determine the text density of the area to be identified, and delete the area to be identified whose text density is greater than or equal to the density threshold;

[0199] Here, determining the text density of the area to be identified may include: projecting the area to be identified in the horizontal direction to obtain a projection area; determining the pixel density distribution of the projection area; determining the number of characters in the area to be identified based on the pixel density distribution; and determining the text density of the area to be identified based on the number of characters.

[0200] The density threshold here can also be determined according to the type of video. Similarly, taking TV series and movie videos as an example, the density threshold can be the density of the currently set subtitles as the density threshold.

[0201] Step 608: binarizing the remaining areas to be identified according to the adaptively adjusted binarization threshold;

[0202] Here, the adaptively adjusted binarization threshold is determined by counting the first average grayscale value of each pixel in the area to be identified and the second average grayscale value of each pixel in a preset area extending outward from the area to be identified.

[0203] Step 609: performing dilation denoising on the binarized region to be identified;

[0204] Step 610: performing OCR recognition on the area to be recognized after the binarization processing and the dilation and denoising processing to obtain the first text information;

[0205] Step 611: input the first text information into a preset language model for error correction processing to obtain second text information.

[0206] The language model here can be any pre-trained language model used for error correction processing. In order to improve the accuracy of text recognition, the language model here can be the language model with the highest usage rate or the lowest error rate in the market.

[0207] In the above embodiment, firstly, by calculating the area of ​​the maximum inscribed rectangle of the area to be identified as the area of ​​the area to be identified, the calculation result of the area can be made more accurate; secondly, by determining the horizontal angle of the area to be identified, the area where the invalid text is located and the horizontal angle is greater than or equal to the angle threshold and is obviously inclined to the horizontal plane can be removed; then, by counting the text density, the area where the invalid text is located and the density is obviously too large can be removed, and the text density is counted by projecting the area to be identified in the horizontal direction and then determining it according to the pixel density distribution of the projected area, thereby improving the accuracy of the text density calculation; furthermore, when shielding other areas that do not need to be identified, the binarization threshold obtained by adaptive calculation is used for binarization processing, which can better adapt to each area to be identified and improve the accuracy of binarization; finally, the OCR recognition result will be corrected using a pre-trained language model, which can improve the OCR recognition result and further improve the accuracy of text recognition.

[0208] Figure 7 is a block diagram of a text recognition device according to an exemplary embodiment. Figure 7 The device includes an obtaining module 71, a first determining module 72, a second determining module 73, a third determining module 74 and an identifying module 75; wherein,

[0209] The obtaining module 71 is used to perform image processing on the acquired original image to obtain the area to be recognized containing text;

[0210] The first determination module 72 is used to determine the area ratio of the to-be-identified area to the original image;

[0211] The second determination module 73 is used to determine the angle between the to-be-identified area and a preset direction;

[0212] The third determination module 74 is used to determine the text density of the area to be identified;

[0213] The recognition module 75 is used to perform text recognition on the text in the to-be-recognized area in response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold.

[0214] In an optional embodiment, the device further comprises:

[0215] A fourth determination module is used to determine a first average grayscale value of each pixel in the to-be-identified area and a second average grayscale value of each pixel in a preset area extending outward from the to-be-identified area;

[0216] a fifth determining module, configured to determine a binarization threshold according to the first average gray value and the second average gray value;

[0217] The identification module 75 is further used for:

[0218] The region to be identified is binarized according to the binarization threshold, and text recognition is performed on the text in the region to be identified after the binarization.

[0219] In an optional embodiment, the first determining module 72 is further configured to:

[0220] Determine the maximum inscribed rectangle of the area to be identified;

[0221] Determining the area of ​​the to-be-identified region according to the area of ​​the largest inscribed rectangle;

[0222] The area ratio of the to-be-recognized area to the original image is determined according to the area of ​​the to-be-recognized area.

[0223] In an optional embodiment, the device further comprises:

[0224] A sixth determination module, used to determine the height and width of the area to be identified;

[0225] The identification module 75 is further used for:

[0226] In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified.

[0227] In an optional embodiment, the third determining module 74 is further configured to:

[0228] Determine the number of characters in the area to be recognized;

[0229] The character density of the area to be recognized is determined according to the number of characters.

[0230] In an optional embodiment, the third determining module 74 is further configured to:

[0231] Projecting the area to be recognized in a set direction to obtain a projection area, wherein the set direction is the direction of the row where the text in the area to be recognized is located;

[0232] Determining a pixel density distribution of the projection area;

[0233] The number of characters in the area to be recognized is determined according to the pixel density distribution.

[0234] In an optional embodiment, the device further comprises:

[0235] As a module, it is used to extract the frame image corresponding to the current frame extraction period from the video to be processed according to the axis frame period as the original image.

[0236] In an optional embodiment, the device further comprises:

[0237] The seventh determination module is used to determine the axis frame period according to the total duration of the video to be processed.

[0238] In an optional embodiment, the identification module 75 is further used to:

[0239] Performing optical character recognition on the text in the to-be-recognized area to obtain first text information;

[0240] Perform error correction processing on the first text information to obtain second text information.

[0241] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0242] Figure 8 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0243] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0244] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0245] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 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 memory, flash memory, magnetic disk or optical disk.

[0246] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0247] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0248] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0249] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0250] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0251] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other electronic devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0252] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0253] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0254] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the text recognition method described in the above embodiments.

[0255] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0256] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for character recognition, characterized in that: include: Performing image processing on the acquired original image to obtain the area to be recognized containing the text; Determining the area ratio of the to-be-identified area to the original image; Wherein, the determining of the area ratio of the area to be identified and the original image includes: determining the maximum inscribed rectangle of the area to be identified; determining the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle; wherein, determining the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle includes: determining the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle and the area error; determining the area ratio of the area to be identified and the original image according to the area of ​​the area to be identified; Determine the angle between the area to be identified and a preset direction; Determining the text density of the area to be recognized; In response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be recognized.

2. The method according to claim 1, characterized in that The method further comprises: Determine a first average grayscale value of each pixel in the area to be identified, and a second average grayscale value of each pixel in a preset area extending outward from the area to be identified; Determine a binarization threshold according to the first average gray value and the second average gray value; The performing text recognition on the text in the to-be-recognized area includes: The region to be identified is binarized according to the binarization threshold, and text recognition is performed on the text in the region to be identified after the binarization.

3. The method according to claim 1, characterized in that The method further comprises: Determine the height and width of the area to be identified; In response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, performing text recognition on the text in the to-be-recognized area includes: In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified.

4. The method according to claim 1 or 3, characterized in that: The determining of the text density in the to-be-recognized area includes: Determine the number of characters in the area to be recognized; The character density of the area to be recognized is determined according to the number of characters.

5. The method according to claim 4, characterized in that The determining the number of characters in the to-be-recognized area includes: Projecting the area to be recognized in a set direction to obtain a projection area, wherein the set direction is the direction of the row where the text in the area to be recognized is located; Determining a pixel density distribution of the projection area; The number of characters in the area to be recognized is determined according to the pixel density distribution.

6. The method according to claim 1, characterized in that The method further comprises: According to the frame extraction cycle, a frame image corresponding to the current frame extraction cycle is extracted from the video to be processed as the original image.

7. The method according to claim 6, characterized in that The method further comprises: The frame extraction period is determined according to the total duration of the video to be processed.

8. The method according to claim 1, characterized in that The step of performing text recognition on the text in the to-be-recognized area includes: Performing optical character recognition on the text in the to-be-recognized area to obtain first text information; Perform error correction processing on the first text information to obtain second text information.

9. A text recognition device, characterized in that: include: The module is used to process the original image to obtain the region to be identified containing the text; A first determination module is used to determine the area ratio of the area to be identified and the original image; wherein the first determination module is further used to: determine the maximum inscribed rectangle of the area to be identified; determine the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle; wherein determining the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle includes: determining the area of ​​the area to be identified according to the area of ​​the maximum inscribed rectangle and the area error; determining the area ratio of the area to be identified and the original image according to the area of ​​the area to be identified; A second determination module is used to determine the angle between the to-be-identified area and a preset direction; A third determination module is used to determine the text density of the area to be identified; The recognition module is used to perform text recognition on the text in the to-be-recognized area in response to the area proportion being greater than a proportion threshold, the angle being less than an angle threshold, and the text density being less than a density threshold.

10. The device according to claim 9, characterized in that The device also includes: A fourth determination module is used to determine a first average grayscale value of each pixel in the to-be-identified area and a second average grayscale value of each pixel in a preset area extending outward from the to-be-identified area; a fifth determining module, configured to determine a binarization threshold according to the first average gray value and the second average gray value; The identification module is further used for: The region to be identified is binarized according to the binarization threshold, and text recognition is performed on the text in the region to be identified after the binarization.

11. The device according to claim 9, characterized in that The device also includes: A sixth determination module, used to determine the height and width of the area to be identified; The identification module is further used for: In response to the height being greater than a height threshold and / or the width being greater than a width threshold, the area ratio being greater than a ratio threshold, the angle being less than an angle threshold, and the text density being less than a density threshold, text recognition is performed on the text in the area to be identified.

12. The device according to claim 9 or 11, characterized in that The third determining module is further used for: Determine the number of characters in the area to be recognized; The character density of the area to be recognized is determined according to the number of characters.

13. The device according to claim 12, characterized in that The third determining module is further used for: Projecting the area to be recognized in a set direction to obtain a projection area, wherein the set direction is the direction of the row where the text in the area to be recognized is located; Determining a pixel density distribution of the projection area; The number of characters in the area to be recognized is determined according to the pixel density distribution.

14. The device according to claim 13, characterized in that The device also includes: As a module, it is used to extract the frame image corresponding to the current frame extraction period from the video to be processed according to the frame extraction period as the original image.

15. The device according to claim 14, characterized in that The device also includes: The seventh determination module is used to determine the frame extraction period according to the total duration of the video to be processed.

16. The device according to claim 9, characterized in that The identification module is further used for: Performing optical character recognition on the text in the to-be-recognized area to obtain first text information; Perform error correction processing on the first text information to obtain second text information.

17. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; Wherein, the processor is configured to: implement the text recognition method described in any one of claims 1 to 8 when running the executable instructions.

18. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method steps of any one of claims 1 to 8.

Citation Information

Patent Citations

  • Optical character recognition method based on digital image processing

    CN103530625A

  • Multi-classifier integration-based image character recognition method

    CN106127198A

  • Method and device for identifying character psoriasis pictures

    CN106295627A

  • Image correction and text and position identification method and system

    CN109993160A

  • A method for extracting titles from digital images

    EP1146478A2