WO2021169102A1 - Text image processing method and apparatus, and computer device and storage medium - Google Patents

Text image processing method and apparatus, and computer device and storage medium Download PDF

Info

Publication number
WO2021169102A1
WO2021169102A1 PCT/CN2020/098060 CN2020098060W WO2021169102A1 WO 2021169102 A1 WO2021169102 A1 WO 2021169102A1 CN 2020098060 W CN2020098060 W CN 2020098060W WO 2021169102 A1 WO2021169102 A1 WO 2021169102A1
Authority
WO
WIPO (PCT)
Prior art keywords
characters
text
inclination angle
text image
processed
Prior art date
Application number
PCT/CN2020/098060
Other languages
French (fr)
Chinese (zh)
Inventor
李海同
舒艳波
Original Assignee
平安国际智慧城市科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安国际智慧城市科技股份有限公司 filed Critical 平安国际智慧城市科技股份有限公司
Publication of WO2021169102A1 publication Critical patent/WO2021169102A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/1475Inclination or skew detection or correction of characters or of image to be recognised
    • G06V30/1478Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/242Aligning, centring, orientation detection or correction of the image by image rotation, e.g. by 90 degrees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Definitions

  • This application relates to a text image processing method, device, computer equipment and storage medium.
  • edge detection, Hough line, etc. all have great limitations. For example, because edge detection requires the text in the image to contain connected regions, edge detection is only suitable for image text inspection for complete objects.
  • the detection method of Hough line is too dependent on the quality of the image, the robustness is relatively poor, and it is easy to be affected by the image noise to cause errors, which leads to the reduction of the accuracy of the correction.
  • a text image processing method, apparatus, computer equipment, and storage medium are provided.
  • a text image processing method includes:
  • the text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  • a text image processing device includes:
  • the detection module is configured to input the text image to be processed into a preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text;
  • An obtaining module configured to obtain the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters according to the edge coordinates of each of the characters in the to-be-processed text image;
  • the screening module is used to screen each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters;
  • the rotation module is configured to reversely rotate the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain a text image.
  • a computer device including a memory, one or more processors, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the one or more processors execute The following steps:
  • the text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  • One or more computer-readable storage media storing computer-readable instructions.
  • the one or more processors perform the following steps:
  • the text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  • Fig. 1 is an application scenario diagram of a text image processing method according to one or more embodiments
  • FIG. 2 is a schematic flowchart of a text image processing method according to one or more embodiments
  • FIG. 3 is a schematic flowchart of the steps of obtaining the rectangular area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed according to one or more embodiments;
  • Fig. 4 is a schematic diagram of a coordinate polygon according to one or more embodiments.
  • FIG. 5 is a schematic diagram of a rectangle circumscribed by a common side according to one or more embodiments.
  • Fig. 6 is a schematic diagram of the smallest rectangle according to one or more embodiments.
  • Fig. 7 is a structural block diagram of a text image processing device according to one or more embodiments.
  • Fig. 8 is an internal structure diagram of a computer device according to one or more embodiments.
  • the text image processing method provided in this application can be applied to the application environment as shown in FIG. 1.
  • the terminal 102 communicates with the server 104 through the network. Specifically, after the terminal 102 receives the text image to be processed, the foregoing text image processing method can be implemented separately.
  • the terminal 102 may also send the to-be-processed text image to the server 104, and the server 104 alone implements the above-mentioned text image processing method.
  • the terminal 102 or the server 104 inputs the text image to be processed into a preset text detection model, and uses the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text; the terminal 102 or the server 104 The edge coordinates of each text in the text image to be processed obtain the rectangular area and inclination angle of each text corresponding to the smallest rectangle; the terminal 102 or the server 104 performs abnormal screening of each text based on the rectangular area and inclination angle of the smallest rectangle of each text, and obtains no abnormal text ; The terminal 102 or the server 104 reversely rotates the text image to be processed according to the average inclination angle of the non-abnormal text to obtain the text image.
  • the terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server 104 may be implemented by an independent server or a server cluster composed of multiple servers.
  • a text image processing method is provided. Taking the method applied to the server 104 in FIG. 1 as an example for description, the method includes the following steps:
  • step S202 the text image to be processed is input into a preset text detection model, and the text in the text image to be processed is detected by using the preset text detection model to obtain edge coordinates of the text.
  • the text image to be processed refers to the text image that needs to be processed.
  • the detection model is a pre-trained AdvancedEast (Advanced Efficient and Accuracy Scene Text) algorithm model.
  • the edge coordinates refer to the coordinates of the area where text can be included in the text image. Referring to Figure 6, the edge coordinates can be understood as 0-1 side, 1-2 side, 2-3 side, and 3-0 side, all the coordinates on these four sides.
  • the server After the server receives the to-be-processed text image sent by the terminal, it calls the already trained AdvancedEast algorithm model.
  • the text image to be processed is input into the AdvancedEast algorithm model, and the edge coordinates of each text in the text image to be processed are detected by the AdvancedEast algorithm model.
  • the AdvancedEast algorithm model detects the text image to be processed, it detects continuous text fields in units of behaviors. Therefore, the output of the AdvancedEast algorithm model is the edge coordinates of each line of text. For example, when there is only a single text in a line of text in a text image, the edge coordinates output by the AdvancedEast algorithm model are the edge coordinates of this text.
  • the edge coordinates output by the AdvancedEast algorithm model are the edge coordinates of the continuous text field that includes two or more texts.
  • Step S204 Obtain the rectangle area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed.
  • the smallest rectangle is the smallest enclosing rectangle that encloses the text, and the rectangle area is the area of the smallest rectangle.
  • the angle of inclination refers to the angle at which the character is inclined relative to the horizontal plane, which can be understood as the degree of the angle formed by the character and the horizontal plane.
  • the server can call an image processing tool, which includes but is not limited to OpenCV, MATLAB, etc. Use image processing tools to obtain the smallest rectangle of each line of text according to the edge coordinates of each text. Then, the server calculates the area of the smallest rectangle of each line of text and the angle between the smallest rectangle and the horizontal plane, and obtains the rectangle area and the inclination angle of the smallest rectangle.
  • an image processing tool which includes but is not limited to OpenCV, MATLAB, etc.
  • step S206 abnormality screening is performed on each character based on the rectangular area and the inclination angle of the smallest rectangle of each character, and no abnormal characters are obtained.
  • the server further eliminates the existing interference factors through the rectangular area and the inclination angle of the smallest rectangle corresponding to the text, which can improve the accuracy of subsequent processing.
  • step S206 abnormal screening is performed on each text based on the rectangular area and the inclination angle of the smallest rectangle of each text to obtain no abnormal text, which specifically includes: calculating the average inclination angle of each text according to the inclination angle; based on the average inclination Angle, exclude the characters whose inclination angle does not meet the angle requirement; according to the rectangular area of the smallest rectangle of each character, select a preset number of characters from the characters that meet the angle requirement as no abnormal characters.
  • the characters whose inclination angle does not meet the angle requirement are eliminated, and the characters whose inclination angle meets the angle requirement are selected.
  • the elimination of the characters whose inclination angle does not meet the angle requirement can be the elimination of characters whose deviation between the inclination angle and the average inclination angle is greater than the threshold.
  • a preset number of characters are selected from large to small, and no abnormal characters are obtained. For example, suppose the preset number is 10, then select the top 10 characters in the order of area size from the characters that meet the angle requirements as no abnormal characters. In this implementation, a longer text line is selected by area, which can further eliminate interference factors such as text watermarks and stamps that may contain shorter text.
  • based on the average inclination angle excluding the characters whose inclination angle does not meet the angle requirement includes: calculating the deviation values of the average inclination angle and the inclination angle of each character respectively; acquiring and removing the characters whose deviation value is greater than a threshold value.
  • the deviation value of the inclination angle and the average inclination angle is obtained. Then, the deviation value is compared with the preset threshold value, the deviation value greater than the threshold value is determined, and the characters corresponding to the deviation value greater than the threshold value are eliminated.
  • the threshold may be a fixed value set according to the type of text image actually processed. In this embodiment, the threshold is preferably 30% of the average inclination angle, and the characters that are rejected are those whose deviation value from the average inclination angle is greater than 30% of the average inclination angle.
  • step S208 the to-be-processed text image is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
  • the reverse rotation refers to rotation in a direction opposite to the direction of the average tilt angle.
  • the non-abnormal text is obtained, first calculate and determine the average tilt angle and the tilt direction between the non-abnormal text. Then, the to-be-processed text is rotated in the opposite direction of the oblique direction, and the rotation angle is the same as the average oblique angle, and the text image is obtained. For example, if the average inclination angle of the text with no abnormality is 20 degrees to the left, the reverse rotation is to rotate the text image to be processed by 20 degrees to the right.
  • rotating the text image to be processed in the opposite direction of the tilt direction by the same angle as the average tilt angle to obtain the text image includes: obtaining the coordinates of each pixel in the text image to be processed; based on the tilt direction and The average tilt angle transforms the coordinates of each pixel point to obtain an image composed of pixels after the coordinate mapping conversion to obtain a text image.
  • each pixel in the text image to be processed first obtains the coordinates of each pixel in the text image to be processed.
  • the rotation direction is determined based on the tilt direction, and the rotation angle is determined based on the average tilt angle.
  • the coordinates of each pixel are re-mapped and transformed, and the new coordinates after rotation are obtained for each pixel.
  • the position of each pixel is adjusted based on the position of the new coordinate after rotation, and the image formed by the adjusted position of the pixel is the rotated text image.
  • the above text image processing method uses a preset text detection model based on deep learning to perform edge detection on the text image to be processed to obtain the edge coordinates of the text, thereby improving the accuracy of obtaining the edge information, and then according to the smallest rectangle obtained from the edge coordinates of the text
  • the rectangular area and the inclination angle filter the characters to obtain no abnormal characters, and the to-be-processed text image is rotated and corrected based on the inclination angle of the non-abnormal characters, so as to reduce the interference factors of abnormal characters and improve the accuracy of correction.
  • obtaining the rectangular area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed includes the following steps:
  • step S302 the edge coordinates of each character in the text image to be processed are thinned out to obtain the thinned edge coordinates.
  • Thinning refers to the process of reducing the number of data points to the utmost extent under the condition that the shape of the vector curve remains unchanged through rules. Specifically, the obtained edge coordinates are thinned out, and the remaining edge coordinates after thinning out are the obtained thinned edge coordinates. For example, assuming that there are 100 original edge coordinates in total, there may only be 50 coordinates remaining after thinning, and these 50 coordinates are the thinning edge coordinates.
  • Step S304 connecting the dilute edge coordinates to obtain a coordinate polygon.
  • the thinning edge coordinates are connected in sequence to obtain the coordinate polygon.
  • a schematic diagram of a coordinate polygon is provided.
  • the coordinate polygon shown in Fig. 4 is a polygon obtained by sequentially connecting 6 thinning edge coordinates.
  • Step S306 traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon.
  • Step S308 Determine the smallest rectangle from the circumscribed rectangles with the same sides, and obtain the rectangle area and the inclination angle of the smallest rectangle.
  • the co-sided circumscribed rectangle means that one side of the circumscribed rectangle of the coordinate polygon is the same as one side of the coordinate multilateral row. It can be understood that one side of the co-sided circumscribed rectangle is one side of the coordinate polygon. Therefore, the minimum bounding rectangle of the coordinate polygon is the minimum rectangle that needs to be obtained.
  • each side in the selected coordinate polygon is traversed, and the circumscribed rectangle of the coordinate polygon is drawn based on the selected side, and the co-sided circumscribed rectangle is obtained. Then, the rectangle with the smallest area is selected from all the circumscribed rectangles with the same sides, and the rectangle with the smallest area selected is the smallest rectangle.
  • the 6-sided polygon as shown in FIG. 4 has 6 sides in total. By drawing the 6 sides separately, 6 corresponding co-sided circumscribed rectangles can be obtained. Then, from the 6 co-sided circumscribed rectangles, the co-sided circumscribed rectangle with the smallest area is selected as the smallest rectangle. As shown in FIG.
  • FIG. 5 a schematic diagram of a common edge circumscribed rectangle is provided.
  • the shape drawn by the solid line is the coordinate polygon shown in FIG. 4
  • the shape drawn by the dashed line is the coedge circumscribed rectangle drawn by drawing the bottom side of the coordinate polygon shown in FIG. 4 as the coedge.
  • the area and inclination angle of the smallest rectangle can be obtained. After determining the length and width of the rectangle area of the smallest rectangle according to the coordinates of the 4 vertices of the smallest rectangle, it is calculated using the area formula.
  • the acquisition of the inclination angle of the smallest rectangle specifically includes: determining the coordinates of the adjacent vertices based on the horizontal sloping side of the smallest rectangle; calculating the angle between the horizontal plane and the horizontal sloping side according to the coordinate values of the adjacent vertex coordinates , Get the inclination angle of the smallest rectangle.
  • the horizontally inclined side is the side of the smallest rectangle that is inclined relative to the horizontal plane, and the coordinates of the adjacent vertices based on the horizontally inclined side of the smallest rectangle are the vertices located on the horizontally inclined side.
  • FIG. 6 a schematic diagram of the smallest rectangle is provided. Referring to Figure 6, the two sides 0-3 and 1-2 are horizontally inclined sides. The coordinates 0 and 3 on the side 0-3 are the coordinates of the adjacent vertices. Coordinates 1 and 2 on sides 1-2 are the coordinates of adjacent vertices. Take the 0-3 side shown in Figure 5 as an example, the calculation formula of the inclination angle ⁇ is as follows:
  • the 0-3 side shown in Figure 5 is that the position of coordinate 0 is lower than the position of coordinate 3.
  • the calculation formula of the inclination angle ⁇ is as follows:
  • the smallest rectangle is determined, which can not only remove repeated coordinates and reduce processing time, but also accurately obtain the smallest rectangle.
  • a text image processing device including: a detection module 702, an acquisition module 704, a screening module 706, and a rotation module 708, wherein:
  • the detection module 702 is configured to input the text image to be processed into a preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text.
  • the obtaining module 704 is configured to obtain the rectangular area and the inclination angle of the smallest rectangle corresponding to each character according to the edge coordinates of each character in the text image to be processed.
  • the screening module 706 is used for screening each text based on the rectangular area and the inclination angle of the smallest rectangle of each text to obtain no abnormal text.
  • the rotation module 708 is configured to reversely rotate the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain the text image.
  • the obtaining module 704 is also used to thin out the edge coordinates of each text in the text image to be processed to obtain the thinned edge coordinates; connect the thinned edge coordinates to obtain the coordinate polygon; The co-sided circumscribed rectangle of the sides; determine the smallest rectangle from the co-sided circumscribed rectangle, and obtain the rectangle area and inclination angle of the smallest rectangle.
  • the acquiring module 704 is also used to determine the coordinates of the adjacent vertices of the horizontally inclined side based on the smallest rectangle; calculate the angle between the horizontal plane and the horizontally inclined side according to the coordinate values of the adjacent vertices to obtain the smallest rectangle slope.
  • the filtering module 706 is also used to calculate the average inclination angle of each character based on the inclination angle; based on the average inclination angle, the characters whose inclination angle does not meet the angle requirement are excluded; Select a preset number of characters from the characters required by the angle as no abnormal characters.
  • the filtering module 706 is also used to calculate the deviation values of the average tilt angle and the tilt angle of each character respectively; to obtain and eliminate characters whose deviation value is greater than the threshold value.
  • the rotation module 708 is also used to determine the average tilt angle and tilt direction of the non-abnormal text; rotate the text to be processed in the opposite direction of the tilt direction to the same angle as the average tilt angle to obtain a text image.
  • the rotation module 708 is also used to obtain the coordinates of each pixel in the to-be-processed text image; based on the tilt direction and the average tilt angle, the coordinates of each pixel are mapped and transformed to obtain the transformed coordinate mapping An image composed of pixels to get a text image.
  • the text image processing device please refer to the above limitation of the text image processing method, which will not be repeated here.
  • Each module in the above text image processing device can be implemented in whole or in part by software, hardware, and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 8.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a storage medium and an internal memory.
  • the storage medium may be non-volatile or volatile.
  • the storage medium stores an operating system, computer readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the storage medium.
  • the database of the computer equipment is used to store relevant data.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer readable instructions are executed by the processor to realize a text image processing method.
  • FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
  • a computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions.
  • the one or more processors execute the following steps:
  • the text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • a preset number of characters are selected from characters that meet the angle requirements as no abnormal characters.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the coordinates of each pixel point are mapped and converted based on the tilt direction and the average tilt angle, and an image composed of pixels after the coordinate mapping conversion is obtained to obtain a text image.
  • One or more computer-readable storage media storing computer-readable instructions.
  • the one or more processors perform the following steps:
  • the text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
  • the coordinates of each pixel point are mapped and converted based on the tilt direction and the average tilt angle, and an image composed of pixels after the coordinate mapping conversion is obtained to obtain a text image.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Character Input (AREA)

