CN111832371A - Text and picture correction method, device, electronic device and machine-readable storage medium - Google Patents
Text and picture correction method, device, electronic device and machine-readable storage medium Download PDFInfo
- Publication number
- CN111832371A CN111832371A CN201910330806.XA CN201910330806A CN111832371A CN 111832371 A CN111832371 A CN 111832371A CN 201910330806 A CN201910330806 A CN 201910330806A CN 111832371 A CN111832371 A CN 111832371A
- Authority
- CN
- China
- Prior art keywords
- text
- picture
- text line
- curve
- position information
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/41—Analysis of document content
- G06V30/414—Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/146—Aligning or centring of the image pick-up or image-field
- G06V30/1475—Inclination or skew detection or correction of characters or of image to be recognised
- G06V30/1478—Inclination or skew detection or correction of characters or of image to be recognised of characters or characters lines
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/43—Editing text-bitmaps, e.g. alignment, spacing; Semantic analysis of bitmaps of text without OCR
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Artificial Intelligence (AREA)
- Character Input (AREA)
- Image Processing (AREA)
Abstract
本发明实施例提供了一种文本图片矫正方法、装置、电子设备及机器可读存储介质,该方法包括:获取待矫正的文本图片;对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息;根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线;基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。应用本发明实施例,能够实现对文本图片中扭曲的文本内容的矫正,提高用户的阅读体验。
Embodiments of the present invention provide a text picture correction method, device, electronic device, and machine-readable storage medium. The method includes: acquiring a text picture to be corrected; performing text line detection on the text picture to obtain each text line of the text picture The specified point position information of multiple characters in each text line; according to the specified point position information of multiple characters in each text line, the distortion curve of each text line is calculated; based on the distortion curve of each text line, the text picture is corrected and mapped, and the corrected text picture. By applying the embodiments of the present invention, the distorted text content in the text picture can be corrected, and the user's reading experience can be improved.
Description
技术领域technical field
本发明涉及图像处理技术领域,特别是涉及一种文本图片矫正方法、装置、电子设备及机器可读存储介质。The present invention relates to the technical field of image processing, and in particular, to a text and picture correction method, device, electronic device and machine-readable storage medium.
背景技术Background technique
随着电子技术的发展,经常需要对纸质文本进行拍照或扫描,以满足人们便于对文本进行查看、共享文本内容等需求。然而,在对纸质文本进行拍照或者扫描时,由于书籍等载体存在一定的厚度,无法避免拍摄或者扫描的文本图片中的文本内容会出现扭曲,影响人们的阅读体验。With the development of electronic technology, it is often necessary to photograph or scan paper texts to meet people's needs for easy viewing of texts and sharing of text content. However, when photographing or scanning paper texts, due to the thickness of books and other carriers, it is unavoidable that the text content in the photographed or scanned text images will be distorted, affecting people's reading experience.
发明内容SUMMARY OF THE INVENTION
本发明实施例的目的在于提供一种文本图片矫正方法、装置、电子设备及机器可读存储介质,以实现对文本图片中扭曲的文本内容的矫正,提高阅读体验。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a text picture correction method, device, electronic device and machine-readable storage medium, so as to correct the distorted text content in the text picture and improve the reading experience. The specific technical solutions are as follows:
第一方面,本发明实施例提供了一种文本图片矫正方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a text picture correction method, the method comprising:
获取待矫正的文本图片;Get the text image to be corrected;
对所述文本图片进行文本行检测,得到所述文本图片的各文本行中多个字符的指定点位置信息;Perform text line detection on the text picture, and obtain designated point position information of multiple characters in each text line of the text picture;
根据所述各文本行中多个字符的指定点位置信息,计算所述各文本行的扭曲曲线;Calculate the distortion curve of each text line according to the specified point position information of the multiple characters in each text line;
基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片。Correction mapping is performed on the text picture based on the distortion curve of each text line to obtain a corrected text picture.
优选地,所述对文本图片进行文本行检测,得到所述文本图片的各文本行中多个字符的指定点位置信息,包括:Preferably, the text line detection is performed on the text picture to obtain the specified point position information of multiple characters in each text line of the text picture, including:
对所述文本图片进行文档区域检测,得到所述文本图片中文档区域的检测框坐标;Perform document area detection on the text picture to obtain the coordinates of the detection frame of the document area in the text picture;
根据所述检测框坐标,从所述文档区域中,检测得到所述文档区域的各文本行中多个字符的指定点位置信息。According to the coordinates of the detection frame, the specified point position information of a plurality of characters in each text line of the document area is detected and obtained from the document area.
优选地,所述根据所述各文本行中多个字符的指定点位置信息,计算所述各文本行的扭曲曲线,包括:Preferably, calculating the distortion curve of each text line according to the specified point position information of multiple characters in each text line includes:
构建初始化曲线;Build an initialization curve;
根据所述各文本行中多个字符的指定点位置信息,计算所述指定点位置信息中的第一纵坐标与所述初始化曲线上的第二纵坐标的误差值,构建所述各文本行相应于所述初始化曲线的误差函数,所述第二纵坐标为所述初始化曲线上与所述指定位置信息中相同的横坐标对应的纵坐标;Calculate the error value between the first ordinate in the specified point position information and the second ordinate on the initialization curve according to the specified point position information of the characters in each text line, and construct each text line Corresponding to the error function of the initialization curve, the second ordinate is the ordinate corresponding to the same abscissa in the specified position information on the initialization curve;
根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线。According to the error function of each text line corresponding to the initialization curve, through curve fitting, the distortion curve of each text line is obtained.
优选地,所述根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线,包括:Preferably, according to the error function of each text line corresponding to the initialization curve, through curve fitting, the distortion curve of each text line is obtained, including:
对所述各文本行相应于所述初始化曲线的误差函数进行最小化运算,拟合得到所述各文本行的扭曲曲线。A minimization operation is performed on the error function of each text line corresponding to the initialization curve, and the distortion curve of each text line is obtained by fitting.
优选地,所述基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片,包括:Preferably, the correction mapping is performed on the text picture based on the distortion curve of each text line to obtain a corrected text picture, including:
将所述各文本行的扭曲曲线组成三维网格,构成扭曲曲面;Composing the twisted curves of each text line into a three-dimensional grid to form a twisted surface;
将所述扭曲曲面映射至平面图片,得到矫正后的文本图片。The distorted surface is mapped to a flat picture to obtain a corrected text picture.
优选地,在所述基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片之后,所述方法还包括:Preferably, after the text picture is corrected and mapped based on the distortion curve of each text line to obtain the corrected text picture, the method further includes:
采用字符识别技术,识别所述矫正后的文本图片中的各字符。Character recognition technology is used to recognize each character in the corrected text picture.
第二方面,本发明实施例提供了一种文本图片矫正装置,包括:In a second aspect, an embodiment of the present invention provides a text picture correction device, including:
获取模块,用于获取待矫正的文本图片;The acquisition module is used to acquire the text image to be corrected;
检测模块,用于对所述文本图片进行文本行检测,得到所述文本图片的各文本行中多个字符的指定点位置信息;a detection module, configured to perform text line detection on the text picture, and obtain designated point position information of multiple characters in each text line of the text picture;
计算模块,用于根据所述各文本行中多个字符的指定点位置信息,计算所述各文本行的扭曲曲线;a calculation module, configured to calculate the distortion curve of each text line according to the specified point position information of a plurality of characters in each text line;
矫正模块,用于基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片。The correction module is configured to perform correction mapping on the text picture based on the distortion curve of each text line to obtain a corrected text picture.
优选地,所述检测模块,具体用于:Preferably, the detection module is specifically used for:
对所述文本图片进行文档区域检测,得到所述文本图片中文档区域的检测框坐标;Perform document area detection on the text picture to obtain the coordinates of the detection frame of the document area in the text picture;
根据所述检测框坐标,从所述文档区域中,检测得到所述文档区域的各文本行中多个字符的指定点位置信息。According to the coordinates of the detection frame, the specified point position information of a plurality of characters in each text line of the document area is detected and obtained from the document area.
优选地,所述计算模块,具体用于:Preferably, the computing module is specifically used for:
构建初始化曲线;Build an initialization curve;
根据所述各文本行中多个字符的指定点位置信息,计算所述指定点位置信息中的第一纵坐标与所述初始化曲线上的第二纵坐标的误差值,构建所述各文本行相应于所述初始化曲线的误差函数,所述第二纵坐标为所述初始化曲线上与所述指定位置信息中相同的横坐标对应的纵坐标;Calculate the error value between the first ordinate in the specified point position information and the second ordinate on the initialization curve according to the specified point position information of the characters in each text line, and construct each text line Corresponding to the error function of the initialization curve, the second ordinate is the ordinate corresponding to the same abscissa in the specified position information on the initialization curve;
根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线。According to the error function of each text line corresponding to the initialization curve, through curve fitting, the distortion curve of each text line is obtained.
优选地,所述计算模块在用于所述根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线时,具体用于:Preferably, when the calculation module is used to obtain the distortion curve of each text line through curve fitting according to the error function corresponding to the initialization curve of each text line, it is specifically used for:
对所述各文本行相应于所述初始化曲线的误差函数进行最小化运算,拟合得到所述各文本行的扭曲曲线。A minimization operation is performed on the error function of each text line corresponding to the initialization curve, and the distortion curve of each text line is obtained by fitting.
优选地,所述矫正模块,具体用于:Preferably, the correction module is specifically used for:
将所述各文本行的扭曲曲线组成三维网格,构成扭曲曲面;Composing the twisted curves of each text line into a three-dimensional grid to form a twisted surface;
将所述扭曲曲面映射至平面图片,得到矫正后的文本图片。The distorted surface is mapped to a flat picture to obtain a corrected text picture.
优选地,所述装置还包括:Preferably, the device further comprises:
字符识别模块,用于采用字符识别技术,识别所述矫正后的文本图片中的各字符。The character recognition module is used for using character recognition technology to recognize each character in the corrected text picture.
第三方面,本发明实施例提供了一种电子设备,包括处理器和存储器,其中,In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein,
所述存储器,用于存放计算机程序;the memory for storing computer programs;
所述处理器,用于执行所述存储器上所存放的计算机程序时,实现本发明实施例第一方面所提供的方法。The processor is configured to implement the method provided by the first aspect of the embodiment of the present invention when executing the computer program stored in the memory.
第四方面,本发明实施例提供了一种机器可读存储介质,所述机器可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现本发明实施例第一方面所提供的方法。In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, where a computer program is stored in the machine-readable storage medium, and when the computer program is executed by a processor, the first aspect of the embodiment of the present invention provides Methods.
本发明实施例提供的一种文本图片矫正方法、装置、电子设备及机器可读存储介质,获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。A text picture correction method, device, electronic device, and machine-readable storage medium provided by the embodiments of the present invention acquire a text picture to be corrected, perform text line detection on the text picture, and obtain a plurality of characters in each text line of the text picture According to the specified point position information of each text line, the distortion curve of each text line is calculated according to the specified point position information of multiple characters in each text line, and based on the distortion curve of each text line, the text image is corrected and mapped to obtain the corrected text image. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.
图1为本发明实施例的文本图片矫正方法的流程示意图;1 is a schematic flowchart of a text and picture correction method according to an embodiment of the present invention;
图2为本发明实施例的扭曲曲面示意图;2 is a schematic diagram of a twisted curved surface according to an embodiment of the present invention;
图3(a)为本发明实施例的待矫正图片的展示示意图;Fig. 3 (a) is the display schematic diagram of the picture to be corrected according to the embodiment of the present invention;
图3(b)为本发明实施例的矫正后图片的展示示意图;Fig. 3 (b) is the display schematic diagram of the corrected picture according to the embodiment of the present invention;
图4为本发明实施例的文本图片字符识别的流程示意图;4 is a schematic flowchart of text picture character recognition according to an embodiment of the present invention;
图5(a)为本发明实施例的待矫正图片的展示示意图;Fig. 5 (a) is the display schematic diagram of the picture to be corrected according to the embodiment of the present invention;
图5(b)为本发明实施例的矫正后图片的展示示意图;FIG. 5(b) is a schematic display diagram of a corrected picture according to an embodiment of the present invention;
图6为本发明实施例的文本图片矫正装置的结构示意图;6 is a schematic structural diagram of a text and picture correction device according to an embodiment of the present invention;
图7为本发明实施例的电子设备的结构示意图;7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
图8为本发明实施例的显示系统的结构示意图。FIG. 8 is a schematic structural diagram of a display system according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
为了实现了对文本图片中扭曲的文本内容的矫正,提高用户的阅读体验,本发明实施例提供了一种文本图片矫正方法、装置、电子设备及机器可读存储介质。下面,首先对本发明实施例所提供的文本图片矫正方法进行介绍。In order to correct the distorted text content in the text picture and improve the user's reading experience, the embodiments of the present invention provide a text picture correction method, device, electronic device, and machine-readable storage medium. Below, the text picture correction method provided by the embodiment of the present invention is first introduced.
本发明实施例所提供的文本图片矫正方法的执行主体可以为手机、相机等具有拍摄功能的终端设备;还可以是后台的服务器,在图像采集设备拍摄到文本图片后发送到后台服务器进行矫正;还可以是显示设备,在图像采集设备拍摄到文本图片后发送到显示设备进行矫正并显示。实现本发明实施例所提供的文本图片矫正方法的方式可以为设置于执行主体中的软件、硬件电路和逻辑电路中的至少一种方式。The execution subject of the text picture correction method provided by the embodiment of the present invention may be a terminal device with a shooting function, such as a mobile phone and a camera; it may also be a server in the background, and after the text picture is captured by the image acquisition device, it is sent to the background server for correction; It can also be a display device, after the text picture captured by the image acquisition device is sent to the display device for correction and display. The manner of implementing the text and picture correction method provided by the embodiment of the present invention may be at least one manner of software, hardware circuit and logic circuit provided in the execution body.
如图1所示,本发明实施例所提供的文本图片矫正方法的流程示意图,该方法可以包括如下步骤:As shown in FIG. 1 , a schematic flowchart of a text and picture correction method provided by an embodiment of the present invention, the method may include the following steps:
S101,获取待矫正的文本图片。S101, acquiring a text picture to be corrected.
待矫正的文本图片为所包含的图片内容中,文本内容存在扭曲现象的文本图片。本发明实施例的执行主体可以在接收到用户输入矫正需求时,从存储介质中获取用户指定的待矫正的文本图片进行矫正操作;也可以是执行主体针对于实时采集的文本图片,在自动识别到文本图片中存在扭曲现象时,开始获取待矫正的文本图片进行矫正操作。The text image to be corrected is a text image in which the text content is distorted in the included image content. The execution body of the embodiment of the present invention may, when receiving the correction request input by the user, obtain the text picture to be corrected specified by the user from the storage medium to perform the correction operation; When there is distortion in the text picture, start to acquire the text picture to be corrected and perform the correction operation.
S102,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息。S102: Perform text line detection on the text picture to obtain designated point position information of multiple characters in each text line of the text picture.
对于文本图片,可以采用传统的文本行检测技术,对文本图片中的各文本行进行检测,传统的文本行检测技术主要是通过对字符进行检测,在检测出各文本行中的字符后,输入字符的指定点位置信息,字符的指定点位置信息可以由算法的设定决定,可以是字符底部中点的位置信息、顶部中点的位置信息、字符的中心点的位置信息等等。For text pictures, the traditional text line detection technology can be used to detect each text line in the text picture. The traditional text line detection technology mainly detects characters. After detecting the characters in each text line, input The position information of the specified point of the character, the position information of the specified point of the character can be determined by the setting of the algorithm, which can be the position information of the bottom middle point of the character, the position information of the top middle point, the position information of the center point of the character, and so on.
由于在拍摄文本图片时,受拍摄角度、聚焦范围等影响,文本图片中可能不仅仅包含文本文档所处的区域,还可能包含有其他非文档区域的内容。为了提高文本行检测的效率,减少非文档区域的内容对文本行检测结果的影响,优选地,S102具体可以通过如下步骤实现:Due to the influence of the shooting angle, focus range, etc., when taking a text picture, the text picture may not only include the area where the text document is located, but may also include content in other non-document areas. In order to improve the efficiency of text line detection and reduce the influence of the content of the non-document area on the text line detection result, preferably, S102 can be specifically implemented by the following steps:
第一步,对文本图片进行文档区域检测,得到文本图片中文档区域的检测框坐标。The first step is to perform document area detection on the text image to obtain the coordinates of the detection frame of the document area in the text image.
第二步,根据检测框坐标,从文档区域中,检测得到文档区域的各文本行中多个字符的指定点位置信息。In the second step, according to the coordinates of the detection frame, from the document area, the designated point position information of the multiple characters in each text line in the document area is detected and obtained.
对于获取到的待矫正的文本图片,首先可以对文本图片进行文档区域检测,检测出文本图片中的文档区域,进行文档区域检测的方法,可以采用特征匹配算法、深度学习算法等实现,为了保证检测的精度和计算效率,通常可以选择深度学习算法进行文档区域检测,通过检测可以得到文档区域的检测框坐标,其中,深度学习算法可以为现有的应用于文档识别的卷积神经网络(Convolutional Neural Network,CNN)、循环神经网络(RecurrentNeural Network,RNN)等算法,所采用的算法可以识别文本图片中的文档内容即可,这里不做详细的限定。For the acquired text image to be corrected, firstly, the document area detection can be performed on the text image, the document area in the text image can be detected, and the document area detection method can be realized by using a feature matching algorithm, a deep learning algorithm, etc., in order to ensure The detection accuracy and computational efficiency can usually be performed by selecting a deep learning algorithm for document area detection. Through the detection, the detection frame coordinates of the document area can be obtained. Neural Network, CNN), Recurrent Neural Network (Recurrent Neural Network, RNN) and other algorithms, the algorithm used can identify the document content in the text image, and there is no detailed limitation here.
检测框坐标可以是文档区域所处的检测框的四个顶点的坐标,代表了检测框在文本图片中的具体位置,这样,根据检测框坐标,以及文档区域中各文本行中字符相距于检测框的距离,换算出字符的指定点位置信息。示例性的,以检测框左下角为原点,根据字符的指定点位置相对于检测框左下角位置的距离,标记出指定点位置信息。The coordinates of the detection frame can be the coordinates of the four vertices of the detection frame where the document area is located, which represent the specific position of the detection frame in the text picture. The distance of the box is converted to the specified point position information of the character. Exemplarily, with the lower left corner of the detection frame as the origin, the specified point position information is marked according to the distance between the position of the specified point of the character relative to the position of the lower left corner of the detection frame.
在具体的文本行检测方法中,首先可以采用连通域的识别方式识别出可能的字符候选框,同时根据字符候选框的识别结果计算出所有字符的平均高度,过滤掉一些太大和太小的字符候选框,输出保留下来的各字符的候选框中底部边的中心点位置信息作为字符的指定点位置信息。In the specific text line detection method, the connected domain recognition method can be used to identify possible character candidate boxes, and at the same time, the average height of all characters is calculated according to the recognition results of the character candidate boxes, and some characters that are too large and too small are filtered out. Candidate frame, output the position information of the center point of the bottom edge of the candidate frame of each remaining character as the specified point position information of the character.
S103,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线。S103: Calculate the distortion curve of each text line according to the designated point position information of the multiple characters in each text line.
在检测得到各文本行中多个字符的指定点位置信息后,字符的指定点位置信息表征了字符在文本行中的位置,通过对一个文本行中多个字符的指定点进行连线,或者,更进一步的,对一个文本行中多个字符的指定点的连线进行拟合,即可得到该文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,扭曲曲线波动越大,则文本行的扭曲程度越严重。After detecting and obtaining the designated point position information of multiple characters in each text line, the designated point position information of the character represents the position of the character in the text line, by connecting the designated points of multiple characters in a text line, or , and further, by fitting the connection lines of the specified points of multiple characters in a text line, the distortion curve of the text line can be obtained. The distortion curve represents the distortion of the text line. The larger the distortion curve fluctuation, the The more distorted the lines of text are.
如果在检测得到各文本行中多个字符的指定点位置信息后,直接将一个文本行中多个字符的指定点连接起来作为扭曲曲线,受连线规则的限制,扭曲曲线与实际的文本行扭曲情况之间往往存在误差。为了更为精确的得到各文本行的扭曲曲线,优选地,S103具体可以通过如下步骤实现:If the designated point position information of multiple characters in each text line is detected and obtained, the designated points of multiple characters in one text line are directly connected as a twisted curve, limited by the connection rules, the twisted curve and the actual text line There is often an error between distorted conditions. In order to obtain the distortion curve of each text line more accurately, preferably, S103 can be specifically implemented by the following steps:
第一步,构建初始化曲线。The first step is to construct an initialization curve.
第二步,根据各文本行中多个字符的指定点位置信息,计算指定点位置信息中的第一纵坐标与初始化曲线上的第二纵坐标的误差值,构建各文本行相应于初始化曲线的误差函数,其中,第二纵坐标为初始化曲线上与指定位置信息中相同的横坐标对应的纵坐标。The second step is to calculate the error value between the first ordinate in the specified point position information and the second ordinate on the initialization curve according to the position information of the designated points of the characters in each text line, and construct each text line corresponding to the initialization curve The error function of , wherein the second ordinate is the ordinate corresponding to the same abscissa in the specified position information on the initialization curve.
第三步,根据各文本行相应于初始化曲线的误差函数,通过曲线拟合,得到各文本行的扭曲曲线。In the third step, according to the error function of each text line corresponding to the initialization curve, through curve fitting, the distortion curve of each text line is obtained.
首先可以初始化一条曲线,作为拟合扭曲曲线的参考线,初始化曲线在一种特殊情况下,还可以是一条直线。初始化曲线作为参考线,可以得到文本行中多个字符的指定点位置信息与初始化曲线上对应点的坐标的误差,对应关系可以为相同的横坐标,则误差为相同横坐标下,文本行上的字符与初始化曲线在y方向上的误差。对于一个文本行而言,可以得到该文本行上多个字符对应的误差,进一步的可以构建出误差函数,基于误差函数,通过曲线拟合,即可得到各文本行的扭曲曲线。First, a curve can be initialized as a reference line for fitting the twisted curve. In a special case, the initialization curve can also be a straight line. The initialization curve is used as a reference line, and the error between the position information of the specified points of multiple characters in the text line and the coordinates of the corresponding points on the initialization curve can be obtained. The corresponding relationship can be the same abscissa, and the error is the same abscissa. The error in the y direction of the character and the initialization curve. For a text line, the errors corresponding to multiple characters on the text line can be obtained, and an error function can be further constructed. Based on the error function, the distortion curve of each text line can be obtained by curve fitting.
可选的,根据各文本行相应于初始化曲线的误差函数,通过曲线拟合,得到各文本行的扭曲曲线的步骤,具体可以为:对各文本行相应于初始化曲线的误差函数进行最小化运算,拟合得到各文本行的扭曲曲线。Optionally, according to the error function of each text line corresponding to the initialization curve, the step of obtaining the distortion curve of each text line through curve fitting may specifically be: performing a minimization operation on the error function of each text line corresponding to the initialization curve , and the distortion curve of each text line is obtained by fitting.
具体的,可以通过一个一元多次方程(例如一元四次方程)来表示文本行的扭曲曲线,针对于每个文本行对应的误差函数,通过对误差函数进行最小化运算,可以计算出一元多次方程的参数,这样就可以准确的确定出一元多次方程,从而拟合得到扭曲曲线,用来表征每个文本行的扭曲情况。Specifically, the distortion curve of the text line can be represented by a one-variable multi-degree equation (such as a one-variable quadratic equation), and for the error function corresponding to each text line, by minimizing the error function, the one-variable multi-dimensional equation can be calculated. The parameters of the sub-equation can be accurately determined, and the distortion curve can be obtained by fitting, which is used to characterize the distortion of each text line.
S104,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。S104 , correcting and mapping the text picture based on the distortion curve of each text line to obtain a corrected text picture.
在计算得到各文本行的扭曲曲线之后,如果将每一个文本行的扭曲曲线进行拉直平铺的映射处理,可以映射出每一个文本行矫正后的效果,然而,由于整个文本图片的扭曲情况是需要综合所有文本行的扭曲情况进行限定的,如果每个文本行单独进行矫正,会使得矫正后的效果不太理想,容易出现字符显示不规则的情况。因此,通常情况下,可以选择3D映射的方式进行文本图片的矫正映射,具体的,可以通过三维映射函数实现映射。After calculating the distortion curve of each text line, if the distortion curve of each text line is straightened and tiled, the corrected effect of each text line can be mapped. However, due to the distortion of the entire text image It needs to be limited by the distortion of all text lines. If each text line is corrected separately, the effect after correction will be less than ideal, and it is easy to display irregular characters. Therefore, under normal circumstances, a 3D mapping method can be selected to perform the correction mapping of the text picture, and specifically, the mapping can be realized by a 3D mapping function.
优选地,S104具体可以通过如下步骤实现:Preferably, S104 can be specifically implemented by the following steps:
将各文本行的扭曲曲线组成三维网格,构成扭曲曲面;将扭曲曲面映射至平面图片,得到矫正后的文本图片。The distorted curves of each text line are formed into a three-dimensional grid to form a distorted surface; the distorted surface is mapped to a plane image to obtain a corrected text image.
基于各文本行的扭曲曲线,通过三维网格构成如图2所示的扭曲曲面。对扭曲曲面进行矫正映射的过程,可以采用重映射的方式实现,例如CV2.remap图像矫正方法。重映射是把一幅图像中某位置的像素映射到另一幅图像指定位置的过程。这样可以将我们组成的三维的扭曲曲面对应的变形纹理映射至平面图片中,从而获得矫正后的文本图片。Based on the twisted curve of each text line, a twisted surface as shown in Figure 2 is formed through a three-dimensional mesh. The process of correcting and mapping the distorted surface can be implemented by remapping, such as the CV2.remap image correction method. Remapping is the process of mapping a pixel at a location in one image to a specified location in another image. In this way, the deformed texture corresponding to the three-dimensional distorted surface we composed can be mapped to the plane image, so as to obtain the corrected text image.
图3(a)给出了获取到的原始的文本图片,采用本发明实施例所提供的方法,对图3(a)所示的文本图片进行矫正,可以达到图3(b)所示的矫正效果,可以看出,图3(b)达到了理想的矫正效果,文本内容得到了平铺矫正,使得使用者阅读起来更加舒适和直观。Fig. 3(a) shows the obtained original text picture. By using the method provided by the embodiment of the present invention, the text picture shown in Fig. 3(a) is corrected, and the result shown in Fig. 3(b) can be achieved. Correction effect, it can be seen that Figure 3(b) achieves the ideal correction effect, and the text content is tiled and corrected, making the user more comfortable and intuitive to read.
应用本发明实施例,获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。By applying the embodiment of the present invention, a text image to be corrected is obtained, and text line detection is performed on the text image to obtain designated point position information of multiple characters in each text line of the text image, and according to the designated point positions of multiple characters in each text line information, the distortion curve of each text line is calculated, and based on the distortion curve of each text line, the text image is corrected and mapped to obtain the corrected text image. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
基于图1所示实施例,本发明实施例在对文本图片进行矫正之后,还可以对文本图片进行字符识别,如图4所示,可以包括如下步骤:Based on the embodiment shown in FIG. 1 , after correcting the text picture in this embodiment of the present invention, character recognition can also be performed on the text picture, as shown in FIG. 4 , the following steps may be included:
S401,获取待矫正的文本图片。S401, acquiring a text picture to be corrected.
S402,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息。S402: Perform text line detection on the text picture to obtain designated point position information of multiple characters in each text line of the text picture.
S403,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线。S403: Calculate the distortion curve of each text line according to the designated point position information of the multiple characters in each text line.
S404,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。S404 , correcting and mapping the text picture based on the distortion curve of each text line to obtain a corrected text picture.
本发明实施例中S401至S404的步骤,与图1所示实施例的S101至S104的步骤相同,这里不再赘述。The steps from S401 to S404 in this embodiment of the present invention are the same as the steps from S101 to S104 in the embodiment shown in FIG. 1 , and details are not repeated here.
S405,采用字符识别技术,识别矫正后的文本图片中的各字符。S405, using character recognition technology to recognize each character in the corrected text picture.
对于传统的字符识别技术,例如光学字符识别(Optical CharacterRecognition,OCR)技术,由于待矫正的文本图片存在文本弯曲的情况,使得在进行字符识别时,很难准确识别出字符,或者识别的结果也可能是错误的,如图5(a)所示,在进行字符识别时,识别框与字符的实际差异较大,导致无法识别字符,或者识别错误。For traditional character recognition technology, such as Optical Character Recognition (OCR) technology, because the text image to be corrected has text bending, it is difficult to accurately recognize the character during character recognition, or the recognition result is also It may be wrong. As shown in Figure 5(a), when performing character recognition, the actual difference between the recognition frame and the character is large, resulting in the character not being recognized, or the recognition being wrong.
为了提高字符识别结果的准确率,可以在执行完本发明实施例所提供的文本图片矫正的步骤之后,再采用OCR等字符识别技术,对矫正后的文本图片中的字符进行识别,由于矫正后的文本图片是没有弯曲情况的图片或者弯曲很小的图片,再利用字符识别技术进行字符识别,可以准确地识别出图片中的字符,如图5(b)所示,字符识别时,识别框可以更为准确的覆盖对应的每一个文本行,从而可以保证准确识别出图片中的字符。In order to improve the accuracy of the character recognition result, after performing the steps of correcting the text picture provided by the embodiment of the present invention, a character recognition technology such as OCR can be used to recognize the characters in the corrected text picture. The text picture is a picture without bending or a picture with little bending, and then using character recognition technology for character recognition, the characters in the picture can be accurately recognized, as shown in Figure 5(b), during character recognition, the recognition box Each corresponding text line can be covered more accurately, so that the characters in the picture can be accurately recognized.
应用上述方法实施例,本发明实施例还提供了一种文本图片矫正装置,如图6所示,该文本图片矫正装置可以包括:Applying the above method embodiment, the embodiment of the present invention further provides a text and picture correction device. As shown in FIG. 6 , the text and picture correction device may include:
获取模块610,用于获取待矫正的文本图片;an
检测模块620,用于对所述文本图片进行文本行检测,得到所述文本图片的各文本行中多个字符的指定点位置信息;A
计算模块630,用于根据所述各文本行中多个字符的指定点位置信息,计算所述各文本行的扭曲曲线;a
矫正模块640,用于基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片。The
优选地,所述检测模块620,具体可以用于:Preferably, the
对所述文本图片进行文档区域检测,得到所述文本图片中文档区域的检测框坐标;Perform document area detection on the text picture to obtain the coordinates of the detection frame of the document area in the text picture;
根据所述检测框坐标,从所述文档区域中,检测得到所述文档区域的各文本行中多个字符的指定点位置信息。According to the coordinates of the detection frame, the specified point position information of a plurality of characters in each text line of the document area is detected and obtained from the document area.
优选地,所述计算模块630,具体可以用于:Preferably, the
构建初始化曲线;Build an initialization curve;
根据所述各文本行中多个字符的指定点位置信息,计算所述指定点位置信息中的第一纵坐标与所述初始化曲线上的第二纵坐标的误差值,构建所述各文本行相应于所述初始化曲线的误差函数,所述第二纵坐标为所述初始化曲线上与所述指定位置信息中相同的横坐标对应的纵坐标;Calculate the error value between the first ordinate in the specified point position information and the second ordinate on the initialization curve according to the specified point position information of the characters in each text line, and construct each text line Corresponding to the error function of the initialization curve, the second ordinate is the ordinate corresponding to the same abscissa in the specified position information on the initialization curve;
根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线。According to the error function of each text line corresponding to the initialization curve, through curve fitting, the distortion curve of each text line is obtained.
优选地,所述计算模块630在用于所述根据所述各文本行相应于所述初始化曲线的误差函数,通过曲线拟合,得到所述各文本行的扭曲曲线时,具体还可以用于:Preferably, when the
对所述各文本行相应于所述初始化曲线的误差函数进行最小化运算,拟合得到所述各文本行的扭曲曲线。A minimization operation is performed on the error function of each text line corresponding to the initialization curve, and the distortion curve of each text line is obtained by fitting.
优选地,所述矫正模块640,具体可以用于:Preferably, the
将所述各文本行的扭曲曲线组成三维网格,构成扭曲曲面;Composing the twisted curves of each text line into a three-dimensional grid to form a twisted surface;
将所述扭曲曲面映射至平面图片,得到矫正后的文本图片。The distorted surface is mapped to a flat picture to obtain a corrected text picture.
优选地,所述装置还可以包括:Preferably, the device may also include:
字符识别模块,用于采用字符识别技术,识别所述矫正后的文本图片中的各字符。The character recognition module is used for using character recognition technology to recognize each character in the corrected text picture.
应用本发明实施例,获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。By applying the embodiment of the present invention, a text image to be corrected is obtained, and text line detection is performed on the text image to obtain designated point position information of multiple characters in each text line of the text image, and according to the designated point positions of multiple characters in each text line information, the distortion curve of each text line is calculated, and based on the distortion curve of each text line, the text image is corrected and mapped to obtain the corrected text image. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
本发明实施例还提供了一种电子设备,如图图7所示,包括处理器701和存储器702,其中,An embodiment of the present invention further provides an electronic device, as shown in FIG. 7 , including a
所述存储器702,用于存放计算机程序;The
所述处理器701,用于执行存储器上所存放的计算机程序时,实现上述任一文本图片矫正方法。The
存储器702与处理器701之间可以通过有线连接或者无线连接的方式进行数据传输,并且电子设备可以通过有线通信接口或者无线通信接口与其他的设备进行通信。Data transmission can be performed between the
上述存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The above-mentioned memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
上述处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processing, DSP), an application-specific integrated circuit ( Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
本实施例中,该电子设备的处理器通过读取机器可读存储介质中存储的机器可执行指令,并通过运行该机器可执行指令,能够实现:获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。In this embodiment, by reading the machine-executable instructions stored in the machine-readable storage medium, and by running the machine-executable instructions, the processor of the electronic device can achieve: acquiring the text image to be corrected, and performing processing on the text image. Text line detection, obtain the specified point position information of multiple characters in each text line of the text image, calculate the twist curve of each text line according to the specified point position information of multiple characters in each text line, and based on the twist curve of each text line , perform correction mapping on the text image to obtain the corrected text image. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
另外,本发明还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算程序,所述计算程序被处理器执行时实现上述任一文本图片矫正方法。In addition, the present invention also provides a computer-readable storage medium, where a computing program is stored in the computer-readable storage medium, and when the computing program is executed by a processor, any one of the above text and picture correction methods is implemented.
本实施例中,机器可读存储介质存储有在运行时执行本发明实施例所提供的文本图片矫正方法的机器计算机程序,因此能够实现:获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。In this embodiment, the machine-readable storage medium stores a machine computer program that executes the text picture correction method provided by the embodiment of the present invention at runtime, so it can realize: acquiring the text picture to be corrected, and performing text line detection on the text picture , obtain the designated point position information of multiple characters in each text line of the text image, calculate the distortion curve of each text row according to the designated point position information of multiple characters in each text row, and based on the distortion curve of each text row, analyze the text The picture is corrected and mapped to obtain a corrected text picture. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
本发明实施例还提供了一种显示系统,如图8所示,包括显示屏801和电子设备802,其中,An embodiment of the present invention further provides a display system, as shown in FIG. 8 , including a
所述显示屏801,用于展示待矫正的文本图片;The
所述电子设备802,用于实现如下步骤:The
获取待矫正的文本图片;Get the text image to be corrected;
对所述文本图片进行文本行检测,得到所述文本图片的各文本行中多个字符的指定点位置信息;Perform text line detection on the text picture, and obtain designated point position information of multiple characters in each text line of the text picture;
根据所述各文本行中多个字符的指定点位置信息,计算所述各文本行的扭曲曲线;Calculate the distortion curve of each text line according to the specified point position information of the multiple characters in each text line;
基于所述各文本行的扭曲曲线,对所述文本图片进行矫正映射,得到矫正后的文本图片。Correction mapping is performed on the text picture based on the distortion curve of each text line to obtain a corrected text picture.
可选的,上述电子设备802在运行时还可以实现上述任一文本图片矫正方法。Optionally, the above
应用本发明实施例,通过获取待矫正的文本图片,对文本图片进行文本行检测,得到文本图片的各文本行中多个字符的指定点位置信息,根据各文本行中多个字符的指定点位置信息,计算各文本行的扭曲曲线,基于各文本行的扭曲曲线,对文本图片进行矫正映射,得到矫正后的文本图片。通过对文本图片中的文本行进行检测,得到各文本行中多个字符的指定点位置信息,字符的指定点位置信息表征了字符在文本图片中的具体位置,则根据多个字符的指定点位置信息,能够计算出各文本行的扭曲曲线,扭曲曲线表征了文本行的扭曲情况,基于各文本行的扭曲情况,通过矫正映射,能够将原本扭曲的文本图片矫正为不扭曲的文本图片,实现了对文本图片中扭曲的文本内容的矫正,提高了用户阅读体验。By applying the embodiment of the present invention, by acquiring the text picture to be corrected, the text line detection is performed on the text picture, so as to obtain the designated point position information of multiple characters in each text line of the text image, according to the designated point position information of the multiple characters in each text line. The position information is used to calculate the distortion curve of each text line, and based on the distortion curve of each text line, the text image is corrected and mapped to obtain the corrected text image. By detecting the text lines in the text picture, the designated point position information of multiple characters in each text line is obtained. The designated point position information of the character represents the specific position of the character in the text image. The position information can calculate the distortion curve of each text line. The distortion curve represents the distortion of the text line. Based on the distortion of each text line, the original distorted text image can be corrected into an undistorted text image through correction mapping. Correction of the distorted text content in the text picture is realized, and the user's reading experience is improved.
对于电子设备、机器可读存储介质及显示系统实施例而言,由于其所涉及的方法内容基本相似于前述的方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the embodiments of the electronic device, the machine-readable storage medium and the display system, since the content of the methods involved are basically similar to the foregoing method embodiments, the description is relatively simple. Can.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备、机器可读存储介质及显示系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. Especially, for the apparatus, electronic device, machine-readable storage medium, and display system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to some descriptions of the method embodiments.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910330806.XA CN111832371B (en) | 2019-04-23 | 2019-04-23 | Text and image correction method, device, electronic device, and machine-readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910330806.XA CN111832371B (en) | 2019-04-23 | 2019-04-23 | Text and image correction method, device, electronic device, and machine-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111832371A true CN111832371A (en) | 2020-10-27 |
| CN111832371B CN111832371B (en) | 2024-09-06 |
Family
ID=72911582
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910330806.XA Active CN111832371B (en) | 2019-04-23 | 2019-04-23 | Text and image correction method, device, electronic device, and machine-readable storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111832371B (en) |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112509106A (en) * | 2020-11-17 | 2021-03-16 | 科大讯飞股份有限公司 | Document picture flattening method, device and equipment |
| CN112801088A (en) * | 2020-12-31 | 2021-05-14 | 科大讯飞股份有限公司 | Method and related device for correcting distorted text line image |
| CN113139537A (en) * | 2021-05-13 | 2021-07-20 | 上海肇观电子科技有限公司 | Image processing method, electronic circuit, visual impairment assisting apparatus, and medium |
| CN113205090A (en) * | 2021-04-29 | 2021-08-03 | 北京百度网讯科技有限公司 | Picture rectification method and device, electronic equipment and computer readable storage medium |
| CN113627242A (en) * | 2021-06-30 | 2021-11-09 | 中国科学院深圳先进技术研究院 | Text processing method and related device |
| CN113792730A (en) * | 2021-08-17 | 2021-12-14 | 北京百度网讯科技有限公司 | Method and device for correcting document image, electronic equipment and storage medium |
| CN115471846A (en) * | 2022-09-22 | 2022-12-13 | 中电金信软件有限公司 | Image correction method and device, electronic equipment and readable storage medium |
| CN116434240A (en) * | 2022-03-28 | 2023-07-14 | 中国电信股份有限公司 | Direction Correction Method, Device, Medium and Equipment for Distorted Text Lines |
| WO2024078233A1 (en) * | 2022-10-10 | 2024-04-18 | 杭州睿胜软件有限公司 | Text-containing image processing method and system, and storage medium |
| CN120932245A (en) * | 2025-10-14 | 2025-11-11 | 中通服创立信息科技有限责任公司 | Multi-level text correction method and system based on document layout analysis |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100225937A1 (en) * | 2009-03-06 | 2010-09-09 | Simske Steven J | Imaged page warp correction |
| US20140140635A1 (en) * | 2012-11-20 | 2014-05-22 | Hao Wu | Image rectification using text line tracks |
| US20140140627A1 (en) * | 2012-11-20 | 2014-05-22 | Hao Wu | Image rectification using sparsely-distributed local features |
| CN105989366A (en) * | 2015-01-30 | 2016-10-05 | 深圳市思路飞扬信息技术有限责任公司 | Inclination angle correcting method of text image, page layout analysis method of text image, vision assistant device and vision assistant system |
| CN106778739A (en) * | 2016-12-02 | 2017-05-31 | 中国人民解放军国防科学技术大学 | A kind of curving transmogrified text page-images antidote |
| JP2017182195A (en) * | 2016-03-28 | 2017-10-05 | コニカミノルタ株式会社 | Document correction method, document correction apparatus, document printing apparatus, image for error detection, and computer program |
| CN108885699A (en) * | 2018-07-11 | 2018-11-23 | 深圳前海达闼云端智能科技有限公司 | Character identifying method, device, storage medium and electronic equipment |
-
2019
- 2019-04-23 CN CN201910330806.XA patent/CN111832371B/en active Active
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100225937A1 (en) * | 2009-03-06 | 2010-09-09 | Simske Steven J | Imaged page warp correction |
| US20140140635A1 (en) * | 2012-11-20 | 2014-05-22 | Hao Wu | Image rectification using text line tracks |
| US20140140627A1 (en) * | 2012-11-20 | 2014-05-22 | Hao Wu | Image rectification using sparsely-distributed local features |
| CN105989366A (en) * | 2015-01-30 | 2016-10-05 | 深圳市思路飞扬信息技术有限责任公司 | Inclination angle correcting method of text image, page layout analysis method of text image, vision assistant device and vision assistant system |
| JP2017182195A (en) * | 2016-03-28 | 2017-10-05 | コニカミノルタ株式会社 | Document correction method, document correction apparatus, document printing apparatus, image for error detection, and computer program |
| CN106778739A (en) * | 2016-12-02 | 2017-05-31 | 中国人民解放军国防科学技术大学 | A kind of curving transmogrified text page-images antidote |
| CN108885699A (en) * | 2018-07-11 | 2018-11-23 | 深圳前海达闼云端智能科技有限公司 | Character identifying method, device, storage medium and electronic equipment |
Non-Patent Citations (1)
| Title |
|---|
| 曾凡锋 等: "基于文本行重构的扭曲文档快速校正方法", 《计算机工程与设计》, vol. 35, no. 2, 28 February 2014 (2014-02-28), pages 573 - 577 * |
Cited By (15)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112509106A (en) * | 2020-11-17 | 2021-03-16 | 科大讯飞股份有限公司 | Document picture flattening method, device and equipment |
| CN112801088A (en) * | 2020-12-31 | 2021-05-14 | 科大讯飞股份有限公司 | Method and related device for correcting distorted text line image |
| CN112801088B (en) * | 2020-12-31 | 2024-05-31 | 科大讯飞股份有限公司 | Method and related device for correcting distorted text line image |
| CN113205090A (en) * | 2021-04-29 | 2021-08-03 | 北京百度网讯科技有限公司 | Picture rectification method and device, electronic equipment and computer readable storage medium |
| CN113205090B (en) * | 2021-04-29 | 2023-10-24 | 北京百度网讯科技有限公司 | Image correction methods, devices, electronic equipment and computer-readable storage media |
| CN113139537A (en) * | 2021-05-13 | 2021-07-20 | 上海肇观电子科技有限公司 | Image processing method, electronic circuit, visual impairment assisting apparatus, and medium |
| WO2023273188A1 (en) * | 2021-06-30 | 2023-01-05 | 中国科学院深圳先进技术研究院 | Text processing method and related apparatus |
| CN113627242A (en) * | 2021-06-30 | 2021-11-09 | 中国科学院深圳先进技术研究院 | Text processing method and related device |
| CN113792730B (en) * | 2021-08-17 | 2022-09-27 | 北京百度网讯科技有限公司 | Method and device for correcting document image, electronic equipment and storage medium |
| CN113792730A (en) * | 2021-08-17 | 2021-12-14 | 北京百度网讯科技有限公司 | Method and device for correcting document image, electronic equipment and storage medium |
| CN116434240A (en) * | 2022-03-28 | 2023-07-14 | 中国电信股份有限公司 | Direction Correction Method, Device, Medium and Equipment for Distorted Text Lines |
| CN115471846B (en) * | 2022-09-22 | 2023-06-27 | 中电金信软件有限公司 | Image correction method and device, electronic equipment and readable storage medium |
| CN115471846A (en) * | 2022-09-22 | 2022-12-13 | 中电金信软件有限公司 | Image correction method and device, electronic equipment and readable storage medium |
| WO2024078233A1 (en) * | 2022-10-10 | 2024-04-18 | 杭州睿胜软件有限公司 | Text-containing image processing method and system, and storage medium |
| CN120932245A (en) * | 2025-10-14 | 2025-11-11 | 中通服创立信息科技有限责任公司 | Multi-level text correction method and system based on document layout analysis |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111832371B (en) | 2024-09-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111832371A (en) | Text and picture correction method, device, electronic device and machine-readable storage medium | |
| US8717632B2 (en) | Image processing method, image processing device and scanner | |
| CN111428717A (en) | Text recognition method, apparatus, electronic device, and computer-readable storage medium | |
| CN108961184A (en) | A kind of bearing calibration of depth image, device and equipment | |
| CN104866847B (en) | A kind of quickly robust answer card identification method | |
| CN110400278A (en) | A fully automatic correction method, device and equipment for image color and geometric distortion | |
| CN112016341A (en) | A kind of text picture correction method and device | |
| CN113920525B (en) | Text correction method, device, equipment and storage medium | |
| CN111260574B (en) | A seal photo correction method, terminal and computer-readable storage medium | |
| CN102236789A (en) | Method and device for correcting table image | |
| WO2019041650A1 (en) | Method, apparatus and device for correcting calibration parameters of video camera, and storage medium | |
| CN110751602A (en) | Method and Device for Conformal Distortion Correction Based on Face Detection | |
| CN112085014A (en) | OCR text position correction method, device, storage medium and electronic device | |
| CN114742722A (en) | Document correction method, device, electronic equipment and storage medium | |
| CN108257186A (en) | Method and device for determining calibration image, camera and storage medium | |
| CN112950528A (en) | Certificate posture determining method, model training method, device, server and medium | |
| CN111783763A (en) | Text positioning box correction method and system based on convolutional neural network | |
| CN116777769A (en) | Distorted image correction method and device, electronic equipment, storage medium | |
| CN115018735A (en) | Fracture width identification method and system for correcting two-dimensional code image based on Hough transform | |
| CN112839172A (en) | Method and system for photographing subject recognition based on hand recognition | |
| CN115937003A (en) | Image processing method, image processing device, terminal equipment and readable storage medium | |
| CN115222935A (en) | Image correction method, image correction device, electronic apparatus, scanning pen, and storage medium | |
| WO2022028247A1 (en) | Object edge identification and processing method and system, and computer-readable storage medium | |
| CN113724141A (en) | Image correction method and device and electronic equipment | |
| CN118154477A (en) | Telecentric lens distortion correction method, device, equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |