Image text positioning method, device, medium and computer equipment
By performing scene division and preset rule processing on a large number of pictures, the problem of low picture text positioning efficiency and difficulty in ensuring accuracy in the existing technology is solved, and efficient and accurate text positioning processing is achieved.
Patent Information
- Application Number
- CN201910014273.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-08
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2039-01-08
AI Technical Summary
The prior art is inefficient when dealing with the positioning of text of a large number of pictures, and the accuracy of text positioning in different picture scenarios is difficult to ensure.
By acquiring all pictures within a predetermined time interval, dividing them into subsets of different picture scenes, and processing them according to the preset processing rules of each scene, a subset of pictures is generated that completes text positioning.
It achieves high-efficiency picture text positioning processing and ensures the accuracy of text positioning in different picture scenes.
Smart Images

Figure CN109858475B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image text positioning, and in particular to an image text positioning method, device, medium and computer equipment. Background Art
[0002] There are more and more technologies for recognizing text in images, among which OCR (Optical Character Recognition) technology is a frequently used technology. Before using OCR technology to recognize text in an image, you need to locate the text in the image first. Usually, the terminal user uploads the image to the server and requests the server to recognize the text in the image. After receiving the terminal user's image text recognition request, the server first uses the text positioning rules to locate the text in the image uploaded by the terminal user, and then recognizes the text from the image after the text positioning is completed.
[0003] Currently, the commonly used text positioning methods include neural network positioning and text interconnected area positioning. However, the positioning speed of the neural network positioning method is relatively slow, and the text interconnected area positioning method is applicable to fewer image scenes. As people's demand for identifying text in pictures increases, the number of image text recognition requests received by the server is also increasing. Correspondingly, the number of pictures and image scenes that the server needs to perform text positioning will increase. Therefore, how to improve the efficiency of the server's image text positioning in the face of increasing number of image text recognition requests has become an urgent problem to be solved. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method, device, medium and computer equipment for locating text in an image. Through the technical solution of the present invention, text positioning processing can be efficiently performed for a large number of images, and when locating text for images of different image scenes, text processing rules corresponding to the image scenes are selected to ensure the accuracy of text positioning.
[0005] According to a first aspect, an embodiment of the present invention provides a method for locating text in an image, including:
[0006] Obtain all images uploaded by terminal users received within a predetermined time interval and generate a set of images to be processed;
[0007] Dividing the to-be-processed picture set into a plurality of to-be-processed picture subsets corresponding to different picture scenes;
[0008] The image subsets to be processed are processed respectively according to preset processing rules corresponding to the image scenes to obtain several image subsets for which text positioning is completed.
[0009] Furthermore, the processing of each subset of the images to be processed according to a preset processing rule corresponding to the image scene includes:
[0010] Respectively obtain the images to be located in each subset of images to be processed;
[0011] Determine a plurality of text areas in the image to be located;
[0012] Processing the plurality of text regions using a preset text region processing rule to generate at least one line text connected region;
[0013] Perform edge detection on the at least one connected region of text lines to determine region coordinates corresponding to the text in the image to be located.
[0014] Further, the determining of a plurality of text areas in the image to be located includes:
[0015] Perform background filtering on the image to be located using a preset background filtering rule to generate a filtered image;
[0016] The filtered image is processed according to a preset text positioning rule to determine a number of text areas in the filtered image.
[0017] Furthermore, the preset background filtering rules include a sharpening algorithm, a mean shift algorithm and a bilateral filtering algorithm;
[0018] Using a preset background filtering rule to perform background filtering on the image to be located to generate a filtered image, including:
[0019] The image to be located is processed using a mean shift algorithm and a bilateral filtering algorithm to obtain a transition stage processed image, and the first stage processed image is processed using a sharpening algorithm to generate a filtered image.
[0020] Furthermore, the method of processing the plurality of text regions using a preset text region processing rule to generate at least one line text connected region includes:
[0021] Determine the area coordinates corresponding to the plurality of text areas;
[0022] Dividing the plurality of text regions into at least one line text region according to the region coordinates;
[0023] If the line of text regions contains at least two text regions, all the text regions contained in the line of text regions are merged to generate a line of text connected region;
[0024] If the line text area only includes one text area, the text area included in the line text area is used as the line text connected area.
[0025] Furthermore, the determining of the area coordinates corresponding to the plurality of text areas includes:
[0026] Extracting a plurality of initial text regions from the image to be located using a preset text location rule;
[0027] Processing the initial text area using a preset expansion processing rule to obtain a final text area;
[0028] Extracting the minimum bounding rectangle of the final text area;
[0029] The coordinates of the upper left vertex and the lower right vertex of the minimum circumscribed rectangular frame are determined as the area coordinates corresponding to the final text area.
[0030] Furthermore, the dividing the plurality of text areas into at least one line text area according to the area coordinates includes:
[0031] A rectangular coordinate system is established with the horizontal direction of the image to be located as the x-axis and the vertical direction as the y-axis;
[0032] The plurality of text areas are divided into at least one line of text areas according to the y coordinate of the upper left vertex or the y coordinate of the lower right vertex corresponding to each of the plurality of text areas.
[0033] According to the second aspect, an embodiment of the present invention provides a device for locating text in an image, including:
[0034] The picture set acquisition module is used to acquire all pictures uploaded by terminal users received within a predetermined time interval and generate a picture set to be processed;
[0035] A picture set division module, used for dividing the picture set to be processed into a plurality of picture subsets to be processed corresponding to different picture scenes;
[0036] The image subset processing module is used to process each of the image subsets to be processed according to a preset processing rule corresponding to the image scene, so as to obtain a plurality of image subsets for which text positioning is completed.
[0037] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned image text positioning method is implemented.
[0038] According to a fourth aspect, an embodiment of the present invention provides a computer device, the computer device comprising:
[0039] one or more processors;
[0040] A storage device for storing one or more programs;
[0041] When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned image text positioning method.
[0042] In an embodiment of the present invention, a set of pictures to be processed is generated by acquiring pictures uploaded by all terminal users received within a predetermined time interval; the set of pictures to be processed is divided into several subsets of pictures to be processed corresponding to different picture scenes; each of the subsets of pictures to be processed is processed according to preset processing rules corresponding to the picture scenes, to obtain several subsets of pictures that have completed text positioning, so that text positioning processing can be performed efficiently for a large number of pictures, and when performing text positioning for pictures of different picture scenes, text processing rules corresponding to the picture scenes are selected to ensure the accuracy of text positioning.
[0043] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0045] Figure 1 A schematic diagram of a method for locating text in an image according to an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of the structure of a device for locating text in an image according to an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.
[0049] Those skilled in the art can understand that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms, and the "first" and "second" used herein are only used to distinguish the same technical features, and do not limit the order and quantity of the technical features. It should be further understood that the term "comprising" used in the specification of the present invention means the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0050] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0051] An embodiment of the present invention provides a method for locating text in an image. The following describes the specific implementation of the present invention in detail from the perspective of a cloud server in conjunction with the accompanying drawings.
[0052] like Figure 1 As shown, the image text positioning method provided by the embodiment of the present invention includes the following steps:
[0053] S110: Acquire all pictures uploaded by terminal users received within a predetermined time interval, and generate a set of pictures to be processed.
[0054] In this embodiment, when receiving a picture text recognition request sent by a terminal user, the cloud server first obtains the pictures associated with all the picture text recognition requests received within a predetermined time interval, that is, the picture set to be processed, and then performs text positioning processing on the picture set to be processed, and then performs text recognition operations on the pictures that have completed the text positioning processing, instead of responding to the requests of each terminal user and performing text positioning processing for each picture associated with the picture text recognition request separately.
[0055] Since the picture set to be processed is composed of pictures uploaded by multiple terminal users, the pictures included in the picture set to be processed correspond to multiple picture scenes.
[0056] S120: Divide the to-be-processed picture set into a plurality of to-be-processed picture subsets corresponding to different picture scenes.
[0057] In this embodiment, the pictures included in the to-be-processed picture set correspond to a plurality of picture scenes, and the picture scenes may include ID photo scenes, invoice scenes, and the like.
[0058] Specifically, in the past, when the cloud server received a request for image text recognition from a terminal user, it would perform text positioning and text recognition operations for the image uploaded by the terminal user separately. In actual application scenarios, the image scenes of the images uploaded by different terminal users may be different. For example, the image scene of the image uploaded by user A is an ID photo scene, while the image scene uploaded by user B is an invoice scene. Since the distribution of text in the image is different in different image scenes, if the same text positioning rule is used to position text for images with different image scenes, the final positioning accuracy of the image will be reduced, which will indirectly affect the recognition accuracy of the image text. Therefore, in order to ensure the accuracy of text positioning, when positioning text for images of different image scenes, the text positioning rules corresponding to the image scene are used. It should be noted that in this embodiment, different rules may include the same algorithm used, but different parameters are specially configured based on the image scene of the specific application.
[0059] Specifically, a target detection algorithm, such as R-FCN algorithm (Region-based Fully Convolutional Networks) and SSD algorithm (Single Shot MultiBox Detector), is used to divide the to-be-processed picture set into several to-be-processed picture subsets corresponding to different picture scenes.
[0060] S130: Processing each of the to-be-processed image subsets according to preset processing rules corresponding to the image scene to obtain a plurality of image subsets for which text positioning is completed.
[0061] Specifically, the set of pictures to be processed is divided into several picture subsets according to the picture scenes. When processing the picture subsets, it is only necessary to use the preset processing rules corresponding to the picture scenes to which the picture subsets belong, which greatly reduces the number of times the processing rules for text positioning are switched when positioning text on pictures.
[0062] In this embodiment, all pictures uploaded by terminal users received within a predetermined time interval are obtained to generate a set of pictures to be processed, and the set of pictures to be processed is divided into several subsets of pictures to be processed corresponding to different picture scenes; each subset of pictures to be processed is processed according to preset processing rules corresponding to the picture scenes, and several subsets of pictures with completed text positioning are obtained. This method can efficiently perform text positioning processing for a large number of pictures, and when performing text positioning for pictures of different picture scenes, the text processing rules corresponding to the picture scenes are selected to ensure the accuracy of text positioning.
[0063] In one embodiment, S130: processing each of the to-be-processed image subsets according to a preset processing rule corresponding to the image scene, including:
[0064] S131: Obtain the pictures to be located in each subset of pictures to be processed respectively.
[0065] S132: Determine a plurality of text regions in the image to be located.
[0066] S133: Processing the plurality of text regions using a preset text region processing rule to generate at least one text line connected region.
[0067] S134: Perform edge detection on the at least one connected region of text lines to determine region coordinates corresponding to the text in the image to be located.
[0068] What is to be achieved in this embodiment is to locate each line of text in the image to be located, and when processing each subset of images to be processed, obtain the images in each subset of images to be processed, i.e., the image to be located, and then use an algorithm for detecting text in the image, such as a region detection algorithm such as the MSER (Maximally StableExtrernal Regions) algorithm, to detect the text contour of each text in the image to be located, i.e., the text region. Specifically, the text contour is an irregular polygon, and the text contours of each text do not overlap.
[0069] Since the outlines of the characters do not overlap, only the corresponding area coordinates of each character can be obtained based on the character outline, but the area coordinates of the entire line of characters cannot be obtained. Therefore, after detecting the text area of each character in the image to be located, it is necessary to use the preset text area processing rules to process the detected text area to generate at least one line of text connected areas, and then perform edge detection on each line of text connected areas. According to the results of edge detection, the area coordinates of each line of text can be determined, that is, each line of text can be located.
[0070] In one embodiment, S132: determining a plurality of text areas in the image to be located comprises the following steps:
[0071] S1321: Perform background filtering on the image to be located using a preset background filtering rule to generate a filtered image.
[0072] S1322: Process the filtered image according to a preset text positioning rule to determine a number of text areas in the filtered image.
[0073] In this embodiment, when detecting a text area from a picture to be located, the background of the picture to be located may sometimes interfere with the detection result. For example, the background in the picture to be located may be detected as a text area during detection, or the text may not be detected due to overlap between the background and the text. The above situations may reduce the accuracy of text positioning.
[0074] Therefore, in order to improve the accuracy of text positioning, when detecting the text area from the image to be positioned, the image to be positioned is first subjected to background filtering, and then the processed image is subjected to text detection to determine the text outline, that is, the text area.
[0075] Specifically, the preset background filtering rules include a sharpening algorithm, a mean shift algorithm and a bilateral filtering algorithm.
[0076] Accordingly, S1321: performing background filtering processing on the image to be located using a preset background filtering rule to generate a filtered image, including:
[0077] The image to be located is processed using the mean shift algorithm and the bilateral filtering algorithm to obtain a transition stage processed image, and the first stage processed image is processed using the sharpening algorithm to generate a filtered image.
[0078] In this embodiment, considering that the previous text positioning technology does not process the image, the text detection is performed directly on the image. However, when the text detection is performed directly on the image to be positioned, some text may not be detected, for example, the image background and the text overlap, and the pixels of the text are not obvious, resulting in the final failure to be detected. Therefore, in order to improve the accuracy of text detection, a sharpening algorithm can be used to highlight the pixels of the text before performing text detection on the image.
[0079] However, simply using a sharpening algorithm to process an image will not only highlight the pixels of the text, but also the pixels of the image background, causing the image background to be mistakenly detected as a text area during text detection. Therefore, in order to reduce the interference of the image background on the detection results during text detection, the image background is filtered before using the sharpening algorithm to process the image.
[0080] Specifically, the mean shift algorithm and the bilateral filtering algorithm are used to filter the image background.
[0081] Among them, the role of the bilateral filtering algorithm is to smooth the background of the image, while the role of the mean shift algorithm is to remove the background of the image. When using the bilateral filtering algorithm and the mean shift algorithm to process the image, the order of using the two algorithms can be changed without affecting the filtering effect of the image background.
[0082] In one embodiment, S133: using a preset text region processing rule to process the plurality of text regions to generate at least one line text connected region includes:
[0083] S310: Determine the region coordinates corresponding to the plurality of text regions.
[0084] S320: Divide the plurality of text areas into at least one line text area according to the area coordinates.
[0085] S330: If the line of text regions includes at least two text regions, merging all the text regions included in the line of text regions to generate a line of text connected region;
[0086] If the line text area only includes one text area, the text area included in the line text area is used as the line text connected area.
[0087] In this embodiment, the detected text needs to be divided into at least one line according to the position of the text, and each line of text may contain only one text or multiple texts. If a line of text contains only one text, the region coordinates corresponding to the text area of the text are used as the region coordinates of the line; if a line of text contains at least two texts, the text areas of all the texts in the line are merged into a line text connected area, and the region coordinates corresponding to the line text connected area are used as the region coordinates of the line.
[0088] Specifically, a rectangular coordinate system is first established with the horizontal direction of the image to be located as the x-axis and the vertical direction of the image to be located as the y-axis, and the region coordinates corresponding to the detected text region are determined according to the coordinate system.
[0089] When determining whether text regions are on the same line, the region coordinates of each text region can be determined first. After detecting the minimum bounding rectangle of the text region, the upper left vertex and the lower right vertex, or the lower left vertex and the upper right vertex of the rectangle can be determined as the region coordinates. Then, the text regions are sorted in the y-axis direction according to the y coordinates of the region coordinates of each text region. The differences are taken separately for the y coordinates of the two vertices in the region coordinates of two adjacent text regions. When both differences are less than a preset threshold, it can be determined that the two text regions belong to the same line.
[0090] For example, it is预先设定 that the region coordinates of the text region are the upper left vertex and the lower right vertex of the rectangle, and the currently determined text regions are A and B. The y coordinate of the upper left vertex of A is 10, and the y coordinate of the lower right vertex is 5, denoted as (10, 5), and B is (9, 4). After sorting in the y-axis direction, it can be determined that A and B are adjacent text regions. The difference in the upper left vertices corresponding to them is 1, and the difference in the lower right vertices is 1. If the preset threshold is 2, then it can be determined that A and B belong to the same line.
[0091] In this embodiment, the way to merge all the text regions included in the line text region to generate a line text connected region can be to directly fit together several irregular polygons on the same line.
[0092] In one embodiment, S310: Determine the region coordinates corresponding to the several text regions, including:
[0093] S311: Extract several initial text regions from the to-be-localized picture using a preset text localization rule.
[0094] S312: Process the initial text regions using a preset dilation processing rule to obtain the final text regions.
[0095] S313: Extract the minimum bounding rectangle of the final text regions.
[0096] S314: Determine the upper left vertex coordinates and the lower right vertex coordinates of the minimum bounding rectangle as the region coordinates corresponding to the final text regions.
[0097] Due to the special structure of some Chinese characters, the result of text detection may detect a Chinese character with a special structure as two Chinese characters. For example, "二" may be detected as an "一" above and an "一" below, and "三" may be detected as three "一"s distributed from top to bottom. To further improve the accuracy of text localization, the detected text regions can be processed to avoid the above situation of detecting a single text as multiple texts.
[0098] In this embodiment, an algorithm for detecting text in a picture, such as the MSER algorithm, is used to detect a text area from the picture to be located, i.e., the initial text area in this embodiment, and then the initial text area is drawn into a newly created canvas of the same size as the picture to be located.
[0099] Specifically, in the newly created canvas, a rectangular coordinate system is established with the horizontal direction of the canvas as the x-axis and the vertical direction of the canvas as the y-axis. The coordinates of the initial text area are determined, and an initial text area corresponding to the position of the image to be located is generated in the canvas according to the coordinates.
[0100] Then, the initial text area is filled with color in the canvas, and then an expansion operation is performed so that the initial text areas that are very close to each other are connected together to form a final initial text area; the final initial text area is then detected, the minimum circumscribed rectangular frame of the final text area is extracted, and the upper left vertex coordinates and the lower right vertex coordinates of the minimum circumscribed rectangular frame are determined as the area coordinates corresponding to the final text area.
[0101] In one embodiment, dividing the plurality of text areas into at least one line text area according to the area coordinates includes:
[0102] A rectangular coordinate system is established with the horizontal direction of the image to be located as the x-axis and the vertical direction as the y-axis;
[0103] The plurality of text areas are divided into at least one line of text areas according to the y coordinate of the upper left vertex or the y coordinate of the lower right vertex corresponding to each of the plurality of text areas.
[0104] In order to better understand the technical solution of the present invention, the present invention also provides a picture text positioning device, such as Figure 2 As shown, it includes the following modules:
[0105] The picture set acquisition module 110 is used to acquire all pictures uploaded by terminal users received within a predetermined time interval and generate a picture set to be processed.
[0106] The picture set division module 120 is used to divide the picture set to be processed into a plurality of picture subsets to be processed corresponding to different picture scenes.
[0107] The image subset processing module 130 is used to process the image subsets to be processed respectively according to preset processing rules corresponding to the image scenes, so as to obtain a plurality of image subsets for which text positioning is completed.
[0108] In this embodiment, the pictures included in the to-be-processed picture set correspond to a plurality of picture scenes, and the picture scenes may include ID photo scenes, invoice scenes, and the like.
[0109] Specifically, in the past, when the cloud server received a request for image text recognition from a terminal user, it would perform text positioning and text recognition operations for the image uploaded by the terminal user separately. In actual application scenarios, the image scenes of the images uploaded by different terminal users may be different. For example, the image scene of the image uploaded by user A is an ID photo scene, while the image scene uploaded by user B is an invoice scene. Since the distribution of text in the image is different in different image scenes, if the same text positioning rule is used to position text for images with different image scenes, the final positioning accuracy of the image will be reduced, which will indirectly affect the recognition accuracy of the image text. Therefore, in order to ensure the accuracy of text positioning, when positioning text for images of different image scenes, the text positioning rules corresponding to the image scene are used. It should be noted that in this embodiment, different rules may include the same algorithm used, but different parameters are specially configured based on the image scene of the specific application.
[0110] Specifically, a target detection algorithm, such as R-FCN algorithm (Region-based Fully Convolutional Networks) and SSD algorithm (Single Shot MultiBox Detector), is used to divide the to-be-processed picture set into several to-be-processed picture subsets corresponding to different picture scenes.
[0111] In one embodiment, the picture subset processing module 130 includes:
[0112] The picture acquisition submodule 131 is used to acquire the pictures to be located in each subset of pictures to be processed.
[0113] The text region determination submodule 132 is used to determine a number of text regions in the image to be located.
[0114] In one embodiment, the text area determination submodule 132 includes:
[0115] The background filtering unit 1321 is used to perform background filtering processing on the image to be located using a preset background filtering rule to generate a filtered image.
[0116] Specifically, the preset background filtering rules include a sharpening algorithm, a mean shift algorithm, and a bilateral filtering algorithm;
[0117] The background filtering unit 1321 is further used to process the image to be located using a mean shift algorithm and a bilateral filtering algorithm to obtain a transition stage processed image, and to process the first stage processed image using a sharpening algorithm to generate a filtered image.
[0118] The text area determination unit 1322 is used to process the filtered image according to a preset text positioning rule to determine a number of text areas in the filtered image.
[0119] The connected region generating submodule 133 is used to process the plurality of text regions using a preset text region processing rule to generate at least one line of text connected regions.
[0120] In one embodiment, the connected region generating submodule 133 includes:
[0121] The text coordinate determining unit 310 is used to determine the region coordinates corresponding to the plurality of text regions.
[0122] The row region division unit 320 is used to divide the plurality of text regions into at least one row text region according to the region coordinates.
[0123] In one embodiment, the row region dividing unit 320 includes:
[0124] A coordinate system establishing subunit 321 is used to establish a rectangular coordinate system with the horizontal direction of the image to be located as the x-axis and the vertical direction as the y-axis;
[0125] The row region division subunit 322 divides the plurality of text regions into at least one row text region according to the y coordinate of the upper left vertex or the y coordinate of the lower right vertex corresponding to each of the plurality of text regions.
[0126] The row connected area generating unit 330 is used to merge all the text areas contained in the row text area to generate a row text connected area when the row text area contains at least two text areas; when the row text area contains only one text area, the text area contained in the row text area is used as the row text connected area.
[0127] The region coordinate determination submodule 134 is used to perform edge detection on the connected region of the at least one line of text to determine the region coordinates corresponding to the text in the image to be located.
[0128] In one embodiment, the area coordinate determination submodule 310 includes:
[0129] The initial region extraction unit 311 is used to extract a plurality of initial text regions from the image to be located using a preset text location rule.
[0130] The final region obtaining unit 312 is used to process the initial text region using a preset expansion processing rule to obtain a final text region.
[0131] A rectangular frame extraction unit 313 is used to extract the minimum circumscribed rectangular frame of the final text area;
[0132] The area coordinate determining unit 314 is used to determine the coordinates of the upper left vertex and the lower right vertex of the minimum circumscribed rectangular frame as the area coordinates corresponding to the final text area.
[0133] It should be noted that the image text positioning device provided in the embodiment of the present invention can realize the functions realized by the above-mentioned image text positioning method embodiment. The specific implementation of the functions refers to the description in the above-mentioned image text positioning method, which will not be repeated here.
[0134] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned image text positioning method is implemented. Wherein, the storage medium includes but is not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the storage medium includes any medium that stores or transmits information in a readable form by a device (for example, a computer). It can be a read-only memory, a disk or an optical disk, etc.
[0135] An embodiment of the present invention further provides a computer device, the computer device comprising:
[0136] one or more processors 710;
[0137] A storage device 720, for storing one or more programs 700,
[0138] When the one or more programs 700 are executed by the one or more processors 710, the one or more processors 710 implement the above-mentioned image text positioning method.
[0139] like Figure 3 The structure diagram of the computer device of the present invention is shown, which includes a processor 710, a storage device 720, an input unit 730, a display unit 740 and other devices. Those skilled in the art can understand that Figure 3The structural devices shown do not constitute a limitation on all computer devices, and may include more or fewer components than shown, or combine certain components. The storage device 720 can be used to store the application 700 and various functional modules, and the processor 710 runs the application 700 stored in the storage device 720, thereby executing various functional applications and data processing of the device. The storage device 720 can be an internal memory or an external memory, or include both internal and external memories. The internal memory may include a read-only memory, a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, or a random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a U disk, a magnetic tape, etc. The storage device disclosed in the present invention includes but is not limited to these types of storage devices. The storage device 720 disclosed in the present invention is only used as an example and not as a limitation.
[0140] The input unit 730 is used to receive the input of the signal, and to receive the relevant request such as the selection of the voice file input by the user. The input unit 730 may include a touch panel and other input devices. The touch panel can collect the touch operation of the user on or near it (such as the operation of the user using any suitable object or accessory such as a finger, a stylus, etc. on the touch panel or near the touch panel), and drive the corresponding connection device according to a pre-set program; other input devices may include but are not limited to one or more of a physical keyboard, a function key (such as a playback control key, a switch key, etc.), a trackball, a mouse, a joystick, etc. The display unit 740 can be used to display the information input by the user or the information provided to the user and various menus of the computer device. The display unit 740 can be in the form of a liquid crystal display, an organic light emitting diode, etc. The processor 710 is the control center of the computer device, which uses various interfaces and lines to connect various parts of the entire computer, and executes various functions and processes data by running or executing software programs and / or modules stored in the storage device 720, and calling data stored in the storage device.
[0141] In one embodiment, the computer device includes one or more processors 710, one or more storage devices 720, and one or more applications 700, wherein the one or more applications 700 are stored in the storage device 720 and are configured to be executed by the one or more processors 710, and the one or more applications 700 are configured to execute the image text positioning method described in the above embodiment.
[0142] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0143] It should be understood that the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0144] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for locating text in an image, characterized in that: include: Acquire all pictures uploaded by terminal users received within a predetermined time interval, and generate a picture set to be processed, wherein the pictures included in the picture set to be processed correspond to multiple picture scenes; Dividing the to-be-processed picture set into a plurality of to-be-processed picture subsets corresponding to different picture scenes; Processing each subset of images to be processed according to preset processing rules corresponding to the image scene to obtain several subsets of images that complete text positioning; The processing of each subset of images to be processed according to a preset processing rule corresponding to the image scene includes: Respectively obtain the images to be located in each subset of images to be processed; Determine a plurality of text areas in the image to be located; Processing the plurality of text regions using a preset text region processing rule to generate at least one line text connected region; Performing edge detection on the at least one connected region of text lines to determine the region coordinates corresponding to the text in the image to be located; The step of processing the plurality of text regions using a preset text region processing rule to generate at least one text line connected region includes: Determine the area coordinates corresponding to the plurality of text areas; Dividing the plurality of text regions into at least one line text region according to the region coordinates; If the line of text regions contains at least two text regions, all the text regions contained in the line of text regions are merged to generate a line of text connected region; If the line text area only includes one text area, the text area included in the line text area is used as the line text connected area.
2. The image text positioning method according to claim 1, characterized in that: The determining of a plurality of text areas in the image to be located includes: Perform background filtering on the image to be located using a preset background filtering rule to generate a filtered image; The filtered image is processed according to a preset text positioning rule to determine a number of text areas in the filtered image.
3. The image text positioning method according to claim 2, characterized in that: The preset background filtering rules include a sharpening algorithm, a mean shift algorithm and a bilateral filtering algorithm; Using a preset background filtering rule to perform background filtering on the image to be located to generate a filtered image, including: The image to be located is processed using a mean shift algorithm and a bilateral filtering algorithm to obtain a transition stage processed image, and the transition stage processed image is processed using a sharpening algorithm to generate a filtered image.
4. The image text positioning method according to claim 1, characterized in that: The determining of the area coordinates corresponding to the plurality of text areas includes: Extracting a plurality of initial text regions from the image to be located using a preset text location rule; Processing the initial text area using a preset expansion processing rule to obtain a final text area; Extracting the minimum bounding rectangle of the final text area; The coordinates of the upper left vertex and the lower right vertex of the minimum circumscribed rectangular frame are determined as the area coordinates corresponding to the final text area.
5. The image text positioning method according to claim 4, characterized in that: The step of dividing the plurality of text areas into at least one line text area according to the area coordinates includes: A rectangular coordinate system is established with the horizontal direction of the image to be located as the x-axis and the vertical direction as the y-axis; The plurality of text areas are divided into at least one line of text areas according to the y coordinate of the upper left vertex or the y coordinate of the lower right vertex corresponding to each of the plurality of text areas.
6. A device for positioning text in an image, characterized in that: include: A picture set acquisition module, used to acquire all pictures uploaded by terminal users received within a predetermined time interval, and generate a picture set to be processed, wherein the pictures contained in the picture set to be processed correspond to multiple picture scenes; A picture set division module, used for dividing the picture set to be processed into a plurality of picture subsets to be processed corresponding to different picture scenes; A picture subset processing module is used to process each picture subset to be processed according to a preset processing rule corresponding to the picture scene, and obtain a number of picture subsets that complete text positioning; The processing of each subset of images to be processed according to a preset processing rule corresponding to the image scene includes: Respectively obtain the images to be located in each subset of images to be processed; Determine a plurality of text areas in the image to be located; Processing the plurality of text regions using a preset text region processing rule to generate at least one line text connected region; Performing edge detection on the at least one connected region of text lines to determine the region coordinates corresponding to the text in the image to be located; The step of processing the plurality of text regions using a preset text region processing rule to generate at least one text line connected region includes: Determine the area coordinates corresponding to the plurality of text areas; Dividing the plurality of text regions into at least one line text region according to the region coordinates; If the line of text regions contains at least two text regions, all the text regions contained in the line of text regions are merged to generate a line of text connected region; If the line text area only includes one text area, the text area included in the line text area is used as the line text connected area.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image text positioning method as described in any one of claims 1 to 5 is implemented.
8. A computer device, characterized in that: The computer device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the image text positioning method as described in any one of claims 1-5.
Citation Information
Patent Citations
Image text detecting method
CN104200209A
Method and device for picture processing, mobile terminal and computer-readable storage medium
CN108898081A