Abstract

A text image processing method and apparatus, and a computer device and a storage medium, relating to the field of artificial intelligence. The method comprises: inputting a text image to be processed into a preset text detection model, and performing edge detection on characters in said text image using the preset text detection model to obtain edge coordinates of the characters; according to the edge coordinates of the characters in said text image, obtaining a rectangular area and inclination angle of a minimum rectangle corresponding to the characters; on the basis of the rectangular area and inclination angle of the minimum rectangle of the characters, screening the characters to obtain anomaly-free characters; and according to an average inclination angle of the anomaly-free characters, reversely rotating said text image to obtain a text image.

Description

文本图像处理方法、装置、计算机设备和存储介质Text image processing method, device, computer equipment and storage medium
相关申请的交叉引用Cross-references to related applications
本申请要求于2020年02月27日提交中国专利局,申请号为202010123338.1,申请名称为“文本图像处理方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on February 27, 2020, the application number is 202010123338.1, and the application title is "Text Image Processing Method, Device, Computer Equipment and Storage Medium", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本申请涉及一种文本图像处理方法、装置、计算机设备和存储介质。This application relates to a text image processing method, device, computer equipment and storage medium.
背景技术Background technique
随着图像识别技术的发展,出现了文本图像识别,文本图像识别是办公自动化的一个重要领域。但是,在文本图像识别领域,存在多种因素影响文本图像的识别率。其中,图像中的文字倾斜是一个比较重要的因素,因此,目前在大部分文本图像识别应用中,在进行文本图像识别之前都需要对文字进行矫正。传统的文本图像矫正方法有边缘检测、霍夫直线等。With the development of image recognition technology, text image recognition has appeared, and text image recognition is an important field of office automation. However, in the field of text image recognition, there are many factors that affect the recognition rate of text images. Among them, the inclination of the text in the image is a relatively important factor. Therefore, in most text image recognition applications at present, the text needs to be corrected before the text image recognition is performed. Traditional text image correction methods include edge detection, Hough line and so on.
然而,发明人意识到,边缘检测、霍夫直线等都具有很大的局限性。例如,由于边缘检测需要图像中的文字包含连通区域,因此边缘检测只是适合完整对象的图像文字检查。而霍夫直线这种检测方法又过于依赖图像的质量,鲁棒性比较差,很容易受到图像噪声的影响出现误差,从而导致降低了矫正的准确性。However, the inventor realized that edge detection, Hough line, etc. all have great limitations. For example, because edge detection requires the text in the image to contain connected regions, edge detection is only suitable for image text inspection for complete objects. However, the detection method of Hough line is too dependent on the quality of the image, the robustness is relatively poor, and it is easy to be affected by the image noise to cause errors, which leads to the reduction of the accuracy of the correction.
发明内容Summary of the invention
根据本申请公开的各种实施例,提供一种文本图像处理方法、装置、计算机设备和存储介质。According to various embodiments disclosed in the present application, a text image processing method, apparatus, computer equipment, and storage medium are provided.
一种文本图像处理方法包括:A text image processing method includes:
将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
一种文本图像处理装置包括:A text image processing device includes:
检测模块,用于将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标;The detection module is configured to input the text image to be processed into a preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text;
获取模块,用于根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;An obtaining module, configured to obtain the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters according to the edge coordinates of each of the characters in the to-be-processed text image;
筛选模块,用于基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行筛选,得到无异常文字;及The screening module is used to screen each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
旋转模块,用于根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The rotation module is configured to reversely rotate the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain a text image.
一种计算机设备,包括存储器、一个或多个处理器,所述存储器中存储有计算机可读指令,所述计算可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device, including a memory, one or more processors, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the one or more processors execute The following steps:
将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
一个或多个存储有计算机可读指令的计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:One or more computer-readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps:
将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the present application are set forth in the following drawings and description. Other features and advantages of this application will become apparent from the description, drawings and claims.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. A person of ordinary skill in the art can obtain other drawings based on these drawings without creative work.
图1为根据一个或多个实施例中文本图像处理方法的应用场景图;Fig. 1 is an application scenario diagram of a text image processing method according to one or more embodiments;
图2为根据一个或多个实施例中文本图像处理方法的流程示意图;2 is a schematic flowchart of a text image processing method according to one or more embodiments;
图3为根据一个或多个实施例中根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度步骤的流程示意图;3 is a schematic flowchart of the steps of obtaining the rectangular area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed according to one or more embodiments;
图4为根据一个或多个实施例中坐标多边形的示意图;Fig. 4 is a schematic diagram of a coordinate polygon according to one or more embodiments;
图5为根据一个或多个实施例中共边外接矩形的示意图;FIG. 5 is a schematic diagram of a rectangle circumscribed by a common side according to one or more embodiments;
图6为根据一个或多个实施例中最小矩形的示意图;Fig. 6 is a schematic diagram of the smallest rectangle according to one or more embodiments;
图7为根据一个或多个实施例中文本图像处理装置的结构框图;Fig. 7 is a structural block diagram of a text image processing device according to one or more embodiments;
图8为根据一个或多个实施例中计算机设备的内部结构图。Fig. 8 is an internal structure diagram of a computer device according to one or more embodiments.
具体实施方式Detailed ways
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the technical solutions and advantages of the present application clearer, the following further describes the present application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
本申请提供的文本图像处理方法,可以应用于如图1所示的应用环境中。终端102通过网络与服务器104进行通信。具体地,当终端102接收到待处理文本图像之后,可以单独实现上述文本图像处理方法。也可以由终端102将待处理文本图像发送给服务器104,由服务器104单独实现上述文本图像处理方法。例如,终端102或服务器104将待处理文本图像输入至预设文本检测模型中,利用预设文本检测模型对待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标;终端102或服务器104根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度;终端102或服务器104基于各文字最小矩形的矩形面积和倾斜角度对各文字进行异常筛选,得到无异常文字;终端102或服务器104根据无异常文字的平均倾斜角度将待处理文本图像进行反向旋转,得到文本图像。终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The text image processing method provided in this application can be applied to the application environment as shown in FIG. 1. The terminal 102 communicates with the server 104 through the network. Specifically, after the terminal 102 receives the text image to be processed, the foregoing text image processing method can be implemented separately. The terminal 102 may also send the to-be-processed text image to the server 104, and the server 104 alone implements the above-mentioned text image processing method. For example, the terminal 102 or the server 104 inputs the text image to be processed into a preset text detection model, and uses the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text; the terminal 102 or the server 104 The edge coordinates of each text in the text image to be processed obtain the rectangular area and inclination angle of each text corresponding to the smallest rectangle; the terminal 102 or the server 104 performs abnormal screening of each text based on the rectangular area and inclination angle of the smallest rectangle of each text, and obtains no abnormal text ; The terminal 102 or the server 104 reversely rotates the text image to be processed according to the average inclination angle of the non-abnormal text to obtain the text image. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The server 104 may be implemented by an independent server or a server cluster composed of multiple servers.
在其中一个实施例中,如图2所示,提供了一种文本图像处理方法,以该方法应用于图1中的服务器104为例进行说明,包括以下步骤:In one of the embodiments, as shown in FIG. 2, a text image processing method is provided. Taking the method applied to the server 104 in FIG. 1 as an example for description, the method includes the following steps:
步骤S202,将待处理文本图像输入至预设文本检测模型中,利用预设文本检测模型对待处理文本图像中的文字进行检测,得到文字的边缘坐标。In step S202, the text image to be processed is input into a preset text detection model, and the text in the text image to be processed is detected by using the preset text detection model to obtain edge coordinates of the text.
待处理文本图像是指需要进行处理的文本图像。检测模型为预先训练好的AdvancedEast(Advanced Efficient and Accuracy Scene Text,高级高效准确的场景文本)算法模型。边缘坐标是指文本图像中可以包括文字的区域的坐标。参考图6,边缘坐标可以理解为是0-1边、1-2边、2-3边、以及3-0边,这四条边上所有的坐标。The text image to be processed refers to the text image that needs to be processed. The detection model is a pre-trained AdvancedEast (Advanced Efficient and Accuracy Scene Text) algorithm model. The edge coordinates refer to the coordinates of the area where text can be included in the text image. Referring to Figure 6, the edge coordinates can be understood as 0-1 side, 1-2 side, 2-3 side, and 3-0 side, all the coordinates on these four sides.
具体地,当服务器接收到终端发送的待处理文本图像之后,调用已经训练好的AdvancedEast算法模型。将待处理文本图像输入至AdvancedEast算法模型中,由AdvancedEast算法模型检测得到待处理文本图像中各文字的边缘坐标。应当理解的是,当AdvancedEast算法模型对待处理文本图像进行检测时,是检测以行为单位的连续文字段。所以,AdvancedEast算法模型输出得到的是每一行文字的边缘坐标。例如,当文本图像中存在一行文字当中只有单独一个文字时,AdvancedEast算法模型输出的边缘坐标就是这个文字的边缘坐标。而当文本图像中的一行文字有两个及两个以上的连续文字段时,AdvancedEast算法模型输出的边缘坐标就是这个包括两个及两个以上文字的连续文字段的边缘坐标。Specifically, after the server receives the to-be-processed text image sent by the terminal, it calls the already trained AdvancedEast algorithm model. The text image to be processed is input into the AdvancedEast algorithm model, and the edge coordinates of each text in the text image to be processed are detected by the AdvancedEast algorithm model. It should be understood that when the AdvancedEast algorithm model detects the text image to be processed, it detects continuous text fields in units of behaviors. Therefore, the output of the AdvancedEast algorithm model is the edge coordinates of each line of text. For example, when there is only a single text in a line of text in a text image, the edge coordinates output by the AdvancedEast algorithm model are the edge coordinates of this text. When a line of text in a text image has two or more continuous text fields, the edge coordinates output by the AdvancedEast algorithm model are the edge coordinates of the continuous text field that includes two or more texts.
步骤S204,根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度。Step S204: Obtain the rectangle area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed.
最小矩形是包围文字的最小包围矩形,矩形面积则是最小矩形的面积。倾斜角度是指文字相对于水平面所倾斜的角度,可以理解为是文字与水平面形成的夹角的度数。The smallest rectangle is the smallest enclosing rectangle that encloses the text, and the rectangle area is the area of the smallest rectangle. The angle of inclination refers to the angle at which the character is inclined relative to the horizontal plane, which can be understood as the degree of the angle formed by the character and the horizontal plane.
具体地,当服务器得到待处理文本图像中各行文字的边缘坐标之后,可以调用图像处理工具,图像处理工具包括但不限于OpenCV、MATLAB等。利用图像处理工具根据各文字的边缘坐标得到各行文字的最小矩形。然后,服务器计算得到各行文字的最小矩形的面积和最小矩形与水平面的夹角,得到最小矩形的矩形面积和倾斜角度。Specifically, after the server obtains the edge coordinates of each line of text in the text image to be processed, it can call an image processing tool, which includes but is not limited to OpenCV, MATLAB, etc. Use image processing tools to obtain the smallest rectangle of each line of text according to the edge coordinates of each text. Then, the server calculates the area of the smallest rectangle of each line of text and the angle between the smallest rectangle and the horizontal plane, and obtains the rectangle area and the inclination angle of the smallest rectangle.
步骤S206,基于各文字最小矩形的矩形面积和倾斜角度对各文字进行异常筛选,得到无异常文字。In step S206, abnormality screening is performed on each character based on the rectangular area and the inclination angle of the smallest rectangle of each character, and no abnormal characters are obtained.
由于真实场景的文本图像对应的文字比较复杂,会存在一定的干扰因素,干扰因素包括但不限于水印、盖章等。因此,服务器通过文字对应的最小矩形的矩形面积和倾斜角度进一步剔除存在的干扰因素,能够提高后续处理的准确度。Since the text corresponding to the text image of the real scene is relatively complex, there will be certain interference factors, including but not limited to watermarks, stamps, and so on. Therefore, the server further eliminates the existing interference factors through the rectangular area and the inclination angle of the smallest rectangle corresponding to the text, which can improve the accuracy of subsequent processing.
在其中一个实施例中,步骤S206,基于各文字最小矩形的矩形面积和倾斜角度对各文字进行异常筛选,得到无异常文字,具体包括:根据倾斜角度计算各文字的平均倾斜角度;基于平均倾斜角度,剔除倾斜角度不满足角度要求的文字;根据各文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。In one of the embodiments, in step S206, abnormal screening is performed on each text based on the rectangular area and the inclination angle of the smallest rectangle of each text to obtain no abnormal text, which specifically includes: calculating the average inclination angle of each text according to the inclination angle; based on the average inclination Angle, exclude the characters whose inclination angle does not meet the angle requirement; according to the rectangular area of the smallest rectangle of each character, select a preset number of characters from the characters that meet the angle requirement as no abnormal characters.
具体地,平均倾斜角度是待处理文本中各行文字倾斜角度的平均值。当得到各文字的最小矩形的倾斜角度后,根据文字的数量计算得到各文字的平均倾斜角度。例如,假设文本图像中一共有3行文字,且每行文字的倾斜角度分别是A、B、C。那么,平均倾斜角度J=(A+B+C)/3。然后,将平均倾斜角度与各文字的倾斜角度进行大小比较,根据大小比较的结果确定该倾斜角度是否满足角度要求。剔除倾斜角度不满足角度要求的文字,选择倾斜角度满足角度要求的文字。剔除倾斜角度不满足角度要求的文字,可以是剔除倾斜角度与平均倾斜角度的偏差大于阈值的文字。Specifically, the average tilt angle is the average value of the tilt angles of each line of text in the text to be processed. After the inclination angle of the smallest rectangle of each character is obtained, the average inclination angle of each character is calculated according to the number of characters. For example, suppose there are 3 lines of text in the text image, and the inclination angles of each line of text are A, B, and C respectively. Then, the average tilt angle J=(A+B+C)/3. Then, the average inclination angle is compared with the inclination angle of each character, and it is determined whether the inclination angle meets the angle requirement according to the result of the size comparison. The characters whose inclination angle does not meet the angle requirement are eliminated, and the characters whose inclination angle meets the angle requirement are selected. The elimination of the characters whose inclination angle does not meet the angle requirement can be the elimination of characters whose deviation between the inclination angle and the average inclination angle is greater than the threshold.
当得到满足角度要求的文字之后,按照各文字的最小矩形的矩形面积的大小,从大到小选择预设数量的文字,得到无异常文字。例如,假设预设数量为10个,那么从满足角 度要求的文字中选择面积大小排序在前10的文字作为无异常文字。本实施中通过面积选择较长的文字行,可以进一步排除文字水印和盖章这种会包含较短文字的干扰因素。When the characters that meet the angle requirements are obtained, according to the size of the rectangular area of the smallest rectangle of each character, a preset number of characters are selected from large to small, and no abnormal characters are obtained. For example, suppose the preset number is 10, then select the top 10 characters in the order of area size from the characters that meet the angle requirements as no abnormal characters. In this implementation, a longer text line is selected by area, which can further eliminate interference factors such as text watermarks and stamps that may contain shorter text.
在其中一个实施例中,基于平均倾斜角度,剔除倾斜角度不满足角度要求的文字,包括:分别计算平均倾斜角度与各文字的倾斜角度的偏差值;获取并剔除偏差值大于阈值的文字。In one of the embodiments, based on the average inclination angle, excluding the characters whose inclination angle does not meet the angle requirement includes: calculating the deviation values of the average inclination angle and the inclination angle of each character respectively; acquiring and removing the characters whose deviation value is greater than a threshold value.
具体地,通过计算平均倾斜角度与各文字的倾斜角度的差值,得到倾斜角度与平均倾斜角度的偏差值。然后,将偏差值与预设的阈值进行比较,确定大于阈值的偏差值,剔除大于阈值的偏差值对应的文字。阈值可以是根据实际所处理的文本图像的类型所设定的固定值。在本实施例中,阈值优选为平均倾斜角度的30%,那么剔除的文字即为与平均倾斜角度的偏差值大于平均倾斜角度的30%的文字。Specifically, by calculating the difference between the average inclination angle and the inclination angle of each character, the deviation value of the inclination angle and the average inclination angle is obtained. Then, the deviation value is compared with the preset threshold value, the deviation value greater than the threshold value is determined, and the characters corresponding to the deviation value greater than the threshold value are eliminated. The threshold may be a fixed value set according to the type of text image actually processed. In this embodiment, the threshold is preferably 30% of the average inclination angle, and the characters that are rejected are those whose deviation value from the average inclination angle is greater than 30% of the average inclination angle.
步骤S208,根据无异常文字的平均倾斜角度将待处理文本图像进行反向旋转,得到文本图像。In step S208, the to-be-processed text image is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
具体地,反向旋转是指向与平均倾斜角度的方向相反的方向旋转。在得到无异常文字之后,首先计算确定无异常文字之间的平均倾斜角度和倾斜方向。然后,将待处理文本向倾斜方向的反方向进行旋转,旋转的角度与平均倾斜角度相同,得到文本图像。例如,无异常文字的平均倾斜角度是向左旋转了20度,则反向旋转是将待处理文本图像向右旋转20度。Specifically, the reverse rotation refers to rotation in a direction opposite to the direction of the average tilt angle. After the non-abnormal text is obtained, first calculate and determine the average tilt angle and the tilt direction between the non-abnormal text. Then, the to-be-processed text is rotated in the opposite direction of the oblique direction, and the rotation angle is the same as the average oblique angle, and the text image is obtained. For example, if the average inclination angle of the text with no abnormality is 20 degrees to the left, the reverse rotation is to rotate the text image to be processed by 20 degrees to the right.
在其中一个实施例中,将待处理文本图像向倾斜方向的反方向旋转与平均倾斜角度相同的角度,得到文本图像,具体包括:获取待处理文本图像中各像素点的坐标;基于倾斜方向和平均倾斜角度将各像素点的坐标进行映射转换,获取坐标映射转换后的像素点组成的图像,得到文本图像。In one of the embodiments, rotating the text image to be processed in the opposite direction of the tilt direction by the same angle as the average tilt angle to obtain the text image includes: obtaining the coordinates of each pixel in the text image to be processed; based on the tilt direction and The average tilt angle transforms the coordinates of each pixel point to obtain an image composed of pixels after the coordinate mapping conversion to obtain a text image.
具体地,首先获取待处理文本图像中各像素点的坐标。根据倾斜方向确定旋转方向,以及根据平均倾斜角度确定旋转角度。然后基于旋转方向和旋转角度将各像素点的坐标重新进行映射转换,为各像素点得到已经旋转后的新坐标。基于旋转后的新坐标的位置调整各像素点的位置,调整位置后的像素点所组成的图像即为旋转后的文本图像。Specifically, first obtain the coordinates of each pixel in the text image to be processed. The rotation direction is determined based on the tilt direction, and the rotation angle is determined based on the average tilt angle. Then, based on the rotation direction and the rotation angle, the coordinates of each pixel are re-mapped and transformed, and the new coordinates after rotation are obtained for each pixel. The position of each pixel is adjusted based on the position of the new coordinate after rotation, and the image formed by the adjusted position of the pixel is the rotated text image.
上述文本图像处理方法,通过基于深度学习的预设文本检测模型对待处理文本图像进行边缘检测得到文字的边缘坐标,从而提高获取边缘信息的准确性,进而根据由文字的边缘坐标获取的最小矩形的矩形面积和倾斜角度对文字筛选得到无异常文字,基于无异常文字的倾斜角度对待处理文本图像进行旋转矫正,从而减少异常文字剔除干扰因素,提高矫正的准确率。The above text image processing method uses a preset text detection model based on deep learning to perform edge detection on the text image to be processed to obtain the edge coordinates of the text, thereby improving the accuracy of obtaining the edge information, and then according to the smallest rectangle obtained from the edge coordinates of the text The rectangular area and the inclination angle filter the characters to obtain no abnormal characters, and the to-be-processed text image is rotated and corrected based on the inclination angle of the non-abnormal characters, so as to reduce the interference factors of abnormal characters and improve the accuracy of correction.
在其中一个实施例中,如图3所示,根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度,包括以下步骤:In one of the embodiments, as shown in FIG. 3, obtaining the rectangular area and the inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed includes the following steps:
步骤S302,对待处理文本图像中各文字的边缘坐标进行抽稀,得到抽稀边缘坐标。In step S302, the edge coordinates of each character in the text image to be processed are thinned out to obtain the thinned edge coordinates.
抽稀是指通过规则,在保证矢量曲线形状不变的情况下,最大限度的减少数据点个数的过程。具体地,对得到的边缘坐标进行抽稀,抽稀之后剩余的边缘坐标即为得到的抽稀 边缘坐标。例如,假设原始的边缘坐标一共有100个,在经过抽稀之后可能只剩余50个坐标,这50个坐标即为抽稀边缘坐标。Thinning refers to the process of reducing the number of data points to the utmost extent under the condition that the shape of the vector curve remains unchanged through rules. Specifically, the obtained edge coordinates are thinned out, and the remaining edge coordinates after thinning out are the obtained thinned edge coordinates. For example, assuming that there are 100 original edge coordinates in total, there may only be 50 coordinates remaining after thinning, and these 50 coordinates are the thinning edge coordinates.
步骤S304,连接各抽稀边缘坐标,得到坐标多边形。Step S304, connecting the dilute edge coordinates to obtain a coordinate polygon.
具体地,按照抽稀边缘坐标的顺序,依次将各抽稀边缘坐标进行连线,得到坐标多边形。如图4所示,提供一种坐标多边形的示意图。参考图4,图4所示的坐标多边形即为6个抽稀边缘坐标依次连接所得到的多边形。Specifically, according to the order of the thinning edge coordinates, the thinning edge coordinates are connected in sequence to obtain the coordinate polygon. As shown in Fig. 4, a schematic diagram of a coordinate polygon is provided. Referring to Fig. 4, the coordinate polygon shown in Fig. 4 is a polygon obtained by sequentially connecting 6 thinning edge coordinates.
步骤S306,遍历得到与坐标多边形共边的共边外接矩形。Step S306, traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon.
步骤S308,从共边外接矩形中确定最小矩形,并获取最小矩形的矩形面积和倾斜角度。Step S308: Determine the smallest rectangle from the circumscribed rectangles with the same sides, and obtain the rectangle area and the inclination angle of the smallest rectangle.
共边外接矩形是指坐标多边形的外接矩形的一条边与坐标多边行的一条边相同。可以理解为,共边外接矩形其中的一条边就是坐标多边形其中的一条边。因此,坐标多边形的最小外接矩形为需要得到的最小矩形。The co-sided circumscribed rectangle means that one side of the circumscribed rectangle of the coordinate polygon is the same as one side of the coordinate multilateral row. It can be understood that one side of the co-sided circumscribed rectangle is one side of the coordinate polygon. Therefore, the minimum bounding rectangle of the coordinate polygon is the minimum rectangle that needs to be obtained.
具体地,当得到坐标多边形之后,遍历选择坐标多边形中的每一条边,基于所选择的边绘制得到坐标多边形的外接矩形,得到共边外接矩形。然后,从所有的共边外接矩形中选择面积最小的矩形,选择的面积最小的矩形就是最小矩形。例如,以图4所示的坐标多边形为例,如图4所示的6边形共有6条边,通过6条边分别进行绘制,能够得到6个对应的共边外接矩形。然后,从这6个共边外接矩形中选择面积最小的那一个共边外接矩形作为最小矩形。如图5所示,提供一种共边外接矩形的示意图。参考图5,实线绘制的形状为图4所示的坐标多边形,虚线绘制的形状是以图4所示的坐标多边形的最下面一条边作为共边而绘制得到的共边外接矩形。Specifically, after the coordinate polygon is obtained, each side in the selected coordinate polygon is traversed, and the circumscribed rectangle of the coordinate polygon is drawn based on the selected side, and the co-sided circumscribed rectangle is obtained. Then, the rectangle with the smallest area is selected from all the circumscribed rectangles with the same sides, and the rectangle with the smallest area selected is the smallest rectangle. For example, taking the coordinate polygon shown in FIG. 4 as an example, the 6-sided polygon as shown in FIG. 4 has 6 sides in total. By drawing the 6 sides separately, 6 corresponding co-sided circumscribed rectangles can be obtained. Then, from the 6 co-sided circumscribed rectangles, the co-sided circumscribed rectangle with the smallest area is selected as the smallest rectangle. As shown in FIG. 5, a schematic diagram of a common edge circumscribed rectangle is provided. Referring to FIG. 5, the shape drawn by the solid line is the coordinate polygon shown in FIG. 4, and the shape drawn by the dashed line is the coedge circumscribed rectangle drawn by drawing the bottom side of the coordinate polygon shown in FIG. 4 as the coedge.
当得到最小矩形之后,即可获取这个最小矩形的矩形面积和倾斜角度。最小矩形的矩形面积根据最小矩形的4个顶点坐标确定长和宽之后,利用面积公式计算得到。When the smallest rectangle is obtained, the area and inclination angle of the smallest rectangle can be obtained. After determining the length and width of the rectangle area of the smallest rectangle according to the coordinates of the 4 vertices of the smallest rectangle, it is calculated using the area formula.
在其中一个实施例中,最小矩形的倾斜角度的获取,具体包括:确定基于最小矩形的水平倾斜边相邻的顶点坐标;根据相邻的顶点坐标的坐标值计算水平面与水平倾斜边的夹角,得到最小矩形的倾斜角度。In one of the embodiments, the acquisition of the inclination angle of the smallest rectangle specifically includes: determining the coordinates of the adjacent vertices based on the horizontal sloping side of the smallest rectangle; calculating the angle between the horizontal plane and the horizontal sloping side according to the coordinate values of the adjacent vertex coordinates , Get the inclination angle of the smallest rectangle.
水平倾斜边是最小矩形相对于水平面倾斜的边,基于最小矩形的水平倾斜边相邻的顶点坐标就是位于水平倾斜边上的顶点。如图6所示,提供一种最小矩形示意图。参考图6,0-3边和1-2边这两条边即为水平倾斜边。0-3边上的坐标0和3即为相邻的顶点坐标。1-2边上的坐标1和2即为相邻的顶点坐标。以图5所示的0-3边为例,倾斜角度θ的计算公式如下:The horizontally inclined side is the side of the smallest rectangle that is inclined relative to the horizontal plane, and the coordinates of the adjacent vertices based on the horizontally inclined side of the smallest rectangle are the vertices located on the horizontally inclined side. As shown in FIG. 6, a schematic diagram of the smallest rectangle is provided. Referring to Figure 6, the two sides 0-3 and 1-2 are horizontally inclined sides. The coordinates 0 and 3 on the side 0-3 are the coordinates of the adjacent vertices. Coordinates 1 and 2 on sides 1-2 are the coordinates of adjacent vertices. Take the 0-3 side shown in Figure 5 as an example, the calculation formula of the inclination angle θ is as follows:
θ=arctan((y0-y3)/(x3-x0))θ=arctan((y0-y3)/(x3-x0))
另外,图5所示的0-3边是坐标0的位置低于坐标3的位置,而当位置相反时,即坐标0的位置位于坐标3之上时,倾斜角度θ的计算公式如下:In addition, the 0-3 side shown in Figure 5 is that the position of coordinate 0 is lower than the position of coordinate 3. When the position is opposite, that is, when the position of coordinate 0 is above coordinate 3, the calculation formula of the inclination angle θ is as follows:
θ=90-(arctan((y0-y3)/(x3-x0)))θ=90-(arctan((y0-y3)/(x3-x0)))
在本实施例中,对坐标进行抽稀之后确定最小矩形,不仅能够去除重复的坐标减少处 理时间,还能精准的得到最小矩形。In this embodiment, after the coordinates are thinned out, the smallest rectangle is determined, which can not only remove repeated coordinates and reduce processing time, but also accurately obtain the smallest rectangle.
应该理解的是,虽然图2-3的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-3中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowchart of FIGS. 2-3 are displayed in sequence as indicated by the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless specifically stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least some of the steps in Figure 2-3 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. These sub-steps or stages The execution order of is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
在其中一个实施例中,如图7所示,提供了一种文本图像处理装置,包括:检测模块702、获取模块704、筛选模块706和旋转模块708,其中:In one of the embodiments, as shown in FIG. 7, a text image processing device is provided, including: a detection module 702, an acquisition module 704, a screening module 706, and a rotation module 708, wherein:
检测模块702,用于将待处理文本图像输入至预设文本检测模型中,利用预设文本检测模型对待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标。The detection module 702 is configured to input the text image to be processed into a preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text.
获取模块704,用于根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度。The obtaining module 704 is configured to obtain the rectangular area and the inclination angle of the smallest rectangle corresponding to each character according to the edge coordinates of each character in the text image to be processed.
筛选模块706,用于基于各文字最小矩形的矩形面积和倾斜角度对各文字进行筛选,得到无异常文字。The screening module 706 is used for screening each text based on the rectangular area and the inclination angle of the smallest rectangle of each text to obtain no abnormal text.
旋转模块708,用于根据无异常文字的平均倾斜角度将待处理文本图像进行反向旋转,得到文本图像。The rotation module 708 is configured to reversely rotate the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain the text image.
在其中一个实施例中,获取模块704还用于对待处理文本图像中各文字的边缘坐标进行抽稀,得到抽稀边缘坐标;连接各抽稀边缘坐标,得到坐标多边形;遍历得到与坐标多边形共边的共边外接矩形;从共边外接矩形中确定最小矩形,并获取最小矩形的矩形面积和倾斜角度。In one of the embodiments, the obtaining module 704 is also used to thin out the edge coordinates of each text in the text image to be processed to obtain the thinned edge coordinates; connect the thinned edge coordinates to obtain the coordinate polygon; The co-sided circumscribed rectangle of the sides; determine the smallest rectangle from the co-sided circumscribed rectangle, and obtain the rectangle area and inclination angle of the smallest rectangle.
在其中一个实施例中,获取模块704还用于确定基于最小矩形的水平倾斜边相邻的顶点坐标;根据相邻的顶点坐标的坐标值计算水平面与水平倾斜边的夹角,得到最小矩形的倾斜角度。In one of the embodiments, the acquiring module 704 is also used to determine the coordinates of the adjacent vertices of the horizontally inclined side based on the smallest rectangle; calculate the angle between the horizontal plane and the horizontally inclined side according to the coordinate values of the adjacent vertices to obtain the smallest rectangle slope.
在其中一个实施例中,筛选模块706还用于根据倾斜角度计算各文字的平均倾斜角度;基于平均倾斜角度,剔除倾斜角度不满足角度要求的文字;根据各文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。In one of the embodiments, the filtering module 706 is also used to calculate the average inclination angle of each character based on the inclination angle; based on the average inclination angle, the characters whose inclination angle does not meet the angle requirement are excluded; Select a preset number of characters from the characters required by the angle as no abnormal characters.
在其中一个实施例中,筛选模块706还用于分别计算平均倾斜角度与各文字的倾斜角度的偏差值;获取并剔除偏差值大于阈值的文字。In one of the embodiments, the filtering module 706 is also used to calculate the deviation values of the average tilt angle and the tilt angle of each character respectively; to obtain and eliminate characters whose deviation value is greater than the threshold value.
在其中一个实施例中,旋转模块708还用于确定无异常文字的平均倾斜角度和倾斜方向;将待处理文本向倾斜方向的反方向旋转与平均倾斜角度相同角度,得到文本图像。In one of the embodiments, the rotation module 708 is also used to determine the average tilt angle and tilt direction of the non-abnormal text; rotate the text to be processed in the opposite direction of the tilt direction to the same angle as the average tilt angle to obtain a text image.
在其中一个实施例中,旋转模块708还用于获取待处理文本图像中各像素点的坐标;基于倾斜方向和所述平均倾斜角度将各像素点的坐标进行映射转换,获取坐标映射转换后的像素点组成的图像,得到文本图像。关于文本图像处理装置的具体限定可以参见上文中 对于文本图像处理方法的限定,在此不再赘述。上述文本图像处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。In one of the embodiments, the rotation module 708 is also used to obtain the coordinates of each pixel in the to-be-processed text image; based on the tilt direction and the average tilt angle, the coordinates of each pixel are mapped and transformed to obtain the transformed coordinate mapping An image composed of pixels to get a text image. For the specific limitation of the text image processing device, please refer to the above limitation of the text image processing method, which will not be repeated here. Each module in the above text image processing device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
在其中一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图8示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括存储介质、内存储器,所述存储介质可以是非易失性的,也可以是易失性的。该存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储相关数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种文本图像处理方法。In one of the embodiments, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 8. The computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The storage medium may be non-volatile or volatile. The storage medium stores an operating system, computer readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the storage medium. The database of the computer equipment is used to store relevant data. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer readable instructions are executed by the processor to realize a text image processing method.
本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
一种计算机设备,包括存储器和一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行以下步骤:A computer device includes a memory and one or more processors. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the one or more processors execute the following steps:
将待处理文本图像输入至预设文本检测模型中,利用预设文本检测模型对待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标;Input the text image to be processed into the preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text;
根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度;Obtain the rectangle area and inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed;
基于各文字最小矩形的矩形面积和倾斜角度对各文字进行筛选,得到无异常文字;及Filter each character based on the rectangular area and the inclination angle of the smallest rectangle of each character to obtain no abnormal characters; and
根据无异常文字的平均倾斜角度将待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
对待处理文本图像中各文字的边缘坐标进行抽稀,得到抽稀边缘坐标;Perform thinning of the edge coordinates of each text in the text image to be processed to obtain the thinned edge coordinates;
连接各抽稀边缘坐标,得到坐标多边形;Connect the thinned edge coordinates to obtain the coordinate polygon;
遍历得到与坐标多边形共边的共边外接矩形;及Traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon; and
从共边外接矩形中确定最小矩形,并获取最小矩形的矩形面积和倾斜角度。Determine the smallest rectangle from the circumscribed rectangles with the same sides, and obtain the rectangle area and inclination angle of the smallest rectangle.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
确定基于最小矩形的水平倾斜边相邻的顶点坐标;及Determine the coordinates of the adjacent vertices based on the horizontal oblique side of the smallest rectangle; and
根据相邻的顶点坐标的坐标值计算水平面与水平倾斜边的夹角,得到最小矩形的倾斜角度。The angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
根据倾斜角度计算各文字的平均倾斜角度;Calculate the average inclination angle of each text according to the inclination angle;
基于平均倾斜角度,剔除倾斜角度不满足角度要求的文字;及Based on the average tilt angle, the characters whose tilt angle does not meet the angle requirement are eliminated; and
根据各文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。According to the rectangular area of the smallest rectangle of each character, a preset number of characters are selected from characters that meet the angle requirements as no abnormal characters.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
分别计算平均倾斜角度与各文字的倾斜角度的偏差值;及Calculate the deviation between the average tilt angle and the tilt angle of each character respectively; and
获取并剔除偏差值大于阈值的文字。Obtain and remove the text whose deviation value is greater than the threshold.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
确定无异常文字的平均倾斜角度和倾斜方向;及Determine the average tilt angle and tilt direction of no abnormal text; and
将待处理文本向倾斜方向的反方向旋转与平均倾斜角度相同角度,得到文本图像。Rotate the to-be-processed text in the opposite direction of the oblique direction to the same angle as the average oblique angle to obtain a text image.
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer-readable instructions:
获取待处理文本图像中各像素点的坐标;及Obtain the coordinates of each pixel in the text image to be processed; and
基于倾斜方向和所述平均倾斜角度将各像素点的坐标进行映射转换,获取坐标映射转换后的像素点组成的图像,得到文本图像。The coordinates of each pixel point are mapped and converted based on the tilt direction and the average tilt angle, and an image composed of pixels after the coordinate mapping conversion is obtained to obtain a text image.
一个或多个存储有计算机可读指令的计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:One or more computer-readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps:
将待处理文本图像输入至预设文本检测模型中,利用预设文本检测模型对待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标。Input the text image to be processed into the preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text.
根据待处理文本图像中各文字的边缘坐标获取各文字对应最小矩形的矩形面积和倾斜角度;Obtain the rectangle area and inclination angle of the smallest rectangle corresponding to each text according to the edge coordinates of each text in the text image to be processed;
基于各文字最小矩形的矩形面积和倾斜角度对各文字进行筛选,得到无异常文字;及Filter each character based on the rectangular area and the inclination angle of the smallest rectangle of each character to obtain no abnormal characters; and
根据无异常文字的平均倾斜角度将待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain the text image.
其中,该计算机可读存储介质可以是非易失性,也可以是易失性的。Wherein, the computer-readable storage medium may be non-volatile or volatile.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
对待处理文本图像中各文字的边缘坐标进行抽稀,得到抽稀边缘坐标;Perform thinning of the edge coordinates of each text in the text image to be processed to obtain the thinned edge coordinates;
连接各抽稀边缘坐标,得到坐标多边形;Connect the thinned edge coordinates to obtain the coordinate polygon;
遍历得到与坐标多边形共边的共边外接矩形;及Traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon; and
从共边外接矩形中确定最小矩形,并获取最小矩形的矩形面积和倾斜角度。Determine the smallest rectangle from the circumscribed rectangles with the same sides, and obtain the rectangle area and inclination angle of the smallest rectangle.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
确定基于最小矩形的水平倾斜边相邻的顶点坐标;及Determine the coordinates of the adjacent vertices based on the horizontal oblique side of the smallest rectangle; and
根据相邻的顶点坐标的坐标值计算水平面与水平倾斜边的夹角,得到最小矩形的倾斜角度。The angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
根据倾斜角度计算各文字的平均倾斜角度;Calculate the average inclination angle of each text according to the inclination angle;
基于平均倾斜角度,剔除倾斜角度不满足角度要求的文字;及Based on the average tilt angle, the characters whose tilt angle does not meet the angle requirement are eliminated; and
根据各文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为 无异常文字。According to the rectangular area of the smallest rectangle of each character, select a preset number of characters from the characters that meet the angle requirements as no abnormal characters.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
分别计算平均倾斜角度与各文字的倾斜角度的偏差值;及Calculate the deviation between the average tilt angle and the tilt angle of each character respectively; and
获取并剔除偏差值大于阈值的文字。Obtain and remove the text whose deviation value is greater than the threshold.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
确定无异常文字的平均倾斜角度和倾斜方向;及Determine the average tilt angle and tilt direction of no abnormal text; and
将待处理文本向倾斜方向的反方向旋转与平均倾斜角度相同角度,得到文本图像。Rotate the to-be-processed text in the opposite direction of the oblique direction to the same angle as the average oblique angle to obtain a text image.
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:In one of the embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented:
获取待处理文本图像中各像素点的坐标;及Obtain the coordinates of each pixel in the text image to be processed; and
基于倾斜方向和所述平均倾斜角度将各像素点的坐标进行映射转换,获取坐标映射转换后的像素点组成的图像,得到文本图像。The coordinates of each pixel point are mapped and converted based on the tilt direction and the average tilt angle, and an image composed of pixels after the coordinate mapping conversion is obtained to obtain a text image.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage. In the medium, when the computer-readable instructions are executed, they may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database, or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered as the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the invention patent. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can be made, and these all fall within the protection scope of this application. Therefore, the scope of protection of the patent of this application shall be subject to the appended claims.

