WO2012068902A1 - Method and system for enhancing text image clarity - Google Patents

Method and system for enhancing text image clarity Download PDF

Info

Publication number
WO2012068902A1
WO2012068902A1 PCT/CN2011/077904 CN2011077904W WO2012068902A1 WO 2012068902 A1 WO2012068902 A1 WO 2012068902A1 CN 2011077904 W CN2011077904 W CN 2011077904W WO 2012068902 A1 WO2012068902 A1 WO 2012068902A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
image
matching
text
feature
Prior art date
Application number
PCT/CN2011/077904
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 WO2012068902A1 publication Critical patent/WO2012068902A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30176Document

Definitions

  • the invention belongs to the technical field of image processing, and relates to a method for improving the sharpness of an image, in particular to a method for improving the sharpness of a text image. Meanwhile, the present invention also relates to a system for improving the sharpness of a text image. Background technique
  • the camera of a mobile phone has a limited number of pixels.
  • the average pixel of a mobile phone camera is between 3 million and 5 million. Therefore, for a large document, you need to take all the details of the document. , is unlikely.
  • the technical problem to be solved by the present invention is to provide a method for improving the sharpness of a text image, which can improve the sharpness of the entire document image.
  • the present invention further provides a system for improving the sharpness of a text image, which can improve the sharpness of the entire document image.
  • the present invention uses the following technical solutions:
  • a method for improving the sharpness of a text image first taking a document image, then taking a close-up shot of each partial region of the document, and then extracting these clear local region images and feature points of the original document image, and then matching to obtain a partial image Matching feature points with the original document image, calculating a perspective transformation matrix of the partial image to the original document image according to the feature point pair, and then transforming the clear partial image according to the perspective change matrix, and replacing the transformed partial image with the original document
  • the area in which the image is located using this alternative to ultimately improve the clarity of the entire document image.
  • a method of improving the sharpness of a text image comprising the steps of:
  • a method for capturing an entire text image To: Adjust the distance of the camera from the text. When the text to be shot just fills the entire screen of the phone, press the capture button to get the initial text image.
  • step S2 the distance of the camera is adjusted to make the camera closer to the text; when the local area of the text to be captured occupies the setting range of the entire text area, the shooting button is pressed; At this time, since the camera is closer to the text, the text in the obtained partial image will be more clear.
  • the method for performing feature matching between the partial image and the entire text image includes:
  • S31 determining a feature key point of interest
  • S32 extracting a feature vector descriptor of a region around the key point
  • S33 matching each feature vector descriptor by the Euclidean distance of the feature point
  • step S33 the matching strategy adopts the nearest neighbor proportional matching: for the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the feature in the second image.
  • the two feature points closest to the Euclidean distance if the distance of the nearest point a ' is divided by the distance of the second near point ° ⁇ . ⁇ If the value is less than the set value, the nearest point is considered to be the matching point, otherwise it will not be received.
  • the method for calculating the perspective transformation matrix according to the matched feature point pairs is:
  • the perspective change matrix is a 3 x 3 matrix, making
  • the method for transforming the partial image by the perspective transformation matrix is:
  • each pixel of the partial image is transformed according to the perspective change matrix to obtain a transformed partial image, and the changed partial image is in the same coordinate system as the entire text image.
  • the step S6 includes: calculating an effective area, and pasting the transformed partial image according to the effective area;
  • the effective area is calculated as: Four vertices of the partial image before the change, the upper left point, the upper right point, the lower left point, and the lower right point.
  • the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated, and the inscribed rectangle represents the effective area to be pasted;
  • the method of pasting a partial image according to the effective area is as follows: By using the calculated pasted area, the pixel of the original text image is directly replaced with the partial image pixel in the area to be pasted.
  • a method of improving the sharpness of a text image comprising the steps of:
  • Step 110 Obtain a full picture of the text
  • Step 120 The camera is moved closer to a local area of the text to obtain a clear local image to be pasted
  • Step 130 Perform feature matching on the partial image and the text full image
  • Step 140 judging whether the feature matching is successful; judging criterion: whether the feature point pair on the matching reaches the set value, and if the perspective change matrix cannot be calculated if the value is lower than the set value, the judgment is a failure, and the process proceeds to the step.
  • Step 150 calculate the perspective change matrix between the two images by using the feature points on the matching obtained in step 130, and Transforming the partial image according to a perspective change matrix;
  • Step 160 replacing the transformed partial image with a corresponding area of the original text full image
  • Step 170 judge: whether there are other partial areas that need to be photographed; if still, go to the step
  • step 180 shooting the next area of text, if there is no local area to be photographed, go to step 180;
  • a system for improving the sharpness of a text image comprising:
  • a camera unit for taking an entire text image and for capturing various local areas of the text
  • the feature point matching unit is configured to extract the local area image and the feature points of the original whole image, perform matching, and obtain corresponding matching feature points of the partial image and the original text image;
  • a perspective transformation matrix calculation unit configured to calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair
  • the method for performing feature matching between a partial image and a whole text image by the feature point matching unit includes:
  • Step 131 Determine a feature key point of interest
  • Step 132 Extract a feature vector descriptor of a region around the key point
  • Step 133 match each feature vector descriptor by a Euclidean distance of the feature point
  • the matching strategy adopts the nearest neighbor proportional matching: For the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the closest to the feature point in the second image. Two feature points, if the distance d of the nearest point divided by the distance d s of the second near point is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received;
  • the method for calculating the perspective transformation matrix by the perspective transformation matrix calculation unit according to the matched feature point pairs is: calculating a perspective change matrix between planes of two text images according to the feature point pairs on the matching of the two images; setting src_points The coordinate of the matching point of the plane in the whole text image, the size is 2xN, where N is the number of points; the dstjpoints is the matching point coordinate of the plane where the partial image is located, the size is 2xN; the perspective change matrix is 3 ⁇ 3 Matrix, making Replacement page (Article 26) Where ( , , 1 ) is the coordinates of a point in dst_points, ( ⁇ , , 1) is the coordinates of a point in src_point; the 3x3 perspective change matrix of the output is such that the sum of back projection errors is the smallest, that is, the following formula is the smallest:
  • the partial image transform unit transforms the partial image by the perspective transformation matrix: after obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain the transformed partial image, and the changed
  • the partial image will be in the same coordinate system as the entire text image;
  • the integration unit includes: an effective area calculation unit, and an attachment unit for pasting the transformed partial image according to the effective area;
  • the calculation method of the effective area calculation unit is: changing four vertices of the partial image before, changing the upper left point, the upper right point, the lower left point, and the lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates. Then calculating a valid inscribed rectangle of the four transformed vertices, the inscribed rectangle representing the effective area to be pasted;
  • the method for the pasting unit to paste the partial image according to the effective area is: replacing the pixels of the original text image with the partial image pixels by using the calculated pasting area and the area to be pasted.
  • a smartphone or a digital camera which requires a general arithmetic and storage device, including a CPU of a certain frequency (central processing unit), a memory for use in computing, and a use.
  • CPU of a certain frequency central processing unit
  • a memory for use in computing
  • a smart phone or digital camera should have an auto focus function.
  • the invention has the following advantages: the method and the system for improving the sharpness of the text image proposed by the invention adopt the techniques of image processing, computer vision and the like, and use multiple clear partial document images to replace the original document area, through this Alternative methods improve the clarity of the image and make the text easier to distinguish.
  • the invention solves the problem that the user photographs when shooting a large document using the camera
  • FIG. 1 is a flow chart of a method for improving the sharpness of a text image according to the present invention.
  • Figure 2 is a schematic diagram of acquiring an entire text image.
  • FIG. 3 is a schematic diagram of acquiring a partial text image.
  • Figure 4 is a schematic diagram of the acquired partial text image.
  • FIG. 5 is a schematic diagram of feature matching between a partial image and an original image of the document. detailed description
  • the present invention discloses a method for improving the sharpness of a text image by first taking a document image, then photographing each partial region of the document at a close distance, and then extracting these clear local region images and feature points of the original document image. Then, matching is performed to obtain corresponding matching feature points of the partial image and the original document image, and according to the feature point pair, the perspective transformation matrix of the partial image to the original document image is calculated, and then the clear partial image is transformed according to the perspective change matrix, and the transformation is performed.
  • the subsequent partial image replaces the area where the original document image is located, and this alternative method finally improves the sharpness of the entire document image.
  • Step 110 Obtain a full text of the text.
  • Step 120 The camera is moved closer to the local area of the text to obtain a clear partial image to be pasted.
  • Step 130 The partial image is matched with the full text of the text.
  • the method for feature matching between a partial image and an initial text image is:
  • SIFT scale invariant Features
  • SIFT-based feature matching involves three steps: First, determine the feature detection of interest. Second, extract the feature vector descriptor of the area around the key point. Third, the feature vectors are described by feature vectors. The method of measurement generally uses Euclidean distance.
  • Matching strategy uses nearest neighbor proportional matching: For example, for feature point matching of two images, to find the corresponding matching point with a feature point in the first image, find the feature point in the second image. From the nearest two feature points, if the distance of the nearest point £ ⁇ divided by the distance of the second near point ⁇ is less than the set threshold, the nearest point is considered to be the matching point, otherwise it is not received. The accuracy of this matching method is relatively high. Because it is a matching point, the first neighboring point represents the correct matching point, and the second neighboring point is the incorrect matching point. In general, the distance of the incorrect point is greater than the distance of the correct point. This can be launched. The ratio of ⁇ is relatively small. If it is not a matching point, since the first near and second near feature vectors are all mismatched, the distance difference between the two is relatively small, so the ratio will be compared.
  • Step 140 It is judged whether the feature matching is successful. Judging criteria: Whether the feature point pairs on the matching reach more than four, such as less than four, the perspective change matrix cannot be calculated, then it is judged as failure, go to step 170, if the number of points of the feature matching pair exceeds four, it is judged as successful. , Go to step 150.
  • Step 150 Calculate the feature points on the matching obtained by step 130, and calculate between the two images.
  • the perspective matrix is transformed and the partial image is transformed according to the perspective change matrix.
  • the method for calculating the perspective transformation matrix from the matched feature point pairs is:
  • the through-change matrix (homgraphy matrix) between the planes of the two text images is calculated.
  • srcjDoints is the matching point coordinate of the plane in the initial text image, and the size is 2xN, where N is the number of points.
  • dst_points is the matching point coordinate of the plane where the partial image is located, and the size is 2xN.
  • Homography is a 3 x 3 matrix, making
  • each pixel of the partial image is transformed according to the homography matrix to obtain a transformed partial image, so that the partial image after the sub-variation is in the same coordinate system as the initial text image.
  • Step 160 replacing the transformed partial image with the corresponding region of the original document full image; comprising: calculating the effective region, and pasting the transformed partial image according to the effective region.
  • the four vertices of the partial image before the change the upper left point, the upper right point, the lower left point, and the lower right point.
  • the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated.
  • the inscribed rectangle represents the effective area to be pasted.
  • Step 170 Judging: Whether there are other partial areas that need to be photographed. If so, go to step 120 and take the next area of the text. If there is no local area to be shot, go to step 180.
  • the method for improving the sharpness of a text image proposed by the present invention uses a technique of image processing, computer vision, and the like to replace a region of an original document with a plurality of clear partial document images. Improves the sharpness of the image and makes the text easier to distinguish.
  • the present invention solves the problem that a user takes a picture that is blurred when shooting a large document using the camera.
  • Embodiment 2
  • the embodiment discloses a system for improving the sharpness of a text image, the system comprising: an imaging unit, a feature point matching unit, a perspective transformation matrix calculation unit, a partial image transformation unit, and an integration unit.
  • the camera unit is used to capture the entire text image while simultaneously capturing various local areas of the text.
  • the feature point matching unit is configured to extract the local area image and the feature points of the original whole image, and perform matching to obtain corresponding matching feature points of the partial image and the original text image.
  • the perspective transformation matrix calculation unit is configured to calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair.
  • the partial image transform unit is configured to transform the clear partial image according to the perspective change matrix.
  • the integration unit is used to replace the transformed partial image with the corresponding region in the entire text image.
  • the method for the feature matching unit to perform feature matching between the partial image and the whole text image includes: Step 131: determining a feature key point of interest; Step 132: Extracting a feature vector descriptor of a region around the key point; Step 133, The Euclidean distance of the feature points matches each feature vector descriptor.
  • Matching strategy using nearest neighbor proportional match For feature point matching of two images, to find and Corresponding matching points of a feature point in an image, and finding two feature points closest to the Euclidean distance of the feature point in the second image, if the distance d of the closest point is divided by the distance d of the second near point If s ⁇ ond is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received.
  • the perspective transformation matrix calculation unit calculates the perspective transformation matrix according to the matched feature point pairs as follows: According to the feature point pairs on the matching of the two images, the perspective change matrix between the planes of the two text images is calculated.
  • src_points and dst_points are Cartesian coordinates, and for N points, the size is 2 ⁇ ⁇ .
  • the homogeneous coordinates are used. Homogeneous coordinates use ⁇ + 1 component to describe the Cartesian coordinates of the ⁇ dimension.
  • the 2D homogeneous coordinate is a new component 1 added to the Cartesian coordinates (x, y), which becomes (x, y, l).
  • the point (1, 2) in Cartesian coordinates is (1, 2, 1) in homogeneous coordinates.
  • the output 3x3 perspective change matrix minimizes the sum of back projection errors, ie the following minimum: ⁇ (( ⁇ ' ⁇ x ' +h > ⁇ ' + ⁇ y h( 3 ⁇ 4 1 +/? 22 + 3 ⁇ 4 3) 2)
  • the partial image transform unit transforms the partial image by the perspective transformation matrix: after obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain the transformed partial image, and the changed The partial image will be in the same coordinate system as the entire text image.
  • the integration unit includes: an effective area calculation unit, and an attachment unit for pasting the transformed partial image according to the effective area.
  • the calculation method of the effective area calculation unit is: changing four vertices of the partial image before, left
  • the method for the pasting unit to paste the partial image according to the effective area is: replacing the pixels of the original text image with the partial image pixels by using the calculated pasting area and the area to be pasted.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

Disclosed is a method and system for enhancing text image clarity. The method comprises: first taking an image of the document, and then taking images of each local area of the document at a close range; extracting the characteristic points of these clear local area images and the original document image and then matching to obtain the corresponding matched characteristic points between the local area images and the original document image; calculating the perspective transformation matrix from the local areas images to the original document image according to the characteristic point pairs, then transforming the clear local area images in accordance with the perspective transformation matrix, and replacing the sections of the original document image with the transformed local areas images. The present invention employs techniques in the fields of image processing, computer vision and the like, utilizing multiple clear local areas images to replace sections of the original document image, enhancing image clarity through this replacement method and making the text more legible. The present invention solves the problem of unclear text image when a user takes an image of a large document using a camera.

Description

提高文本图像清晰度的方法及系统 技术领域  Method and system for improving text image clarity
本发明属于图像处理技术领域, 涉及一种提高图像清晰度的方法, 尤其涉 及一种提高文本图像清晰度的方法; 同时, 本发明还涉及一种提高文本图像清 晰度的系统。 背景技术  The invention belongs to the technical field of image processing, and relates to a method for improving the sharpness of an image, in particular to a method for improving the sharpness of a text image. Meanwhile, the present invention also relates to a system for improving the sharpness of a text image. Background technique
随着智能相机性能的提升, 目前自带的数码相机已经成为了智能手机的标 准配置了。 人们经常用手机上的相机来扫描或者拍摄文本图像。 而目前的智能 手机上的扫描仪功能, 都是先用相机拍摄文本图片后, 再加上一些图像预处 理, 就得到最终的扫描结果。 这种手机扫描仪存在一个比较明显的缺点就是当 所拍摄的文本(文档) 比较大时, 由于相机相对离的较远, 此时得到的图像中 文字分辨率比较低, 噪声大, 导致文本图片中的很多文字都不是很清楚。  As the performance of smart cameras has increased, the digital cameras that come with them have become the standard configuration for smartphones. People often use a camera on their mobile phone to scan or take text images. The current scanner function on the smartphone is to first take the text picture with the camera, and then add some image pre-processing to get the final scan result. One of the obvious disadvantages of this kind of mobile phone scanner is that when the text (document) is relatively large, because the camera is relatively far away, the image obtained in this image has lower resolution and louder noise, resulting in a text picture. A lot of the text is not very clear.
引起字体模糊的主要原因是:  The main reasons for the font blur are:
( 1 ) 手机的相机像素有限, 一般的手机相机拍出来的照片像素都是介于 三百万至五百万之间, 因此对于一幅较大的文档时, 要想拍清楚文档的所有细 节, 是不太可能的。  (1) The camera of a mobile phone has a limited number of pixels. The average pixel of a mobile phone camera is between 3 million and 5 million. Therefore, for a large document, you need to take all the details of the document. , is unlikely.
( 2 ) 由于要拍摄出完整的文档, 文档较大时必然要使相机离得比较远, 因此在较远时, 镜头对平面文档的对焦不可能非常准确, 此时必会引起文本图 像的模糊。  (2) Since the complete document is to be taken, the camera must be far away when the document is large, so the focus of the lens on the flat document cannot be very accurate when it is far away, which will cause the text image to be blurred. .
对于提高图像的清晰度和分辨率的方法中, 专利 "United States Patent 7106914: Bayesian image super resolution " 和专利 " United States Patent 7613363 :Image superresolution through edge extraction and contrast enhancement 介绍了提高图像分辨率使图像更清楚的方法。 中国专利 CN200910153544.0 也 公开了一种适用于压缩域的视频超分辨率方法, 充分利用前后多帧的信息来超 分辨率重建目标帧, 主要包括以下步骤: 首先, 解压缩低分辨视频, 得到各种 信息; 然后, 利用得到的信息, 使用贝叶斯框架, 来分别得到当前窗口内的各 单幅超分辨率图像; 最后, 利用当前窗口内的各单幅超分辨率图像来重建目标 帧的最终的超分辨率图像。 In the method of improving the sharpness and resolution of an image, the patent "United States Patent 7106914: Bayesian image super resolution" and the patent "United States Patent 7613363: Image superresolution through edge extraction and contrast enhancement" introduce an increase in image resolution to make the image more A clear method. Chinese patent CN200910153544.0 also discloses a video super-resolution method suitable for the compressed domain, which fully utilizes the information of multiple frames before and after to reconstruct the target frame by super-resolution, mainly including the following steps: First, the decompression is low. Distinguish the video and get various information; then, using the obtained information, use the Bayesian framework to get each of the current windows Single super-resolution image; Finally, the final super-resolution image of the target frame is reconstructed using each single super-resolution image within the current window.
上述方案均通过拍摄多幅相同分辨率的图像, 然后通过一定的算法处理从 而提高文本图像的清晰度, 这类方法的一大缺点就是所花时间较长, 而且对提 高文本图像的清晰度效果不是很明显, 不太适合用于手机平台, 也不适合处理 文本图像。 发明内容  All of the above schemes improve the sharpness of text images by taking multiple images of the same resolution and then processing them by a certain algorithm. A major disadvantage of such methods is that they take a long time and improve the sharpness of the text image. Not very obvious, not suitable for mobile platforms, nor suitable for processing text images. Summary of the invention
本发明所要解决的技术问题是: 提供一种提高文本图像清晰度的方法, 可 提高整个文档图像的清晰度。  The technical problem to be solved by the present invention is to provide a method for improving the sharpness of a text image, which can improve the sharpness of the entire document image.
此外, 本发明进一步提供一种提高文本图像清晰度的系统, 可提高整个文 档图像的清晰度。  Further, the present invention further provides a system for improving the sharpness of a text image, which can improve the sharpness of the entire document image.
为解决上述技术问题, 本发明釆用如下技术方案:  In order to solve the above technical problems, the present invention uses the following technical solutions:
一种提高文本图像清晰度的方法, 先拍摄一幅文档图像, 接着近距离拍摄 文档的各个局部区域, 然后提取这些清晰的局部区域图像以及原文档图像的特 征点, 接着进行匹配, 得到局部图像与原文档图像的对应匹配特征点, 根据特 征点对, 计算局部图像到原文档图像的透视变换矩阵, 然后按照透视变化矩阵 将清晰的局部图像进行变换, 将变换后的局部图像去替代原来文档图像所在的 区域, 利用这种替代方式最后提高整个文档图像的清晰度。  A method for improving the sharpness of a text image, first taking a document image, then taking a close-up shot of each partial region of the document, and then extracting these clear local region images and feature points of the original document image, and then matching to obtain a partial image Matching feature points with the original document image, calculating a perspective transformation matrix of the partial image to the original document image according to the feature point pair, and then transforming the clear partial image according to the perspective change matrix, and replacing the transformed partial image with the original document The area in which the image is located, using this alternative to ultimately improve the clarity of the entire document image.
一种提高文本图像清晰度的方法, 所述方法包括如下步骤:  A method of improving the sharpness of a text image, the method comprising the steps of:
51、 拍摄整幅文本图像;  51. Take the entire text image;
52、 拍摄该文本的各个局部区域;  52. Shooting various partial areas of the text;
53、 提取局部区域图像以及原整幅图像的特征点, 进行匹配, 得到局部图 像与原文本图像的对应匹配特征点;  53. Extracting a local area image and a feature point of the original entire image, and performing matching to obtain a corresponding matching feature point of the partial image and the original text image;
54、 根据特征点对, 计算局部图像到原文本图像的透视变换矩阵;  54. Calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair;
55、 按照透视变化矩阵将清晰的局部图像进行变换;  55, transforming the clear partial image according to the perspective change matrix;
S6、 将变换后的局部图像替代整幅文本图像中对应的区域。  S6. Substituting the transformed partial image for the corresponding region in the entire text image.
作为本发明的一种优选方案, 所述步骤 S1 中, 拍摄整幅文本图像的方法 为: 调整相机离文本的距离, 当要拍摄的文本恰好充满整个手机屏幕, 此时按 下拍摄按钮, 得到初始的文本图像。 As a preferred solution of the present invention, in the step S1, a method for capturing an entire text image To: Adjust the distance of the camera from the text. When the text to be shot just fills the entire screen of the phone, press the capture button to get the initial text image.
作为本发明的一种优选方案, 所述步骤 S2 中, 调整相机的距离, 使相机 离文本更近些; 当所要拍摄的文本局部区域占整个文本面积的设定范围时, 按 下拍摄按钮; 此时由于相机距离文本较近, 所获得局部图像中的文字将更加清 楚。  As a preferred solution of the present invention, in step S2, the distance of the camera is adjusted to make the camera closer to the text; when the local area of the text to be captured occupies the setting range of the entire text area, the shooting button is pressed; At this time, since the camera is closer to the text, the text in the obtained partial image will be more clear.
作为本发明的一种优选方案, 所迷步驟 S3 中, 局部图像跟整幅文本图像 进行特征匹配的方法包括:  As a preferred solution of the present invention, in the step S3, the method for performing feature matching between the partial image and the entire text image includes:
S31 , 确定感兴趣的特征关键点; S32, 提取关键点周围区域的特征向量描 述子; S33 , 通过特征点的欧式距离来匹配各个特征向量描迷子;  S31, determining a feature key point of interest; S32, extracting a feature vector descriptor of a region around the key point; S33, matching each feature vector descriptor by the Euclidean distance of the feature point;
步骤 S33 中, 匹配策略采用最近邻比例匹配: 对于二幅图像的特征点匹 配, 要查找与第一幅图像中某个特征点的对应匹配点, 则在第二幅图像中找出 与该特征点欧式距离最近的二个特征点, 如果最近点的距离 a '除以第二近点 的距离 °^。^小于设定闹值, 则认为该最近点为匹配点, 否则不接收。  In step S33, the matching strategy adopts the nearest neighbor proportional matching: for the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the feature in the second image. The two feature points closest to the Euclidean distance, if the distance of the nearest point a ' is divided by the distance of the second near point °^. ^ If the value is less than the set value, the nearest point is considered to be the matching point, otherwise it will not be received.
作为本发明的一种优选方案, 所述步骤 S4 中, 根据匹配的特征点对计算 透视变换矩阵的方法为:  As a preferred solution of the present invention, in the step S4, the method for calculating the perspective transformation matrix according to the matched feature point pairs is:
根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之间的透 视变化矩阵;  Calculating a perspective change matrix between planes of two text images according to feature point pairs on the matching of the two images;
设定 src_points 为整幅文本图像中所在平面的匹配点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points 为局部图像所在平面的匹配点坐标, 大小为 2x ;  Set src_points to the coordinate of the matching point of the plane in the whole text image, the size is 2xN, where N is the number of points; set dst_points is the matching point coordinate of the plane of the local image, the size is 2x;
透视变化矩阵为 3 x 3的矩阵, 使得
Figure imgf000005_0001
The perspective change matrix is a 3 x 3 matrix, making
Figure imgf000005_0001
其中 , .,1)为 dst_points—个点的坐标, (x ,1)为 src__point—个点的坐 输出的 3x3的透视变化矩阵, 使得反投影错误总和最小, 即下式最小:  Where , . , 1) is the dst_points—the coordinates of a point, (x , 1) is the src__point—the 3x3 perspective change matrix of the output of the point, so that the sum of the back projection errors is the smallest, that is, the following formula is the smallest:
换 细 26
Figure imgf000006_0001
Change 26
Figure imgf000006_0001
作为本发明的一种优选方案, 所述步骤 S5 中, 通过透视变换矩阵对局部 图像进行变换的方法为:  As a preferred solution of the present invention, in the step S5, the method for transforming the partial image by the perspective transformation matrix is:
得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵进行 变换, 得到变换后的局部图像, 变化后的局部图像将和整幅文本图像处于同一 坐标系下。  After obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain a transformed partial image, and the changed partial image is in the same coordinate system as the entire text image.
作为本发明的一种优选方案, 所述步骤 S6 包括: 计算有效区域, 将变换 后的局部图像按照有效区域进行粘贴;  As a preferred solution of the present invention, the step S6 includes: calculating an effective area, and pasting the transformed partial image according to the effective area;
有效区域的计算方法为: 变化之前局部图像的四个顶点, 左上点, 右上 点, 左下点, 右下点。 这个四个点通过透视变化矩阵变换, 得到变换后的位置 坐标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形代表要要粘 贴的有效区域;  The effective area is calculated as: Four vertices of the partial image before the change, the upper left point, the upper right point, the lower left point, and the lower right point. The four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated, and the inscribed rectangle represents the effective area to be pasted;
按照有效区域进行粘贴局部图像的方法为: 通过计算出来的粘贴区域, 将 要进行粘贴的区域中, 直接用局部图像像素替代原始文本图像的像素。 一种提高文本图像清晰度的方法, 所述方法包括如下步骤:  The method of pasting a partial image according to the effective area is as follows: By using the calculated pasted area, the pixel of the original text image is directly replaced with the partial image pixel in the area to be pasted. A method of improving the sharpness of a text image, the method comprising the steps of:
步骤 110, 获取文本全图;  Step 110: Obtain a full picture of the text;
步骤 120, 将相机离的近些, 拍摄文本的局部区域, 得到待粘贴的清晰局 部图像;  Step 120: The camera is moved closer to a local area of the text to obtain a clear local image to be pasted;
步骤 130, 将局部图像与文本全图进行特征匹配;  Step 130: Perform feature matching on the partial image and the text full image;
步骤 140, 判断特征匹配是否成功; 判断标准: 匹配上的特征点对是否达 到设定值, 如低于设定值, 无法计算透视变化矩阵, 则判断为失败, 转到步骤 Step 140: judging whether the feature matching is successful; judging criterion: whether the feature point pair on the matching reaches the set value, and if the perspective change matrix cannot be calculated if the value is lower than the set value, the judgment is a failure, and the process proceeds to the step.
170, 如特征匹配对的点数达到或超过设定值, 判断匹配成功, 转到步骤 150; 步骤 150, 通过步骤 130得到的匹配上的特征点, 计算二幅图像之间的透 视变化矩阵, 并将局部图像依照透视变化矩阵进行变换; 170, if the number of points of the feature matching pair reaches or exceeds the set value, determining that the matching is successful, go to step 150; Step 150, calculate the perspective change matrix between the two images by using the feature points on the matching obtained in step 130, and Transforming the partial image according to a perspective change matrix;
步骤 160, 将变换后的局部图像替代原文本全图的相应区域;  Step 160, replacing the transformed partial image with a corresponding area of the original text full image;
步骤 170, 判断: 是否还有需要拍摄的其它局部区域; 如还有, 转到步驟 Step 170, judge: whether there are other partial areas that need to be photographed; if still, go to the step
120, 拍摄文本的下一个区域, 如没有要拍摄的局部区域, 则转到步骤 180; 120, shooting the next area of text, if there is no local area to be photographed, go to step 180;
替换页 (细则第 26条) 步骤 180, 结束。 一种提高文本图像清晰度的系统, 所述系统包括: Replacement page (Article 26) Step 180, the end. A system for improving the sharpness of a text image, the system comprising:
摄像单元, 用以拍摄整幅文本图像, 同时用于拍摄该文本的各个局部区 域;  a camera unit for taking an entire text image and for capturing various local areas of the text;
特征点匹配单元, 用以提取局部区域图像以及原整幅图像的特征点, 进行 匹配, 得到局部图像与原文本图像的对应匹配特征点;  The feature point matching unit is configured to extract the local area image and the feature points of the original whole image, perform matching, and obtain corresponding matching feature points of the partial image and the original text image;
透视变换矩阵计算单元, 用以根据特征点对, 计算局部图像到原文本图像 的透视变换矩阵;  a perspective transformation matrix calculation unit, configured to calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair;
局部图像变换单元, 用以按照透视变化矩阵将清晰的局部图像进行变换; 整合单元, 用以将变换后的局部图像替代整幅文本图像中对应的区域。 作为本发明的一种优选方案, 所述特征点匹配单元将局部图像跟整幅文本 图像进行特征匹配的方法包括:  a partial image transforming unit for transforming a clear partial image according to a perspective change matrix; and an integrating unit for replacing the transformed partial image with a corresponding region in the entire text image. As a preferred solution of the present invention, the method for performing feature matching between a partial image and a whole text image by the feature point matching unit includes:
步骤 131, 确定感兴趣的特征关键点; 步骤 132, 提取关键点周围区域的 特征向量描述子; 步骤 133, 通过特征点的欧式距离来匹配各个特征向量描述 子;  Step 131: Determine a feature key point of interest; Step 132: Extract a feature vector descriptor of a region around the key point; Step 133, match each feature vector descriptor by a Euclidean distance of the feature point;
匹配策略采用最近邻比例匹配: 对于二幅图像的特征点匹配, 要查找与第 一幅图像中某个特征点的对应匹配点, 则在第二幅图像中找出与该特征点欧式 距离最近的二个特征点, 如果最近点的距离 d 除以第二近点的距离 ds 小 于设定阈值, 则认为该最近点为匹配点, 否则不接收; The matching strategy adopts the nearest neighbor proportional matching: For the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the closest to the feature point in the second image. Two feature points, if the distance d of the nearest point divided by the distance d s of the second near point is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received;
所述透视变换矩阵计算单元根据匹配的特征点对计算透视变换矩阵的 方法为: 根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之 间的透视变化矩阵; 设定 src_points 为整幅文本图像中所在平面的匹配点坐 标, 大小为 2xN, 其中, N表示点的数目; 设定 dstjpoints 为局部图像所在平 面的匹配点坐标, 大小为 2xN; 透视变化矩阵为 3 χ 3的矩阵, 使得
Figure imgf000007_0001
替换页 (细则第 26条) 其中( , ,1)为 dst_points中一个点的坐标, (^, ,1)为 src_point中一个点 的坐标; 输出的 3x3 的透视变化矩阵, 使得反投影错误总和最小, 即下式最 小:
The method for calculating the perspective transformation matrix by the perspective transformation matrix calculation unit according to the matched feature point pairs is: calculating a perspective change matrix between planes of two text images according to the feature point pairs on the matching of the two images; setting src_points The coordinate of the matching point of the plane in the whole text image, the size is 2xN, where N is the number of points; the dstjpoints is the matching point coordinate of the plane where the partial image is located, the size is 2xN; the perspective change matrix is 3 χ 3 Matrix, making
Figure imgf000007_0001
Replacement page (Article 26) Where ( , , 1 ) is the coordinates of a point in dst_points, (^, , 1) is the coordinates of a point in src_point; the 3x3 perspective change matrix of the output is such that the sum of back projection errors is the smallest, that is, the following formula is the smallest:
y + yi + ^3 )2 , xi + yi + y ) . y + yi + ^ 3 ) 2 , x i + yi + y ) .
所述局部图像变换单元通过透视变换矩阵对局部图像进行变换的方法为: 得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵进行变 换, 得到变换后的局部图像, 变化后的局部图像将和整幅文本图像处于同一坐 标系下; The partial image transform unit transforms the partial image by the perspective transformation matrix: after obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain the transformed partial image, and the changed The partial image will be in the same coordinate system as the entire text image;
所述整合单元包括: 有效区域计算单元, 用以将变换后的局部图像按照有 效区域进行粘贴的粘贴单元;  The integration unit includes: an effective area calculation unit, and an attachment unit for pasting the transformed partial image according to the effective area;
所述有效区域计算单元的计算方法为: 变化之前局部图像的四个顶点, 左 上点, 右上点, 左下点, 右下点; 这个四个点通过透视变化矩阵变换, 得到变 换后的位置坐标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形 代表要要粘贴的有效区域;  The calculation method of the effective area calculation unit is: changing four vertices of the partial image before, changing the upper left point, the upper right point, the lower left point, and the lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates. Then calculating a valid inscribed rectangle of the four transformed vertices, the inscribed rectangle representing the effective area to be pasted;
所述粘贴单元按照有效区域进行粘贴局部图像的方法为: 通过计算出来的 粘贴区域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文本图像的 像素。 为了实行本发明, 一般需具备如下硬件条件: 智能手机或者数码相机, 该 设备中需要有一般的运算和存储装置, 包括一定频率的 CPU (中央处理器) , 有一定用来运算的内存和用来存储系统软件, 应用软件和各种数据的存储空间 等。 智能手机或者数码相机要有自动对焦的功能。 本发明的有益效果在于: 本发明提出的提高文本图像清晰度的方法及系 统, 采用图像处理, 计算机视觉等领域的技术, 利用多幅清晰的局部文档图像 去替代原来文档的所在区域, 通过这种替代方式提高了图像的清晰度, 也使文 字更容易辨别。 本发明解决了用户使用相机在拍摄一幅较大文档时, 拍摄到的  The method for the pasting unit to paste the partial image according to the effective area is: replacing the pixels of the original text image with the partial image pixels by using the calculated pasting area and the area to be pasted. In order to implement the present invention, it is generally required to have the following hardware conditions: a smartphone or a digital camera, which requires a general arithmetic and storage device, including a CPU of a certain frequency (central processing unit), a memory for use in computing, and a use. To store system software, application software and storage space for various data. A smart phone or digital camera should have an auto focus function. The invention has the following advantages: the method and the system for improving the sharpness of the text image proposed by the invention adopt the techniques of image processing, computer vision and the like, and use multiple clear partial document images to replace the original document area, through this Alternative methods improve the clarity of the image and make the text easier to distinguish. The invention solves the problem that the user photographs when shooting a large document using the camera
替换页 (细则第 26条) 文本图片模糊不清的问题。 附图说明 Replacement page (Article 26) The text picture is ambiguous. DRAWINGS
图 1为本发明提高文本图像清晰度方法的流程图。  1 is a flow chart of a method for improving the sharpness of a text image according to the present invention.
图 2为获取整幅文本图像的示意图。  Figure 2 is a schematic diagram of acquiring an entire text image.
图 3为获取局部文本图像的示意图。  FIG. 3 is a schematic diagram of acquiring a partial text image.
图 4为获取的局部文本图像的示意图。  Figure 4 is a schematic diagram of the acquired partial text image.
图 5为局部图像跟文档原图进行特征匹配的示意图。 具体实施方式  FIG. 5 is a schematic diagram of feature matching between a partial image and an original image of the document. detailed description
下面结合附图详细说明本发明的优选实施例。  Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
实施例一  Embodiment 1
本发明揭示了本发明提供了一种提高文本图像清晰度的方法, 先拍摄一幅 文档图像, 接着近距离拍摄文档的各个局部区域, 然后提取这些清晰的局部区 域图像以及原文档图像的特征点, 接着进行匹配, 得到局部图像与原文档图像 的对应匹配特征点, 根据特征点对, 计算局部图像到原文档图像的透视变换矩 阵, 然后按照透视变化矩阵将清晰的局部图像进行变换, 将变换后的局部图像 去替代原来文档图像所在的区域, 利用这种替代方式最后提高整个文档图像的 清晰度。  The present invention discloses a method for improving the sharpness of a text image by first taking a document image, then photographing each partial region of the document at a close distance, and then extracting these clear local region images and feature points of the original document image. Then, matching is performed to obtain corresponding matching feature points of the partial image and the original document image, and according to the feature point pair, the perspective transformation matrix of the partial image to the original document image is calculated, and then the clear partial image is transformed according to the perspective change matrix, and the transformation is performed. The subsequent partial image replaces the area where the original document image is located, and this alternative method finally improves the sharpness of the entire document image.
请参阅图 1 , 本实施例中, 提高文本图像清晰度的方法的具体步骤如下: 【步骤 110】获取文本全图。  Referring to FIG. 1, in the embodiment, the specific steps of the method for improving the sharpness of the text image are as follows: [Step 110] Obtain a full text of the text.
获取初始文本图像的方式为:  The way to get the initial text image is:
调整相机离文档的距离, 当要拍摄的文档恰好充满整个手机屏幕, 此时按 下拍摄按钮, 得到初始的文本图像。 初始文本图像获取的示例见图 1。  Adjust the distance of the camera from the document. When the document to be shot just fills the entire screen of the phone, press the capture button to get the initial text image. An example of initial text image acquisition is shown in Figure 1.
【步骤 120】将相机离的近些, 拍摄文本的局部区域, 得到待粘贴的清晰 局部图像。  [Step 120] The camera is moved closer to the local area of the text to obtain a clear partial image to be pasted.
获取局部图像的拍摄方式为:  The way to get a partial image is:
调整相机的距离, 使相机离文档更近些, 当所要拍摄的文档局部区域占整 个文档面积的 1/6至 1/3时(具体大小由用户自主决定), 按下拍摄按钮, 此时 由于相机距离文档较近, 所获得局部图像中的文字将更加清楚。 局部图像拍摄 的示例见图 2、 图 3。 Adjust the distance of the camera so that the camera is closer to the document, when the local area of the document to be captured is occupied When the document area is 1/6 to 1/3 (the specific size is determined by the user), press the shooting button. At this time, the text in the partial image will be more clear because the camera is closer to the document. Examples of partial image capture are shown in Figures 2 and 3.
【步骤 130】将局部图像与文本全图进行特征匹配。  [Step 130] The partial image is matched with the full text of the text.
局部图像跟初始文本图像进行特征匹配的方法为:  The method for feature matching between a partial image and an initial text image is:
在现有技术中, 提取图像中的特征点, 然后根据特征点的描述子进行匹配 的方法有很多, 其中 SIFT ( scale invariant Features )就是一种很好的尺度不变 局部特征, 它对平移、 旋转、 尺度、 亮度变化具有不变性, 同时对一定范围内 的噪声、 仿射变换以及光照变化也都保持一定程度的鲁棒性。 (Lowe, D. Distinctive image features from scale-invariant keypoints, IJCV, volume 60, pages 91 110,2004 )。 基于 SIFT 的特征匹配包括三个步骤: 第一, 确定感兴趣的特 征关键点 (feature detection )。 第二, 提取关键点周围区域的特征向量描述子 ( feature description )。 第三, 各个特征向量描述子之间的匹配 ( feature matching )。 度量的方法一般釆用欧式距离。  In the prior art, there are many methods for extracting feature points in an image and then matching according to the descriptors of the feature points, wherein SIFT (scale invariant Features) is a good scale-invariant local feature, which is for translation, Rotation, scale, and brightness variations are invariant, while maintaining a certain degree of robustness over a range of noise, affine transformations, and illumination variations. (Lowe, D. Distinctive image features from scale-invariant keypoints, IJCV, volume 60, pages 91 110, 2004). SIFT-based feature matching involves three steps: First, determine the feature detection of interest. Second, extract the feature vector descriptor of the area around the key point. Third, the feature vectors are described by feature vectors. The method of measurement generally uses Euclidean distance.
匹配策略釆用最近邻比例匹配: 比如对于二幅图像的特征点匹配, 要查找 与第一幅图像中某个特征点的对应匹配点, 则在第二幅图像中找出与该特征点 欧式距离最近的二个特征点, 如果最近点的距离 £^除以第二近点的距离 ∞ 小于设定阔值, 这认为该最近点为匹配点, 否则不接收。 这种匹配方法 准确率比较高, 因为是匹配点的话, 第一近邻点代表正确匹配点, 则第二近邻 点为不正确匹配点。 一般情况下, 不正确点的距离要比正确点的距离大。 由此 可以推出 。^ 的比值比较小。 如果不是匹配点, 由于第一近和第二近的特 征向量都是不匹配, 二者的距离差异性比较小, 因此 比值将会比较接
Figure imgf000010_0001
Matching strategy uses nearest neighbor proportional matching: For example, for feature point matching of two images, to find the corresponding matching point with a feature point in the first image, find the feature point in the second image. From the nearest two feature points, if the distance of the nearest point £ ^ divided by the distance of the second near point ∞ is less than the set threshold, the nearest point is considered to be the matching point, otherwise it is not received. The accuracy of this matching method is relatively high. Because it is a matching point, the first neighboring point represents the correct matching point, and the second neighboring point is the incorrect matching point. In general, the distance of the incorrect point is greater than the distance of the correct point. This can be launched. The ratio of ^ is relatively small. If it is not a matching point, since the first near and second near feature vectors are all mismatched, the distance difference between the two is relatively small, so the ratio will be compared.
Figure imgf000010_0001
近 1。 通过最近邻匹配, 设置合理的比例阔值, 一般设置为 0.7 , 就可以很好的 找出匹配点。 图像之间特征匹配的示例见图 4。 Nearly 1. With the nearest neighbor matching, set a reasonable proportional value, generally set to 0.7, you can find the matching point very well. An example of feature matching between images is shown in Figure 4.
【步骤 140】判断特征匹配是否成功。 判断标准: 匹配上的特征点对是否 达到四个以上, 如低于四个, 无法计算透视变化矩阵, 则判断为失败, 转到步 骤 170, 如特征匹配对的点数超过四个, 判断为成功, 转到步骤 150。  [Step 140] It is judged whether the feature matching is successful. Judging criteria: Whether the feature point pairs on the matching reach more than four, such as less than four, the perspective change matrix cannot be calculated, then it is judged as failure, go to step 170, if the number of points of the feature matching pair exceeds four, it is judged as successful. , Go to step 150.
【步骤 150】通过步骤 130得到的匹配上的特征点, 计算二幅图像之间的 透视变化矩阵, 并将局部图像依照透视变化矩阵进行变换。 [Step 150] Calculate the feature points on the matching obtained by step 130, and calculate between the two images. The perspective matrix is transformed and the partial image is transformed according to the perspective change matrix.
根据匹配的特征点对计算透视变换矩阵的方法为:  The method for calculating the perspective transformation matrix from the matched feature point pairs is:
根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之间的透 视变化矩阵 ( homography矩阵)。  According to the feature point pairs on the matching of the two images, the through-change matrix (homgraphy matrix) between the planes of the two text images is calculated.
在这里假设 srcjDoints 为初始文本图像中所在平面的匹配点坐标, 大小为 2xN, 这儿 N表示点的数目。 假设 dst_points 为局部图像所在平面的匹配点坐 标, 大小为 2xN。  It is assumed here that srcjDoints is the matching point coordinate of the plane in the initial text image, and the size is 2xN, where N is the number of points. Suppose dst_points is the matching point coordinate of the plane where the partial image is located, and the size is 2xN.
homography 为 3 x 3的矩阵, 使得
Figure imgf000011_0001
Homography is a 3 x 3 matrix, making
Figure imgf000011_0001
其中 O , 1)为 dst_points—个点的坐标, 为 src_point—个点的坐 输出的 3x3 的 homography 矩阵, 使得反投影错误总和最小, 即下式最 小:  Where O, 1) is dst_points—the coordinates of a point, which is src_point—the 3x3 homography matrix of the point output, which minimizes the sum of back projection errors, ie, the minimum:
y ((χ' 、xi + ^ > I ( .' + 3 )2) 通过透视变换矩阵对局部图像进行变换的方法为: y (( χ ' , x i + ^ > I ( .' + 3 ) 2 ) The method of transforming a partial image through a perspective transformation matrix is:
得到透视变化矩阵(homography矩阵)之后, 将局部图像的每个像素点按 照 homography 矩阵进行变换, 得到变换后的局部图像, 这样子变化后的局部 图像将和初始文本图像处于同一坐标系下。  After obtaining the perspective change matrix (homography matrix), each pixel of the partial image is transformed according to the homography matrix to obtain a transformed partial image, so that the partial image after the sub-variation is in the same coordinate system as the initial text image.
【步骤 160】将变换后的局部图像, 替代原文档全图的相应区域; 包括: 计算有效区域, 将变换后的局部图像按照有效区域进行粘贴。  [Step 160] replacing the transformed partial image with the corresponding region of the original document full image; comprising: calculating the effective region, and pasting the transformed partial image according to the effective region.
有效区域的计算的方法为:  The method of calculating the effective area is:
变化之前局部图像的四个顶点, 左上点, 右上点, 左下点, 右下点。 这个 四个点通过透视变化矩阵变换, 得到变换后的位置坐标, 然后计算这四个变换 后顶点的有效的内接矩形, 此内接矩形代表要要粘贴的有效区域。  The four vertices of the partial image before the change, the upper left point, the upper right point, the lower left point, and the lower right point. The four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated. The inscribed rectangle represents the effective area to be pasted.
将变换后的局部图像, 按照有效区域进行粘贴的方法为:  The method of pasting the transformed partial image according to the effective area is as follows:
通过上面计算出来的粘贴区域, 将要进行粘贴的区域中, 直接用局部图像  By using the pasted area calculated above, the area to be pasted, directly using the partial image
替换页(细则第 26条) 像素替代原始文本图像的像素。 Replacement page (Article 26) The pixels replace the pixels of the original text image.
【步骤 170】判断: 是否还有需要拍摄的其它局部区域。 如还有, 转到步 骤 120 , 拍摄文本的下一个区域, 如没有要拍摄的局部区域, 则转到步骤 180。  [Step 170] Judging: Whether there are other partial areas that need to be photographed. If so, go to step 120 and take the next area of the text. If there is no local area to be shot, go to step 180.
【步骤 180】 结束。 综上所述, 本发明提出的提高文本图像清晰度的方法, 釆用图像处理, 计 算机视觉等领域的技术, 利用多幅清晰的局部文档图像去替代原来文档的所在 区域, 通过这种替代方式提高了图像的清晰度, 也使文字更容易辨别。 本发明 解决了用户使用相机在拍摄一幅较大文档时, 拍摄到的文本图片模糊不清的问 题。 实施例二  [Step 180] End. In summary, the method for improving the sharpness of a text image proposed by the present invention uses a technique of image processing, computer vision, and the like to replace a region of an original document with a plurality of clear partial document images. Improves the sharpness of the image and makes the text easier to distinguish. The present invention solves the problem that a user takes a picture that is blurred when shooting a large document using the camera. Embodiment 2
本实施例揭示一种提高文本图像清晰度的系统, 所述系统包括: 摄像单 元、 特征点匹配单元、 透视变换矩阵计算单元、 局部图像变换单元、 整合单 元。  The embodiment discloses a system for improving the sharpness of a text image, the system comprising: an imaging unit, a feature point matching unit, a perspective transformation matrix calculation unit, a partial image transformation unit, and an integration unit.
摄像单元用以拍摄整幅文本图像, 同时用于拍摄该文本的各个局部区域。 特征点匹配单元用以提取局部区域图像以及原整幅图像的特征点, 进行匹 配, 得到局部图像与原文本图像的对应匹配特征点。  The camera unit is used to capture the entire text image while simultaneously capturing various local areas of the text. The feature point matching unit is configured to extract the local area image and the feature points of the original whole image, and perform matching to obtain corresponding matching feature points of the partial image and the original text image.
透视变换矩阵计算单元用以根据特征点对, 计算局部图像到原文本图像的 透视变换矩阵。  The perspective transformation matrix calculation unit is configured to calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair.
局部图像变换单元用以按照透视变化矩阵将清晰的局部图像进行变换。 整合单元用以将变换后的局部图像替代整幅文本图像中对应的区域。  The partial image transform unit is configured to transform the clear partial image according to the perspective change matrix. The integration unit is used to replace the transformed partial image with the corresponding region in the entire text image.
所述特征点匹配单元将局部图像跟整幅文本图像进行特征匹配的方法包 括: 步骤 131 , 确定感兴趣的特征关键点; 步骤 132 , 提取关键点周围区域的 特征向量描述子; 步骤 133 , 通过特征点的欧式距离来匹配各个特征向量描述 子。  The method for the feature matching unit to perform feature matching between the partial image and the whole text image includes: Step 131: determining a feature key point of interest; Step 132: Extracting a feature vector descriptor of a region around the key point; Step 133, The Euclidean distance of the feature points matches each feature vector descriptor.
匹配策略釆用最近邻比例匹配: 对于二幅图像的特征点匹配, 要查找与第 一幅图像中某个特征点的对应匹配点, 则在第二幅图像中找出与该特征点欧式 距离最近的二个特征点, 如果最近点的距离 d 除以第二近点的距离 ds∞ond小 于设定阈值, 则认为该最近点为匹配点, 否则不接收。 Matching strategy using nearest neighbor proportional match: For feature point matching of two images, to find and Corresponding matching points of a feature point in an image, and finding two feature points closest to the Euclidean distance of the feature point in the second image, if the distance d of the closest point is divided by the distance d of the second near point If s∞ond is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received.
所述透视变换矩阵计算单元根据匹配的特征点对计算透视变换矩阵的 方法为: 根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之 间的透视变化矩阵。  The perspective transformation matrix calculation unit calculates the perspective transformation matrix according to the matched feature point pairs as follows: According to the feature point pairs on the matching of the two images, the perspective change matrix between the planes of the two text images is calculated.
设定 src_points 为初始文本图像中所在平面的匹配点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points 为局部图像所在平面的匹配点坐标, 大小为 2xN; 透视变化矩阵为 3 x 3的矩阵, 使得
Figure imgf000013_0001
Set src_points to the coordinates of the matching points of the plane in the initial text image, the size is 2xN, where N is the number of points; set dst_points to the matching point coordinates of the plane where the partial image is located, the size is 2xN; the perspective change matrix is 3 x 3 matrix, making
Figure imgf000013_0001
其中(χ,., yt , 1)为 dst_points点对应的齐次坐标 , (xt' , , 1)为 src_points点对应 的齐次坐标。 Where (χ,., y t , 1) is the homogeneous coordinate corresponding to the dst_points point, and (x t ' , , 1) is the homogeneous coordinate corresponding to the src_points point.
在计算匹配点的阶段, 得到 src_points和 dst_points是笛卡尔坐标, 对于 N 个点, 大小是 2 χ Ν。 而在计算透视变化矩阵 Η 时, 釆用的是齐次坐标。 齐次 坐标用 Ν + 1 个分量来描述 Ν 维的笛卡尔坐标。 比如, 2D 齐次坐标是在笛 卡尔坐标 (x, y)的基础上增加一个新分量 1 , 变成 (x, y,l)。 例如: 笛卡尔坐标中 的点 (1, 2) 在齐次坐标中就是 (1, 2, 1)。  In the stage of calculating the matching points, it is obtained that src_points and dst_points are Cartesian coordinates, and for N points, the size is 2 χ Ν. When calculating the perspective change matrix Η, the homogeneous coordinates are used. Homogeneous coordinates use Ν + 1 component to describe the Cartesian coordinates of the Ν dimension. For example, the 2D homogeneous coordinate is a new component 1 added to the Cartesian coordinates (x, y), which becomes (x, y, l). For example: The point (1, 2) in Cartesian coordinates is (1, 2, 1) in homogeneous coordinates.
输出的 3x3的透视变化矩阵, 使得反投影错误总和最小, 即下式最小: Υ ((χ' ^x' +h>^' +^y h( ¾1 +/?22 + ¾3)2) 所述局部图像变换单元通过透视变换矩阵对局部图像进行变换的方法为: 得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵进行变 换, 得到变换后的局部图像, 变化后的局部图像将和整幅文本图像处于同一坐 标系下。 The output 3x3 perspective change matrix minimizes the sum of back projection errors, ie the following minimum: Υ ((χ' ^ x ' +h >^' + ^y h( 3⁄4 1 +/? 22 + 3⁄4 3) 2) The partial image transform unit transforms the partial image by the perspective transformation matrix: after obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain the transformed partial image, and the changed The partial image will be in the same coordinate system as the entire text image.
所述整合单元包括: 有效区域计算单元, 用以将变换后的局部图像按照有 效区域进行粘贴的粘贴单元。  The integration unit includes: an effective area calculation unit, and an attachment unit for pasting the transformed partial image according to the effective area.
所述有效区域计算单元的计算方法为: 变化之前局部图像的四个顶点, 左  The calculation method of the effective area calculation unit is: changing four vertices of the partial image before, left
替换页 (细则第 26条) 上点, 右上点, 左下点, 右下点; 这个四个点通过透视变化矩阵变换, 得到变 换后的位置坐标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形 代表要要粘贴的有效区域。 Replacement page (Article 26) Upper point, upper right point, lower left point, lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated, and the inscribed rectangle represents The valid area to paste.
所述粘贴单元按照有效区域进行粘贴局部图像的方法为: 通过计算出来的 粘贴区域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文本图像的 像素。 这里本发明的描述和应用是说明性的, 并非想将本发明的范围限制在上述 实施例中。 这里所披露的实施例的变形和改变是可能的, 对于那些本领域的普 通技术人员来说实施例的替换和等效的各种部件是公知的。 本领域技术人员应 该清楚的是, 在不脱离本发明的精神或本质特征的情况下, 本发明可以以其它 形式、 结构、 布置、 比例, 以及用其它组件、 材料和部件来实现。 在不脱离本 发明范围和精神的情况下, 可以对这里所披露的实施例进行其它变形和改变。  The method for the pasting unit to paste the partial image according to the effective area is: replacing the pixels of the original text image with the partial image pixels by using the calculated pasting area and the area to be pasted. The description and application of the present invention are intended to be illustrative, and not intended to limit the scope of the invention. Variations and modifications of the embodiments disclosed herein are possible, and various alternative and equivalent components of the embodiments are well known to those of ordinary skill in the art. It will be apparent to those skilled in the art that the present invention may be embodied in other forms, structures, arrangements, ratios, and other components, materials and components without departing from the spirit or essential characteristics of the invention. Other variations and modifications of the embodiments disclosed herein may be made without departing from the scope and spirit of the invention.

Claims

权利要求书 、 一种提高文本图像清晰度的方法, 其特征在于, 所述方法包括如下步骤: 步骤 110, 获取文本全图; 方法为: 调整相机离文本的距离, 当要拍摄 的文本恰好充满整个手机屏幕, 此时按下拍摄按钮, 得到初始的文本图 像; The invention provides a method for improving the sharpness of a text image, wherein the method comprises the following steps: Step 110: Obtain a full text of the text; the method is: adjusting a distance of the camera from the text, when the text to be photographed is just full The entire phone screen, at this point press the capture button to get the initial text image;
步骤 120, 调整相机与文件间的距离, 拍摄文本的局部区域, 得到待粘 贴的清晰局部图像;  Step 120: Adjust a distance between the camera and the file, and capture a partial area of the text to obtain a clear partial image to be pasted;
步骤 130, 将局部图像与文本全图进行特征匹配; 特征匹配的方法包 括: 步骤 131 , 确定感兴趣的特征关键点; 步骤 132, 提取关键点周围区域 的特征向量描述子; 步骤 133,通过特征点的欧式距离来匹配各个特征向量 描述子; 步骤 133 中, 匹配策略采用最近邻比例匹配: 对于二幅图像的特 征点匹配, 要查找与第一幅图像中某个特征点的对应匹配点, 则在第二幅 图像中找出与该特征点欧式距离最近的二个特征点, 如果最近点的距离 ^ (除以第二近点的距离 e 小于设定阔值, 则认为该最近点为匹配点, 否则不接收; Step 130: Perform feature matching on the partial image and the text full image; the method of feature matching includes: Step 131: determining a feature key point of interest; Step 132, extracting a feature vector descriptor of a region around the key point; Step 133, passing the feature The Euclidean distance of the point is used to match each feature vector descriptor; in step 133, the matching strategy adopts nearest neighbor proportional matching: For feature point matching of two images, to find a corresponding matching point with a feature point in the first image, Then, in the second image, find two feature points closest to the Euclidean distance of the feature point. If the distance of the nearest point is ^ ( the distance e divided by the second near point is less than the set threshold, the nearest point is considered to be Match points, otherwise they will not receive;
步骤 140, 判断特征匹配是否成功; 判断标准: 匹配上的特征点对是否 达到设定值, 如低于设定值, 无法计算透视变化矩阵, 则判断为失败, 转 到步骤 170, 如特征匹配对的点数达到或超过设定值, 判断匹配成功, 转到 步骤 150;  Step 140: Determine whether the feature matching is successful. Judging criterion: whether the feature point pair on the matching reaches the set value. If the perspective change matrix cannot be calculated if the value is lower than the set value, the determination is a failure, and the process proceeds to step 170, such as feature matching. If the number of points reaches or exceeds the set value, it is judged that the matching is successful, and the process proceeds to step 150;
步骤 150, 通过步骤 130得到的匹配上的特征点, 计算二幅图像之间的 透视变化矩阵, 并将局部图像依照透视变化矩阵进行变换; 其中, 根据匹 配的特征点对计算透视变换矩阵的方法为: 居二幅图像的匹配上的 特征点对, 计算二幅文本图像所在平面之间的透视变化矩阵; 设定 src_points为初始文本图像中所在平面的匹配点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points为局部图像所在平面的匹配点坐标, 大小 为 2xN; 透视变化矩阵为 3 x 3的矩阵, 使得 Si Step 150: Calculate the perspective change matrix between the two images by using the feature points on the matching obtained in step 130, and transform the partial image according to the perspective change matrix; wherein, the method for calculating the perspective transformation matrix according to the matched feature point pairs For: the feature point pairs on the matching of the two images, calculate the perspective change matrix between the planes of the two text images; set src_points as the matching point coordinates of the plane in the initial text image, the size is 2xN, where, N Indicates the number of points; set dst_points to the coordinates of the matching points of the plane where the partial image is located, the size is 2xN; the perspective change matrix is a matrix of 3 x 3, making Si
Figure imgf000015_0001
Figure imgf000015_0001
13 替换页(细则第 26条) 其中 Ο,, ,Ι)为 dst_points中一个点的坐标, (x;, ., 1)为 src_point中一个 点的坐标; 输出的 3x3 的 枧变化矩阵, 使得反投影错误总和最小, 即下 式最小:13 Replacement page (Article 26) Where Ο,, ,Ι) is the coordinate of a point in dst_points, (x;, ., 1) is the coordinate of a point in src_point; the output matrix of 3x3 is the smallest, so that the sum of back projection errors is the smallest, that is, the following formula is the smallest :
((Χ' ^ + + hl3 f I (γ' + + ^ γ) ; 其中, 通过透视变换矩阵对局部图像进行变换的方法为: 得到透视变化 矩阵之后, 将局部图像的每个像素点按照透视变化矩阵进行变换, 得到变 换后的局部图像, 变化后的局部图像将和初始文本图像处于同一坐标系 下; ((Χ' ^ + + hl3 f I (γ' + + ^ γ) ; where the transformation of the partial image by the perspective transformation matrix is: After obtaining the perspective change matrix, each pixel of the partial image is in accordance with the perspective The change matrix is transformed to obtain a transformed partial image, and the changed partial image will be in the same coordinate system as the initial text image;
步骤 160, 将变换后的局部图像替代原文本全图的相应区域; 步骤 160 包括: 计算有效区域, 将变换后的局部图像按照有效区域进行粘贴; 有效 区域的计算方法为: 变化之前局部图像的四个顶点, 左上点, 右上点, 左 下点, 右下点; 这个四个点通过透视变化矩阵变换, 得到变换后的位置坐 标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形代表要要 粘贴的有效区域; 按照有效区域进行粘贴局部图像的方法为: 通过计算出 来的粘贴区域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文 本图像的像素;  Step 160: Substituting the transformed partial image for the corresponding region of the original text full image; Step 160 includes: calculating an effective region, and pasting the transformed partial image according to the effective region; the effective region is calculated as: Four vertices, upper left point, upper right point, lower left point, lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated. The inscribed rectangle represents the effective area to be pasted; the method of pasting the partial image according to the effective area is: by using the calculated pasting area, the area of the original text image is directly replaced by the partial image pixel in the area to be pasted;
步骤 170, 判断: 是否还有需要拍摄的其它局部区域; 如还有, 转到步 骤 120, 拍摄文本的下一个区域, 如没有要拍摄的局部区域, 则转到步骤 180;  Step 170, judge: whether there are other partial areas that need to be photographed; if still, go to step 120, take the next area of the text, if there is no local area to be photographed, go to step 180;
步骤 180, 结束。 、 一种提高文本图像清晰度的方法, 其特征在于, 所述方法包括如下步骤: Step 180, the end. A method for improving the sharpness of a text image, the method comprising the steps of:
51、 拍摄整幅文本图像; 51. Take the entire text image;
52、 拍摄该文本的各个局部区域;  52. Shooting various partial areas of the text;
53、 提取局部区域图像以及原整幅图像的特征点, 进行匹配, 得到局 部图像与原文本图像的对应匹配特征点;  53. Extracting a local area image and feature points of the original entire image, and performing matching to obtain corresponding matching feature points of the local image and the original text image;
54、 根据特征点对, 计算局部图像到原文本图像的透视变换矩阵; 54. Calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair;
55、 按照透视变化矩阵将清晰的局部图像进行变换; 55, transforming the clear partial image according to the perspective change matrix;
替换页 (细则第 2 6条) S6、 将变换后的局部图像替代整幅文本图像中对应的区域。 、 根据权利要求 2所述的提高文本图像清晰度的方法, 其特征在于: Replacement page (Article 2 of the Rules) S6. Substituting the transformed partial image for the corresponding region in the entire text image. The method for improving the sharpness of a text image according to claim 2, wherein:
所述步骤 S1 中, 拍摄整幅文本图像的方法包括: 调整相机离文本的距 离, 当要拍摄的文本恰好充满整个手机屏幕, 此时按下拍摄按钮, 得到初 始的文本图像;  In the step S1, the method for capturing the entire text image comprises: adjusting the distance of the camera from the text, and when the text to be photographed just fills the entire mobile phone screen, pressing the shooting button to obtain the initial text image;
所述步骤 S2 中, 调整相机的距离, 使相机离文本更近些; 当所要拍摄 的文本局部区域占整个文本面积的设定范围时, 按下拍摄按钮; 此时由于 相机距离文本较近, 所获得局部图像中的文字将更加清楚。 、 根据权利要求 2所述的提高文本图像清晰度的方法, 其特征在于:  In the step S2, the distance of the camera is adjusted to make the camera closer to the text; when the local area of the text to be captured occupies the setting range of the entire text area, the shooting button is pressed; at this time, because the camera is closer to the text, The text in the obtained partial image will be more clear. The method for improving the sharpness of a text image according to claim 2, wherein:
所述步骤 S3中, 局部图像跟整幅文本图像进行特征匹配的方法包括: S31 , 确定感兴趣的特征关键点; S32 , 提取关键点周围区域的特征向 量描述子; S33 , 通过特征点的欧式距离来匹配各个特征向量描述子;  In the step S3, the method for performing feature matching between the partial image and the whole text image includes: S31, determining a feature key point of interest; S32, extracting a feature vector descriptor of a region around the key point; S33, passing the feature point of the European style Distance to match each feature vector descriptor;
步骤 S33 中, 匹配策略釆用最近邻比例匹配: 对于二幅图像的特征点 匹配, 要查找与第一幅图像中某个特征点的对应匹配点, 则在第二幅图像 中找出与该特征点欧式距离最近的二个特征点, 如果最近点的距离 dnearst除 以第二近点的距离 ee 小于设定阔值, 则认为该最近点为匹配点, 否则不 接收。 、 根据权利要求 2所述的提高文本图像清晰度的方法, 其特征在于: In step S33, the matching strategy uses the nearest neighbor proportional matching: for the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the same in the second image. The feature point Euclidean distance is the closest two feature points. If the closest point distance d nearst divided by the second near point distance ee is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received. The method for improving the sharpness of a text image according to claim 2, wherein:
所述步骤 S4 中, 根据匹配的特征点对计算透视变换矩阵的方法 包括:  In the step S4, the method for calculating the perspective transformation matrix according to the matched feature point pairs includes:
根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之间 的透视变化矩阵;  Calculating a perspective change matrix between the planes of the two text images according to the feature point pairs on the matching of the two images;
设定 src_points 为整幅文本图像中所在平面的匹配点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points 为局部图像所在平面的匹配 点坐标, 大小为 2xN; 透视变化矩阵为 3 x 3的矩阵, 使得
Figure imgf000018_0002
Set src_points to the coordinate of the matching point of the plane in the whole text image, the size is 2xN, where N is the number of points; set dst_points is the matching point coordinate of the plane of the local image, the size is 2xN; The perspective change matrix is a 3 x 3 matrix, making
Figure imgf000018_0002
其中( , ,1)为 dst_points—个点的坐标, ( , , 1)为 src_point—个点的 坐标;  Where ( , , 1) is the dst_points—the coordinates of a point, ( , , 1) is the src_point—the coordinates of a point;
输出的 3x3的透视变化矩阵 使得反投影错误总和最小, 即下式最小:
Figure imgf000018_0001
、 根据权利要求 2所述的提高文本图像清晰度的方法, 其特征在于:
The output 3x3 perspective change matrix minimizes the sum of back projection errors, ie the following formula:
Figure imgf000018_0001
The method for improving the sharpness of a text image according to claim 2, wherein:
所述步骤 S5中, 通过透视变换矩阵对局部图像进行变换的方法包括: 得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵 进行变换, 得到变换后的局部图像, 变化后的局部图像将和整幅文本图像 处于同一坐标系下。 、 根据权利要求 2所述的提高文本图像清晰度的方法, 其特征在于:  In the step S5, the method for transforming the partial image by the perspective transformation matrix comprises: after obtaining the perspective change matrix, transforming each pixel of the partial image according to the perspective change matrix to obtain the transformed partial image, and the changed partial image. The partial image will be in the same coordinate system as the entire text image. The method for improving the sharpness of a text image according to claim 2, wherein:
所述步骤 S6包括: 计算有效区域, 将变换后的局部图像按照有效区域 进行粘贴;  The step S6 includes: calculating an effective area, and pasting the transformed partial image according to the effective area;
有效区域的计算方法为: 变化之前局部图像的四个顶点, 左上点, 右 上点, 左下点, 右下点; 这个四个点通过透视变化矩阵变换, 得到变换后 的位置坐标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形 代表要要粘贴的有效区域;  The effective area is calculated as: four vertices of the partial image before the change, the upper left point, the upper right point, the lower left point, and the lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the four are calculated. a valid inscribed rectangle of the transformed vertex, this inscribed rectangle represents the valid area to be pasted;
按照有效区域进行粘贴局部图像的方法为: 通过计算出来的粘贴区 域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文本图像的像 素。 、 一种提高文本图像清晰度的方法, 其特征在于, 所述方法包括如下步骤:  The method of pasting a partial image according to the effective area is as follows: By using the calculated pasted area, the pixels of the original text image are directly replaced with the partial image pixels in the area to be pasted. A method for improving the sharpness of a text image, the method comprising the steps of:
16 16
替换页 (细则第 26条) 步骤 110, 获取文本全图; Replacement page (Article 26) Step 110, obtaining a full picture of the text;
步骤 120, 将相机离的近些, 拍摄文本的局部区域, 得到待粘贴的清晰 局部图像;  Step 120: Move the camera closer, and capture a partial area of the text to obtain a clear partial image to be pasted;
步骤 130, 将局部图像与文本全图进行特征匹配;  Step 130: Perform feature matching on the partial image and the text full image;
步骤 140, 判断特征匹配是否成功; 判断标准: 匹配上的特征点对是否 达到设定值, 如低于设定值, 无法计算透视变化矩阵, 则判断为失败, 转 到步骤 170, 如特征匹配对的点数达到或超过设定值, 判断匹配成功, 转到 步骤 150;  Step 140: Determine whether the feature matching is successful. Judging criterion: whether the feature point pair on the matching reaches the set value. If the perspective change matrix cannot be calculated if the value is lower than the set value, the determination is a failure, and the process proceeds to step 170, such as feature matching. If the number of points reaches or exceeds the set value, it is judged that the matching is successful, and the process proceeds to step 150;
步骤 150, 通过步骤 130得到的匹配上的特征点, 计算二幅图像之间的 透视变化矩阵, 并将局部图像依照透视变化矩阵进行变换;  Step 150: Calculate a perspective change matrix between the two images by using the feature points on the matching obtained in step 130, and transform the partial image according to the perspective change matrix;
步骤 160, 将变换后的局部图像替代原文本全图的相应区域;  Step 160, replacing the transformed partial image with a corresponding area of the original text full image;
步骤 170, 判断: 是否还有需要拍摄的其它局部区域; 如还有, 转到步 骤 120 , 拍摄文本的下一个区域, 如没有要拍摄的局部区域, 则转到步骤 180;  Step 170, judge: whether there are other partial areas that need to be photographed; if still, go to step 120, take the next area of the text, if there is no local area to be photographed, go to step 180;
步骤 180, 结束。 、 根据权利要求 8所述的提高文本图像清晰度的方法, 其特征在于:  Step 180, the end. The method for improving the sharpness of a text image according to claim 8, wherein:
所述步骤 130 中, 局部图像跟初始文本图像进行特征匹配的方法包 括:  In the step 130, the method for performing feature matching between the partial image and the initial text image includes:
步骤 131 , 确定感兴趣的特征关键点; 步骤 132, 提取关键点周围区域 的特征向量描述子; 步骤 133 , 通过特征点的欧式距离来匹配各个特征向量 描述子;  Step 131: Determine a feature key point of interest; Step 132: Extract a feature vector descriptor of a region around the key point; Step 133: Match each feature vector descriptor by the Euclidean distance of the feature point;
步骤 133 中, 匹配策略釆用最近邻比例匹配: 对于二幅图像的特征点 匹配, 要查找与第一幅图像中某个特征点的对应匹配点, 则在第二幅图像 中找出与该特征点欧式距离最近的二个特征点, 如果最近点的距离 dnearst除 以第二近点的距离 ee 小于设定阔值, 则认为该最近点为匹配点, 否则不 接收。 、 根据权利要求 8所述的提高文本图像清晰度的方法, 其特征在于: 所述步骤 150中, 根据匹配的特征点对计算透视变换矩阵的方法 包括: In step 133, the matching strategy uses the nearest neighbor proportional matching: For the feature point matching of the two images, to find the corresponding matching point with a certain feature point in the first image, find the same in the second image. The feature point Euclidean distance is the closest two feature points. If the closest point distance d nearst divided by the second near point distance ee is less than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received. The method for improving the sharpness of a text image according to claim 8, wherein: in the step 150, the method for calculating a perspective transformation matrix according to the matched feature point pairs comprises:
根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平面之间 的透视变化矩阵;  Calculating a perspective change matrix between the planes of the two text images according to the feature point pairs on the matching of the two images;
设定 src_points 为初始文本图像中所在平面的匹配点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points 为局部图像所在平面的匹配 点坐标, 大小为 2xN;  Set src_points to the coordinate of the matching point of the plane in the initial text image, the size is 2xN, where N is the number of points; set dst_points is the matching point coordinate of the plane where the partial image is located, the size is 2xN;
透视变化矩阵为 3 x 3的矩阵, 使得
Figure imgf000020_0002
The perspective change matrix is a 3 x 3 matrix, making
Figure imgf000020_0002
其中 ( , ,1)为 dst_points中一个点的坐标, , 1)为 src_point中一个 点的坐标;  Where ( , , 1) is the coordinate of a point in dst_points, and 1) is the coordinates of a point in src_point;
输出的 3x3 的透视变化矩阵, 使得反投影错误总和最小, 即下式最 小:
Figure imgf000020_0001
The output of the 3x3 perspective change matrix minimizes the sum of back projection errors, ie the following formula:
Figure imgf000020_0001
、 根据权利要求 8所述的提高文本图像清晰度的方法, 其特征在于: The method for improving the sharpness of a text image according to claim 8, wherein:
所述步骤 150 中, 通过透视变换矩阵对局部图像进行变换的方法包 括:  In the step 150, the method for transforming the partial image by the perspective transformation matrix includes:
得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵 进行变换, 得到变换后的局部图像, 变化后的局部图像将和初始文本图像 处于同一坐标系下。 、 根据权利要求 8所述的提高文本图像清晰度的方法, 其特征在于:  After obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain a transformed partial image, and the changed partial image will be in the same coordinate system as the initial text image. The method for improving the sharpness of a text image according to claim 8, wherein:
所述步骤 160 包括: 计算有效区域, 将变换后的局部图像按照有效区 域进行粘贴;  The step 160 includes: calculating an effective area, and pasting the transformed partial image according to the effective area;
有效区域的计算方法为: 变化之前局部图像的四个顶点, 左上点, 右  The effective area is calculated as: Four vertices of the partial image before the change, upper left point, right
18  18
替换页 (细则第 26条) 上点, 左下点, 右下点; 这个四个点通过透视变化矩阵变换, 得到变换后 的位置坐标, 然后计算这四个变换后顶点的有效的内接矩形, 此内接矩形 代表要要粘贴的有效区域; Replacement page (Article 26) Upper point, lower left point, lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates, and then the effective inscribed rectangles of the four transformed vertices are calculated, and the inscribed rectangle represents the paste to be pasted. Effective area
按照有效区域进行粘贴局部图像的方法为: 通过计算出来的粘贴区 域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文本图像的像 素。 、 一种提高文本图像清晰度的系统, 其特征在于, 所述系统包括:  The method of pasting a partial image according to the effective area is as follows: By using the calculated pasted area, the pixels of the original text image are directly replaced with the partial image pixels in the area to be pasted. A system for improving the sharpness of a text image, wherein the system comprises:
摄像单元, 用以拍摄整幅文本图像, 同时用于拍摄该文本的各个局部 区域;  a camera unit for taking an entire text image and for capturing various local areas of the text;
特征点匹配单元, 用以提取局部区域图像以及原整幅图像的特征点, 进行匹配, 得到局部图像与原文本图像的对应匹配特征点;  The feature point matching unit is configured to extract the local area image and the feature points of the original whole image, perform matching, and obtain corresponding matching feature points of the partial image and the original text image;
透视变换矩阵计算单元, 用以根据特征点对, 计算局部图像到原文本 图像的透视变换矩阵;  a perspective transformation matrix calculation unit, configured to calculate a perspective transformation matrix of the partial image to the original text image according to the feature point pair;
局部图像变换单元, 用以按照透视变化矩阵将清晰的局部图像进行变 换;  a partial image transforming unit for converting a clear partial image according to a perspective change matrix;
整合单元, 用以将变换后的局部图像替代整幅文本图像中对应的区 域。 、 根据权利要求 13所述的提高文本图像清晰度的系统, 其特征在于: 所述特征点匹配单元将局部图像跟整幅文本图像进行特征匹配的方法 包括:  An integration unit for replacing the transformed partial image with a corresponding region in the entire text image. The system for improving the sharpness of a text image according to claim 13, wherein: the feature point matching unit performs feature matching on the partial image and the entire text image, including:
步骤 131 , 确定感兴趣的特征关键点; 步骤 132, 提取关键点周围区域 的特征向量描述子; 步骤 133 , 通过特征点的欧式距离来匹配各个特征向量 描述子;  Step 131: Determine a feature key point of interest; Step 132: Extract a feature vector descriptor of a region around the key point; Step 133: Match each feature vector descriptor by the Euclidean distance of the feature point;
匹配策略釆用最近邻比例匹配: 对于二幅图像的特征点匹配, 要查找 与第一幅图像中某个特征点的对应匹配点, 则在第二幅图像中找出与该特 征点欧式距离最近的二个特征点, 如果最近点的距离 ^除以第二近点的 距离 e。《rf小于设定阔值, 则认为该最近点为匹配点, 否则不接收; 所述透视变换矩阵计算单元根据匹配的特征点对计算透视变换矩阵 的方法为: 根据二幅图像的匹配上的特征点对, 计算二幅文本图像所在平 面之间的透视变化矩阵;设定 src_points 为整幅文本图像中所在平面的匹配 点坐标, 大小为 2xN, 其中, N表示点的数目; 设定 dst_points 为局部图像 所在平面的匹配点坐标, 大小为 2xN; 透视变化矩阵为 3 x 3的矩阵, 使得
Figure imgf000022_0002
The matching strategy uses the nearest neighbor proportional match: For the feature point matching of the two images, to find the corresponding matching point with a feature point in the first image, find the Euclidean distance from the feature point in the second image. The two most recent feature points, if the distance of the nearest point is divided by the second closest point Distance e . "If rf is smaller than the set threshold, the nearest point is considered to be a matching point, otherwise it is not received; the perspective transformation matrix calculation unit calculates the perspective transformation matrix according to the matched feature point pairs as follows: According to the matching of the two images Feature point pair, calculate the perspective change matrix between the planes of the two text images; set src_points to the coordinates of the matching points of the plane in the whole text image, the size is 2xN, where N is the number of points; set dst_points to The coordinates of the matching points of the plane where the partial image is located, the size is 2xN; the perspective change matrix is a matrix of 3 x 3,
Figure imgf000022_0002
其中(W,,1)为 dst_points中一个点的坐标, 为 src_point中一个 点的坐标; 输出的 3x3 的透视变化矩阵, 使得反投影错误总和最小, 即下 式最小:
Figure imgf000022_0001
所述局部图像变换单元通过透视变换矩阵对局部图像进行变换的方法 为: 得到透视变化矩阵之后, 将局部图像的每个像素点按照透视变化矩阵 进行变换, 得到变换后的局部图像, 变化后的局部图像将和整幅文本图像 处于同一坐标系下;
Where (W,, 1 ) is the coordinates of a point in dst_points, which is the coordinates of a point in src_point; the 3x3 perspective change matrix of the output, so that the sum of back projection errors is the smallest, that is, the following formula is the smallest:
Figure imgf000022_0001
The partial image transform unit transforms the partial image by the perspective transformation matrix: after obtaining the perspective change matrix, each pixel of the partial image is transformed according to the perspective change matrix to obtain the transformed partial image, and the changed The partial image will be in the same coordinate system as the entire text image;
所述整合单元包括: 有效区域计算单元, 用以将变换后的局部图像按 照有效区域进行粘贴的粘贴单元;  The integration unit includes: an effective area calculation unit, and a paste unit for pasting the transformed partial image according to the effective area;
所述有效区域计算单元的计算方法为: 变化之前局部图像的四个顶 点, 左上点, 右上点, 左下点, 右下点; 这个四个点通过透视变化矩阵变 换, 得到变换后的位置坐标, 然后计算这四个变换后顶点的有效的内接矩 形, 此内接矩形代表要要粘贴的有效区域;  The calculation method of the effective area calculation unit is: changing four vertices of the partial image before, changing the upper left point, the upper right point, the lower left point, and the lower right point; the four points are transformed by the perspective change matrix to obtain the transformed position coordinates. Then calculating a valid inscribed rectangle of the four transformed vertices, the inscribed rectangle representing the effective area to be pasted;
所述粘贴单元按照有效区域进行粘贴局部图像的方法为: 通过计算出 来的粘贴区域, 将要进行粘贴的区域中, 直接用局部图像像素替代原始文 本图像的像素。  The method for pasting the partial image according to the effective area by the pasting unit is: replacing the pixels of the original text image with the partial image pixels in the area to be pasted by calculating the pasted area.
20 20
替换页 (细则第 26条)  Replacement page (Article 26)
PCT/CN2011/077904 2010-11-25 2011-08-02 Method and system for enhancing text image clarity WO2012068902A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2010105589480A CN102013094B (en) 2010-11-25 2010-11-25 Method and system for improving definition of text images
CN201010558948.0 2010-11-25

Publications (1)

Publication Number Publication Date
WO2012068902A1 true WO2012068902A1 (en) 2012-05-31

Family

ID=43843259

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/077904 WO2012068902A1 (en) 2010-11-25 2011-08-02 Method and system for enhancing text image clarity

Country Status (2)

Country Link
CN (1) CN102013094B (en)
WO (1) WO2012068902A1 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102013094B (en) * 2010-11-25 2013-01-02 上海合合信息科技发展有限公司 Method and system for improving definition of text images
CN102012629B (en) * 2010-11-25 2012-07-04 上海合合信息科技发展有限公司 Shooting method for splicing document images
WO2015123791A1 (en) * 2014-02-18 2015-08-27 Empire Technology Development Llc Composite image generation to remove obscuring objects
CN105096354A (en) * 2014-05-05 2015-11-25 腾讯科技(深圳)有限公司 Image processing method and device
CN104735467B (en) * 2015-03-31 2019-03-15 北京奇艺世纪科技有限公司 Video picture-in-pictures advertisement generation method and device
CN106778730B (en) * 2016-12-29 2020-07-07 深圳爱拼信息科技有限公司 Self-adaptive method and system for rapidly generating OCR training samples
CN107682623B (en) * 2017-09-11 2020-06-02 北京小米移动软件有限公司 Photographing method and device
CN109559343B (en) * 2017-09-27 2021-04-30 北京京东尚科信息技术有限公司 Image processing method and device for container
CN108182661A (en) * 2017-12-29 2018-06-19 百维雅(东莞)网络技术有限公司 A kind of panoramic picture methods of exhibiting
CN108647351B (en) * 2018-05-16 2021-05-04 Oppo广东移动通信有限公司 Text image processing method and device, storage medium and terminal
CN108776953A (en) * 2018-06-22 2018-11-09 理光软件研究所(北京)有限公司 Improve the method and system of aeroplane photography specific location resolution ratio
WO2020037615A1 (en) * 2018-08-23 2020-02-27 深圳市大疆创新科技有限公司 Gimbal system and image processing method therefor, and unmanned aerial vehicle
JP7049983B2 (en) * 2018-12-26 2022-04-07 株式会社日立製作所 Object recognition device and object recognition method
CN110210400B (en) * 2019-06-03 2020-11-17 上海眼控科技股份有限公司 Table file detection method and equipment
CN111402367B (en) * 2020-03-27 2023-09-26 维沃移动通信有限公司 Image processing method and electronic equipment
WO2023097494A1 (en) * 2021-11-30 2023-06-08 深圳市大疆创新科技有限公司 Panoramic image photographing method and apparatus, unmanned aerial vehicle, system, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6147709A (en) * 1997-04-07 2000-11-14 Interactive Pictures Corporation Method and apparatus for inserting a high resolution image into a low resolution interactive image to produce a realistic immersive experience
CN1979335A (en) * 2005-12-08 2007-06-13 索尼株式会社 Camera system, camera control apparatus, and panorama image making method
US20100208123A1 (en) * 2009-02-13 2010-08-19 Fujitsu Limited Photographing device, photographing method, and portable terminal apparatus
CN102013094A (en) * 2010-11-25 2011-04-13 上海合合信息科技发展有限公司 Method and system for improving definition of text images

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7106914B2 (en) * 2003-02-27 2006-09-12 Microsoft Corporation Bayesian image super resolution
US20060215935A1 (en) * 2004-04-02 2006-09-28 The Boeing Company System and architecture for automatic image registration
CN101674478B (en) * 2009-10-19 2012-09-19 浙江大学 Video super-resolution method based on compressed domain

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6147709A (en) * 1997-04-07 2000-11-14 Interactive Pictures Corporation Method and apparatus for inserting a high resolution image into a low resolution interactive image to produce a realistic immersive experience
CN1979335A (en) * 2005-12-08 2007-06-13 索尼株式会社 Camera system, camera control apparatus, and panorama image making method
US20100208123A1 (en) * 2009-02-13 2010-08-19 Fujitsu Limited Photographing device, photographing method, and portable terminal apparatus
CN102013094A (en) * 2010-11-25 2011-04-13 上海合合信息科技发展有限公司 Method and system for improving definition of text images

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIN WU ET AL.: "Fast and effective method for video mosaic", COMPUTER ENGINEERING AND APPLICATIONS, vol. 45, no. 24, August 2009 (2009-08-01), pages 173 - 175 *

Also Published As

Publication number Publication date
CN102013094A (en) 2011-04-13
CN102013094B (en) 2013-01-02

Similar Documents

Publication Publication Date Title
WO2012068902A1 (en) Method and system for enhancing text image clarity
CN110827200B (en) Image super-resolution reconstruction method, image super-resolution reconstruction device and mobile terminal
US9905031B2 (en) Method and related apparatus for capturing and processing image data
US8189960B2 (en) Image processing apparatus, image processing method, program and recording medium
JP5346082B2 (en) Image processing device
CN113508416B (en) Image fusion processing module
WO2018176925A1 (en) Hdr image generation method and apparatus
RU2631765C1 (en) Method and system of correcting perspective distortions in images occupying double-page spread
WO2012058902A1 (en) Method and apparatus for combining panoramic image
JP4010754B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium
Joze et al. Imagepairs: Realistic super resolution dataset via beam splitter camera rig
WO2014183385A1 (en) Terminal and image processing method therefor
CN112261387B (en) Image fusion method and device for multi-camera module, storage medium and mobile terminal
CN102074001A (en) Method and system for stitching text images
Liang et al. Camera-based document image mosaicing
US11334961B2 (en) Multi-scale warping circuit for image fusion architecture
WO2022160857A1 (en) Image processing method and apparatus, and computer-readable storage medium and electronic device
CN113628134B (en) Image noise reduction method and device, electronic equipment and storage medium
US20230343119A1 (en) Captured document image enhancement
CN111083359B (en) Image processing method and apparatus, electronic device, and computer-readable storage medium
JP4145014B2 (en) Image processing device
JP2009146006A (en) Image processor and image processing method
TWI620147B (en) Image synthesis method for synthesizing people
US11798146B2 (en) Image fusion architecture
KR102135961B1 (en) Apparatus and method of processing images

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: 11843084

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11843084

Country of ref document: EP

Kind code of ref document: A1