Claims (20)

  1. 一种文本图像处理方法,方法包括:A text image processing method, the method includes:
    将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
    根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
    基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
    根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  2. 根据权利要求1所述的方法,其中,所述根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度,包括:The method according to claim 1, wherein the obtaining the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters according to the edge coordinates of each of the characters in the to-be-processed text image comprises:
    对所述待处理文本图像中各所述文字的边缘坐标进行抽稀,得到抽稀边缘坐标;Thinning out the edge coordinates of each text in the to-be-processed text image to obtain thinning edge coordinates;
    连接各所述抽稀边缘坐标,得到坐标多边形;Connect each of the thinned edge coordinates to obtain a coordinate polygon;
    遍历得到与所述坐标多边形共边的共边外接矩形;及Traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon; and
    从所述共边外接矩形中确定最小矩形,并获取所述最小矩形的矩形面积和倾斜角度。The smallest rectangle is determined from the circumscribed rectangles with the same sides, and the rectangle area and the inclination angle of the smallest rectangle are obtained.
  3. 根据权利要求1或2所述的方法,其中,所述获取所述最小矩形的倾斜角度,包括:The method according to claim 1 or 2, wherein the obtaining the inclination angle of the smallest rectangle comprises:
    确定基于所述最小矩形的水平倾斜边相邻的顶点坐标;及Determining the coordinates of the adjacent vertices based on the horizontal oblique side of the smallest rectangle; and
    根据相邻的所述顶点坐标的坐标值计算水平面与所述水平倾斜边的夹角,得到最小矩形的倾斜角度。The angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
  4. 根据权利要求1所述的方法,其中,所述基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行筛选,得到无异常文字,包括:The method according to claim 1, wherein the filtering each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters, comprising:
    根据所述倾斜角度计算各所述文字的平均倾斜角度;Calculating the average inclination angle of each of the characters according to the inclination angle;
    基于所述平均倾斜角度,剔除所述倾斜角度不满足角度要求的文字;及Based on the average inclination angle, reject the characters whose inclination angle does not meet the angle requirement; and
    根据各所述文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。According to the rectangular area of the smallest rectangle of each of the characters, a preset number of characters are selected from characters that meet the angle requirement as no abnormal characters.
  5. 根据权利要求4所述的方法,其中,所述基于所述平均倾斜角度,剔除所述倾斜角度不满足角度要求的文字,包括:5. The method according to claim 4, wherein the removing the characters whose inclination angle does not meet the angle requirement based on the average inclination angle comprises:
    分别计算所述平均倾斜角度与各所述文字的倾斜角度的偏差值;及Respectively calculating the deviation value of the average inclination angle and the inclination angle of each of the characters; and
    获取并剔除所述偏差值大于阈值的文字。Acquire and eliminate the characters whose deviation value is greater than the threshold value.
  6. 根据权利要求1所述的方法,其中,所述根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像,包括:The method according to claim 1, wherein the reversely rotating the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain the text image comprises:
    确定所述无异常文字的平均倾斜角度和倾斜方向;及Determine the average tilt angle and tilt direction of the non-abnormal text; and
    将所述待处理文本图像向所述倾斜方向的反方向旋转与所述平均倾斜角度相同角度, 得到文本图像。Rotate the to-be-processed text image to the opposite direction of the tilt direction by the same angle as the average tilt angle to obtain the text image.
  7. 根据权利要求6所述的方法,其中,所述将所述待处理文本图像向所述倾斜方向的反方向旋转与所述平均倾斜角度相同角度,得到文本图像,包括:8. The method according to claim 6, wherein said rotating the to-be-processed text image in the opposite direction of the tilt direction to the same angle as the average tilt angle to obtain the text image comprises:
    获取所述待处理文本图像中各像素点的坐标;及Obtaining the coordinates of each pixel in the to-be-processed text image; and
    基于所述倾斜方向和所述平均倾斜角度将各所述像素点的坐标进行映射转换,获取坐标映射转换后的像素点组成的图像,得到文本图像。The coordinates of each pixel point are mapped and converted based on the tilt direction and the average tilt angle, and an image composed of pixels after the coordinate mapping conversion is obtained to obtain a text image.
  8. 一种文本图像处理装置,其中,包括:A text image processing device, which includes:
    检测模块,用于将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行边缘检测,得到文字的边缘坐标;The detection module is configured to input the text image to be processed into a preset text detection model, and use the preset text detection model to perform edge detection on the text in the text image to be processed to obtain the edge coordinates of the text;
    获取模块,用于根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;An obtaining module, configured to obtain the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters according to the edge coordinates of each of the characters in the to-be-processed text image;
    筛选模块,用于基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行筛选,得到无异常文字;及The screening module is used to screen each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
    旋转模块,用于根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The rotation module is configured to reversely rotate the to-be-processed text image according to the average inclination angle of the non-abnormal text to obtain a text image.
  9. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器存储有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device includes a memory and one or more processors. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the one or more processors, the one or more The processor performs the following steps:
    将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
    根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
    基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
    根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  10. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 9, wherein the processor further executes the following steps when executing the computer readable instruction:
    对所述待处理文本图像中各所述文字的边缘坐标进行抽稀,得到抽稀边缘坐标;Thinning out the edge coordinates of each text in the to-be-processed text image to obtain thinning out edge coordinates;
    连接各所述抽稀边缘坐标,得到坐标多边形;Connect each of the thinned edge coordinates to obtain a coordinate polygon;
    遍历得到与所述坐标多边形共边的共边外接矩形;及Traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon; and
    从所述共边外接矩形中确定最小矩形,并获取所述最小矩形的矩形面积和倾斜角度。The smallest rectangle is determined from the circumscribed rectangles with the same sides, and the rectangle area and the inclination angle of the smallest rectangle are obtained.
  11. 根据权利要求9或10所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 9 or 10, wherein the processor further executes the following steps when executing the computer readable instruction:
    确定基于所述最小矩形的水平倾斜边相邻的顶点坐标;及Determining the coordinates of the adjacent vertices based on the horizontal oblique side of the smallest rectangle; and
    根据相邻的所述顶点坐标的坐标值计算水平面与所述水平倾斜边的夹角,得到最小矩形的倾斜角度。The angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
  12. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 9, wherein the processor further executes the following steps when executing the computer readable instruction:
    根据所述倾斜角度计算各所述文字的平均倾斜角度;Calculating the average inclination angle of each of the characters according to the inclination angle;
    基于所述平均倾斜角度,剔除所述倾斜角度不满足角度要求的文字;及Based on the average inclination angle, reject the characters whose inclination angle does not meet the angle requirement; and
    根据各所述文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。According to the rectangular area of the smallest rectangle of each of the characters, a preset number of characters are selected from characters that meet the angle requirement as no abnormal characters.
  13. 根据权利要求12所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 12, wherein the processor further executes the following steps when executing the computer readable instruction:
    分别计算所述平均倾斜角度与各所述文字的倾斜角度的偏差值;及Respectively calculating the deviation value of the average inclination angle and the inclination angle of each of the characters; and
    获取并剔除所述偏差值大于阈值的文字。Acquire and eliminate the characters whose deviation value is greater than the threshold value.
  14. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 9, wherein the processor further executes the following steps when executing the computer readable instruction:
    确定所述无异常文字的平均倾斜角度和倾斜方向;及Determine the average tilt angle and tilt direction of the non-abnormal text; and
    将所述待处理文本图像向所述倾斜方向的反方向旋转与所述平均倾斜角度相同角度,得到文本图像。Rotate the to-be-processed text image to the opposite direction of the tilt direction by the same angle as the average tilt angle to obtain the text image.
  15. 一个或多个存储有计算机可读指令的计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more computer-readable storage media storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the following steps:
    将待处理文本图像输入至预设文本检测模型中,利用所述预设文本检测模型对所述待处理文本图像中的文字进行检测,得到文字的边缘坐标;Input the text image to be processed into a preset text detection model, and use the preset text detection model to detect the text in the text image to be processed to obtain the edge coordinates of the text;
    根据所述待处理文本图像中各所述文字的边缘坐标获取各所述文字对应最小矩形的矩形面积和倾斜角度;Acquiring, according to the edge coordinates of each of the characters in the to-be-processed text image, the rectangular area and the inclination angle of the smallest rectangle corresponding to each of the characters;
    基于各所述文字最小矩形的矩形面积和倾斜角度对各所述文字进行异常筛选,得到无异常文字;及Perform abnormal screening on each of the characters based on the rectangular area and the inclination angle of the smallest rectangle of each of the characters to obtain no abnormal characters; and
    根据所述无异常文字的平均倾斜角度将所述待处理文本图像进行反向旋转,得到文本图像。The text image to be processed is reversely rotated according to the average inclination angle of the non-abnormal text to obtain a text image.
  16. 根据权利要求15所述的存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 15, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:
    对所述待处理文本图像中各所述文字的边缘坐标进行抽稀,得到抽稀边缘坐标;Thinning out the edge coordinates of each text in the to-be-processed text image to obtain thinning out edge coordinates;
    连接各所述抽稀边缘坐标,得到坐标多边形;Connect each of the thinned edge coordinates to obtain a coordinate polygon;
    遍历得到与所述坐标多边形共边的共边外接矩形;及Traverse to obtain a co-sided circumscribed rectangle that is co-sided with the coordinate polygon; and
    从所述共边外接矩形中确定最小矩形,并获取所述最小矩形的矩形面积和倾斜角度。The smallest rectangle is determined from the circumscribed rectangles with the same sides, and the rectangle area and the inclination angle of the smallest rectangle are obtained.
  17. 根据权利要求15或16所述的存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 15 or 16, wherein the following steps are further executed when the computer-readable instructions are executed by the processor:
    确定基于所述最小矩形的水平倾斜边相邻的顶点坐标;及Determining the coordinates of the adjacent vertices based on the horizontal oblique side of the smallest rectangle; and
    根据相邻的所述顶点坐标的坐标值计算水平面与所述水平倾斜边的夹角,得到最小矩形的倾斜角度。The angle between the horizontal plane and the horizontal inclined side is calculated according to the coordinate values of the adjacent vertex coordinates to obtain the inclination angle of the smallest rectangle.
  18. 根据权利要求15所述的存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 15, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:
    根据所述倾斜角度计算各所述文字的平均倾斜角度;Calculating the average inclination angle of each of the characters according to the inclination angle;
    基于所述平均倾斜角度,剔除所述倾斜角度不满足角度要求的文字;及Based on the average inclination angle, reject the characters whose inclination angle does not meet the angle requirement; and
    根据各所述文字最小矩形的矩形面积,从满足角度要求的文字中选择预设数量的文字作为无异常文字。According to the rectangular area of the smallest rectangle of each of the characters, a preset number of characters are selected from characters that meet the angle requirement as no abnormal characters.
  19. 根据权利要求18所述的存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 18, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:
    分别计算所述平均倾斜角度与各所述文字的倾斜角度的偏差值;及Respectively calculating the deviation value of the average inclination angle and the inclination angle of each of the characters; and
    获取并剔除所述偏差值大于阈值的文字。Acquire and eliminate the characters whose deviation value is greater than the threshold value.
  20. 根据权利要求15所述的存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 15, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:
    确定所述无异常文字的平均倾斜角度和倾斜方向;及Determine the average tilt angle and tilt direction of the non-abnormal text; and
    将所述待处理文本图像向所述倾斜方向的反方向旋转与所述平均倾斜角度相同角度,得到文本图像。Rotate the to-be-processed text image to the opposite direction of the tilt direction by the same angle as the average tilt angle to obtain the text image.
PCT/CN2020/098060 2020-02-27 2020-06-24 Text image processing method and apparatus, and computer device and storage medium WO2021169102A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010123338.1A CN111353489A (en) 2020-02-27 2020-02-27 Text image processing method and device, computer equipment and storage medium
CN202010123338.1 2020-02-27

Publications (1)

Publication Number Publication Date
WO2021169102A1 true WO2021169102A1 (en) 2021-09-02

Family

ID=71194058

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/098060 WO2021169102A1 (en) 2020-02-27 2020-06-24 Text image processing method and apparatus, and computer device and storage medium

Country Status (2)

Country Link
CN (1) CN111353489A (en)
WO (1) WO2021169102A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112418238A (en) * 2020-12-09 2021-02-26 安徽吉秒科技有限公司 Image character recognition method and device
CN112651399B (en) * 2020-12-30 2024-05-14 中国平安人寿保险股份有限公司 Method for detecting same-line characters in inclined image and related equipment thereof
CN112686162B (en) * 2020-12-31 2023-12-15 鄂尔多斯市空港大数据运营有限公司 Method, device, equipment and storage medium for detecting clean state of warehouse environment
CN113420762B (en) * 2021-07-01 2024-02-06 京东科技控股股份有限公司 Image processing method, system, electronic equipment and storage medium
CN113505741B (en) * 2021-07-27 2024-04-09 京东科技控股股份有限公司 Text image processing method and device, electronic equipment and storage medium
CN114782587B (en) * 2022-06-16 2022-09-02 深圳市国人光速科技有限公司 Jet printing image processing method and jet printing system for solving jet printing linear step pixel
CN115331231B (en) * 2022-08-17 2023-05-05 北京睿企信息科技有限公司 Method for identifying target text based on text, electronic equipment and storage medium
CN115359493B (en) * 2022-10-08 2023-09-08 深圳比特微电子科技有限公司 Method and device for detecting rotary text

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140161365A1 (en) * 2012-12-12 2014-06-12 Qualcomm Incorporated Method of Perspective Correction For Devanagari Text
US20170053184A1 (en) * 2015-08-20 2017-02-23 Xerox Corporation Methods and systems for estimating skew angle of an image
CN107169489A (en) * 2017-05-08 2017-09-15 北京京东金融科技控股有限公司 The method and apparatus of tilted image correction
CN109948521A (en) * 2019-03-18 2019-06-28 北京华宇信息技术有限公司 Image correcting error method and device, equipment and storage medium
CN110020676A (en) * 2019-03-18 2019-07-16 华南理工大学 Method for text detection, system, equipment and medium based on more receptive field depth characteristics

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140161365A1 (en) * 2012-12-12 2014-06-12 Qualcomm Incorporated Method of Perspective Correction For Devanagari Text
US20170053184A1 (en) * 2015-08-20 2017-02-23 Xerox Corporation Methods and systems for estimating skew angle of an image
CN107169489A (en) * 2017-05-08 2017-09-15 北京京东金融科技控股有限公司 The method and apparatus of tilted image correction
CN109948521A (en) * 2019-03-18 2019-06-28 北京华宇信息技术有限公司 Image correcting error method and device, equipment and storage medium
CN110020676A (en) * 2019-03-18 2019-07-16 华南理工大学 Method for text detection, system, equipment and medium based on more receptive field depth characteristics

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JIANG YI, PENG QINGCHANG, XU JUAN: "Analyse of Algorithm to OCR Image Slant Correction based on Primitive Recognition", CHINA NEW TECHNOLOGIES AND PRODUCTS, CHINA PRIVATE SCIENCE AND TECHNOLOGY PROMOTION ASSOCIATION, CN, no. 2, 30 January 2019 (2019-01-30), CN, pages 7 - 8, XP055841794, ISSN: 1673-9957, DOI: 10.13612/j.cnki.cntp.2019.02.002 *

Also Published As

Publication number Publication date
CN111353489A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
WO2021169102A1 (en) Text image processing method and apparatus, and computer device and storage medium
WO2021017261A1 (en) Recognition model training method and apparatus, image recognition method and apparatus, and device and medium
WO2020199906A1 (en) Facial keypoint detection method, apparatus and device, and storage medium
US11636604B2 (en) Edge detection method and device, electronic equipment, and computer-readable storage medium
WO2021012382A1 (en) Method and apparatus for configuring chat robot, computer device and storage medium
CN110852310B (en) Three-dimensional face recognition method and device, terminal equipment and computer readable medium
WO2021068325A1 (en) Facial action recognition model training method, facial action recognition method and apparatus, computer device, and storage medium
WO2021175180A1 (en) Line of sight determination method and apparatus, and electronic device and computer-readable storage medium
CN109753838A (en) Two-dimensional code identification method, device, computer equipment and storage medium
US11875599B2 (en) Method and device for detecting blurriness of human face in image and computer-readable storage medium
US11900676B2 (en) Method and apparatus for detecting target in video, computing device, and storage medium
US20220215507A1 (en) Image stitching
CN112991180B (en) Image stitching method, device, equipment and storage medium
WO2023284608A1 (en) Character recognition model generating method and apparatus, computer device, and storage medium
WO2022002262A1 (en) Character sequence recognition method and apparatus based on computer vision, and device and medium
WO2021189770A1 (en) Image enhancement processing method and apparatus based on artificial intelligence, and device and medium
WO2021151319A1 (en) Card edge detection method, apparatus, and device, and readable storage medium
JP7121132B2 (en) Image processing method, apparatus and electronic equipment
US20230343137A1 (en) Method and apparatus for detecting key point of image, computer device and storage medium
CN112651399A (en) Method for detecting same-line characters in oblique image and related equipment thereof
US11270152B2 (en) Method and apparatus for image detection, patterning control method
CN113344961B (en) Image background segmentation method, device, computing equipment and storage medium
US11687886B2 (en) Method and device for identifying number of bills and multiple bill areas in image
CN114862866A (en) Calibration plate detection method and device, computer equipment and storage medium
CN111860372A (en) Artificial intelligence-based expression package generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20921516

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.01.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20921516

Country of ref document: EP

Kind code of ref document: A1