Image processing method, device and medium
By determining the upper and lower key point pairs in the text image for segmented correction, the problem of poor text image correction effects under complex backgrounds is solved, achieving higher accuracy and applicability.
Patent Information
- Application Number
- CN202010615592.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-06-30
AI Technical Summary
The existing technology has poor correction effect on text images in complex backgrounds, such as picture book backgrounds, and it is difficult to accurately identify text content.
By determining the pairing of upper and lower key points in the text image, segmentation processing is performed and the text image is corrected based on these pairings to improve the accuracy and precision of the correction.
It significantly improves the correction accuracy and precision of text images under complex backgrounds, and is suitable for a variety of text backgrounds and content scenes, including picture books and mixed Chinese and English scenes.
Smart Images

Figure CN113869303B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method and device, and a machine-readable medium. Background Art
[0002] For text images captured in natural scenes, due to human factors and limitations of the image acquisition device, the text in the captured text images is inevitably tilted to a certain extent. Therefore, it is necessary to correct the text image first and then perform text recognition on the corrected text image.
[0003] At present, the process of correcting a text image specifically includes: using a Hough transform algorithm to determine the tilt angle of the text image; and correcting the text image according to the tilt angle.
[0004] During the implementation of the embodiments of the present invention, the inventors found that the Hough transform algorithm has high requirements on the background of the text image. In the background of black text on a white background or white text on a black background, a good correction effect can be obtained; however, in the complex background such as picture books, the correction result obtained is poor. Summary of the invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide an image processing method, an image processing device and a device for image processing that overcome the above problems or at least partially solve the above problems. The embodiments of the present invention can improve the accuracy of text image correction.
[0006] In order to solve the above problems, the present invention discloses an image processing method, comprising:
[0007] Determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0008] Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0009] According to the pairing of the upper and lower key points, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0010] On the other hand, an embodiment of the present invention discloses an image processing device, including:
[0011] A determination module, used to determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0012] A segmentation module, used for segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0013] The correction module is used to correct the segmented text image according to the pairing of the upper and lower key points to obtain a corresponding segmented corrected image.
[0014] In another aspect, an embodiment of the present invention discloses an apparatus for image processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0015] Determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0016] Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0017] According to the pairing of the upper and lower key points, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0018] The embodiment of the present invention further discloses one or more machine-readable media, characterized in that instructions are stored thereon, which, when executed by one or more processors, enable the device to execute the aforementioned method.
[0019] The embodiments of the present invention include the following advantages:
[0020] The embodiment of the present invention corrects the text image based on the pairing of upper and lower key points. The above-mentioned pairing of upper and lower key points specifically includes: an upper key point located above the text line, and a lower key point located below the text line. Since the above-mentioned pairing of upper and lower key points can characterize the trend of the text line, the embodiment of the present invention can correct the text image based on the trend of the text line, and may not be limited to the background of the text image or the type of text content. Therefore, the embodiment of the present invention has good applicability to complex backgrounds such as picture books or mixed Chinese and English scenes. Furthermore, the embodiment of the present invention can improve the accuracy of text image correction in complex backgrounds such as picture books or mixed Chinese and English scenes.
[0021] Furthermore, the embodiment of the present invention segments the text image, and corrects the obtained segmented text image based on the pairing of the upper and lower key points. The above segmentation-based image correction can improve the correction accuracy of the text image.
[0022] In addition, when the field of view of the image acquisition device is too narrow to directly capture a complete text image, it is usually necessary to splice the sequence frame images of the image acquisition device to obtain a complete text image. The segmentation of the embodiment of the present invention can make the segmented correction image more compatible with the frame image captured by the image acquisition device, and on this basis, the accuracy of text image correction can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flowchart of steps of an image processing method embodiment of the present invention;
[0024] Figure 2 It is a schematic diagram of pairing upper and lower key points corresponding to a text image in an embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of a corrected image according to an embodiment of the present invention;
[0026] Figure 4 It is a schematic diagram of a text image, a rectified image, and a mapping relationship between a source point and a target point according to an embodiment of the present invention;
[0027] Figure 5 is a flowchart of a method for determining a text image according to an embodiment of the present invention;
[0028] Figure 6 is a flowchart of the steps of Embodiment 3 of an image processing method of the present invention;
[0029] Figure 7 It is a schematic diagram of a prediction process of the pairing of the first, last, upper and lower key points in an embodiment of the present invention;
[0030] Figure 8 is a structural block diagram of an image processing device of the present invention;
[0031] Fig. 9 is a block diagram of an apparatus 1300 for image processing according to the present invention; and
[0032] Fig.10 It is a structural schematic diagram of a server of the present invention. DETAILED DESCRIPTION
[0033] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0034] The embodiment of the present invention can be applied to the text image correction scenario to improve the accuracy of the text image correction.
[0035] The embodiment of the present invention does not limit the application scenario corresponding to the text line. The application scenario can be any scenario that can generate a text image, such as a learning assistance scenario of a dictionary pen, or a photo translation scenario of a mobile phone. Taking the dictionary pen as an example, a user can scan a text with the dictionary pen to obtain information such as the pronunciation, interpretation, and translation of the text.
[0036] An embodiment of the present invention provides an image processing scheme, which specifically includes: determining upper and lower key point pairs corresponding to text lines in a text image; the upper and lower key point pairs specifically include: an upper key point located above the text line, and a lower key point located below the text line; a line between the upper key point and the lower key point is perpendicular to a preset direction; based on the upper and lower key point pairs, the text image is segmented to obtain a segmented text image; based on the upper and lower key point pairs, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0037] The embodiment of the present invention corrects the text image based on the pairing of upper and lower key points. The above-mentioned pairing of upper and lower key points specifically includes: an upper key point located above the text line, and a lower key point located below the text line. Since the above-mentioned pairing of upper and lower key points can characterize the trend of the text line, the embodiment of the present invention can correct the text image based on the trend of the text line, and may not be limited to the background of the text image or the type of text content. Therefore, the embodiment of the present invention has good applicability to complex backgrounds such as picture books or mixed Chinese and English scenes. Furthermore, the embodiment of the present invention can improve the accuracy of text image correction in complex backgrounds such as picture books or mixed Chinese and English scenes.
[0038] Furthermore, the embodiment of the present invention segments the text image, and corrects the obtained segmented text image based on the pairing of the upper and lower key points. The above segmentation-based image correction can improve the correction accuracy of the text image.
[0039] In addition, when the field of view of the image acquisition device is too narrow to directly capture a complete text image, it is usually necessary to splice the sequence frame images of the image acquisition device to obtain a complete text image. The segmentation of the embodiment of the present invention can make the segmented correction image more compatible with the frame image captured by the image acquisition device, and on this basis, the accuracy of text image correction can be further improved.
[0040] The image processing method provided by the embodiment of the present invention can be applied to an application environment corresponding to a client and a server. The client and the server are located in a wired or wireless network, and the client and the server exchange data through the wired or wireless network.
[0041] Optionally, the client can be run on a terminal, which specifically includes but is not limited to: a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, a car computer, a desktop computer, a set-top box, a smart TV, a wearable device, a learning terminal such as a dictionary pen, etc. The client can correspond to a website or an APP (Application).
[0042] According to one embodiment, a client can obtain a text image based on an image acquired by an image acquisition device; determine the upper and lower key point pairings corresponding to text lines in the text image; segment the text image based on the upper and lower key point pairings to obtain a segmented text image; and correct the segmented text image based on the upper and lower key point pairings to obtain a corresponding segmented corrected image.
[0043] According to another embodiment, the server may receive a captured image captured by an image acquisition device from a client; obtain a text image based on the captured image; determine the upper and lower key point pairings corresponding to the text lines in the text image; segment the text image based on the upper and lower key point pairings to obtain a segmented text image; and correct the segmented text image based on the upper and lower key point pairings to obtain a corresponding segmented corrected image.
[0044] Method Example 1
[0045] Reference Figure 1 , shows a flowchart of the steps of an image processing method embodiment 1 of the present invention, which may specifically include the following steps:
[0046] Step 101: determining an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair specifically includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0047] Step 102: segment the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0048] Step 103: Correct the segmented text image based on the pairing of the upper and lower key points to obtain a corresponding segmented corrected image.
[0049] Figure 1 The method embodiment shown may be executed by a client and / or a server. It is to be understood that the embodiment of the present invention does not limit the specific execution subject of the method embodiment.
[0050] In step 101, the text lines in the text image may be obtained by performing text detection on the text image. Text detection may be used to detect text in a text image, and the position of the text in the text image may be obtained, such as the area of the text in the text image.
[0051] The above-mentioned upper and lower key point pairing specifically includes: an upper key point located above the text line, and a lower key point located below the text line, which can reflect the trend of the text line.
[0052] Reference Figure 2 , shows a schematic diagram of the pairing of upper and lower key points corresponding to a text image according to an embodiment of the present invention. In which, the upper key point and the lower key point can be set respectively at the upper and lower parts of the text line in the text image.
[0053] Optionally, the line between the upper key point and the lower key point is perpendicular to a preset direction. The preset direction may be a target direction for correction, so that the text image is corrected according to the preset direction, and the corresponding correction target may be: to make the obtained corrected image match the preset direction. For example, the preset direction may be a horizontal direction corresponding to the text image, or a horizontal direction corresponding to the first character in a text line. Of course, the embodiment of the present invention does not limit the specific preset direction. Assuming that an XOY coordinate system is established according to a preset direction, and the preset direction corresponds to the X-axis direction, the upper key point and the lower key point may correspond to the same X-coordinate.
[0054] In the embodiment of the present invention, optionally, the interval between two adjacent upper and lower key point pairs (hereinafter referred to as adjacent pairs) is a preset interval. Specifically, the interval between two adjacent upper key points is a preset interval, and the interval between two adjacent lower key points is a preset interval. Different adjacent pairs may correspond to the same or different preset intervals.
[0055] In an optional embodiment of the present invention, the above-mentioned determination of the upper and lower key point pairs corresponding to the text lines in the text image specifically includes: determining the detection results of the upper and lower key point pairs corresponding to the text lines in the text image based on a detection model; the detection model can be trained based on text image samples and their corresponding annotated upper and lower key point pairs.
[0056] The above detection result may include: information such as the number and position of the upper and lower key point pairs corresponding to the text line, etc. Different adjacent pairs may correspond to the same or different preset intervals.
[0057] In an optional embodiment of the present application, the mathematical model can be trained based on the training data to obtain the data analyzer detection model. The above training can obtain the typesetting information corresponding to the web page content samples before and after typesetting, and the actual scanning data of a large amount of typesetting change information as training data, and train the training data so that the data analyzer detection model has the ability to recognize the typesetting upper and lower key point pairing of web pages of preset web page categories. The data analyzer detection model can characterize the mapping relationship between input data (original content text image) and output data (information on the pairing of upper and lower key points of typesetting content).
[0058] In the embodiment of the present invention, the positions of the upper and lower key point pairs obtained by the detection model are accurate and closely distributed, and can match the trend of the text line. In addition, the detection model is not limited by the background of the text image or the type of text content. Therefore, the above detection model also has good robustness in complex backgrounds or mixed Chinese and English scenes, and can improve the accuracy of the detection results.
[0059] Mathematical model is a scientific or engineering model constructed using mathematical logic methods and mathematical language. Mathematical model is a mathematical structure that is expressed in a general or approximate manner using mathematical language with reference to the characteristics or quantitative dependencies of a certain system of things. This mathematical structure is a relational structure depicted with the help of mathematical symbols. Mathematical model can be one or a group of algebraic equations, differential equations, difference equations, integral equations or statistical equations and their combinations, which quantitatively or qualitatively describe the mutual relationship or causal relationship between the variables of the system. In addition to mathematical models described by equations, there are also models described by other mathematical tools, such as algebra, geometry, topology, mathematical logic, etc. Among them, mathematical models describe the behavior and characteristics of the system rather than the actual structure of the system. Among them, machine learning, deep learning methods and other methods can be used to train mathematical models. Machine learning methods may include: linear regression, decision tree, random forest, etc., and deep learning methods may include: convolutional neural networks (CNN), long short-term memory networks (LSTM), gated recurrent units (GRU), etc.
[0060] In an optional embodiment of the present invention, to address the problem of possible deviation in the pairing of the first and last upper and lower key points in the detection results, the pairing of the first and last upper and lower key points in the detection results can be removed to improve the accuracy of the pairing of the upper and lower key points in the detection results.
[0061] Further optionally, if the first and last upper and lower key point pairs in the detection results are directly removed, the upper and lower key point pairs may fail to cover the first and last text in the text image, resulting in a low coverage rate of the upper and lower key point pairs for the text. In order to improve the coverage rate of the upper and lower key point pairs for the text, an embodiment of the present invention can determine the prediction results of the first and last upper and lower key point pairs based on the non-first and last upper and lower key point pairs in the detection results, and determine the upper and lower key point pairs corresponding to the text lines in the text image based on the non-first and last upper and lower key point pairs in the detection results and the prediction results.
[0062] The embodiment of the present invention can calculate the position of the head and tail upper and lower key point pairing as a prediction result based on the position information of the non-head and tail upper and lower key point pairing adjacent to the head and tail upper and lower key point pairing.
[0063] According to an embodiment, the position of the head and tail upper and lower key point pairing can be determined based on the slope of the straight line between two adjacent non-head and tail upper and lower key point pairs of the head and tail upper and lower key point pairing and the interval between two adjacent non-head and tail upper and lower key point pairs.
[0064] by Figure 2 Take the text image shown as an example, refer to Figure 7 , which shows a schematic diagram of a prediction process of pairing the first, last, upper and lower key points in an embodiment of the present invention.
[0065] Assuming that the text image includes n (n is a natural number greater than 1) upper and lower key point pairs, the last several upper and lower key point pairs are represented as: the (n-2)th upper and lower key point pair, the (n-1)th upper and lower key point pair, and the nth upper and lower key point pair. Assuming that the nth upper and lower key point pair is removed, the position of the nth upper and lower key point pair can be predicted based on the slope and interval of the straight line between the position of the (n-1)th upper and lower key point pair and the (n-2)th upper and lower key point pair, as follows: Figure 7 As shown in 701.
[0066] According to another embodiment, the position of the head and tail up and down key point pairing can be determined based on the slope of the straight line between two adjacent non-head and tail up and down key point pairs of the head and tail up and down key point pairing and the image boundary. This embodiment can be applicable to the case where the interval between two adjacent non-head and tail up and down key point pairs exceeds the image boundary.
[0067] by Figure 7As an example, assume that the upper and lower key point pairs are numbered in order from front to back to obtain the first upper and lower key point pairing, the second upper and lower key point pairing, the third upper and lower key point pairing, etc. Assuming that the first upper and lower key point pairing is removed, the position of the first upper and lower key point pairing is first predicted based on the slope and interval of the straight line between the second upper and lower key point pairing and the third upper and lower key point pairing. It can be seen that the prediction result exceeds the image boundary, so in this case, the position of the first upper and lower key point pairing can be predicted based on the above slope and image boundary, such as Figure 7 As shown in 702.
[0068] In step 102, the text image can be segmented based on the pairing of the upper and lower key points to obtain a segmented text image. When the field of view of the image acquisition device is so narrow that the complete text image cannot be directly captured, it is usually necessary to splice the sequence frame images of the image acquisition device to obtain a complete text image. The segmentation of the embodiment of the present invention can make the segmented correction image more compatible with the frame image captured by the image acquisition device, and on this basis, the accuracy of the correction of the text image can be further improved.
[0069] According to an embodiment, the number of segmented text images may be a preset value, and those skilled in the art may determine the preset value based on prior knowledge.
[0070] According to another embodiment, the number of segmented text images can be obtained based on the width of the text image and the field of view width of the image acquisition device; in this way, adaptive segmentation based on the field of view width of the image acquisition device can be achieved, thereby improving the matching degree between the segmented text image and the frame image of the image acquisition device.
[0071] In an optional embodiment of the present invention, formula (1) shows the process of determining the number of segmented text images and the process of determining the number of upper and lower key point pairs included in the segmented text images.
[0072]
[0073] Wherein, w represents the width of the text image, block_thres represents the field of view width of the image acquisition device, and with the restriction that the number of segmented text images is at least 2, team_num can represent the number of segmented text images.
[0074] num_p represents the number of upper and lower key point pairs included in the text image, and point_num represents the number of upper and lower key point pairs included in the segmented text image.
[0075] This embodiment of the present invention sets the number of segmented text images to be at least 2, and the number of upper and lower key point pairs included in the segmented text image to be at least 2, which can improve the correction speed and correction accuracy of the text image. Of course, in other embodiments of the present invention, the number of segmented text images can be less than 2, and the number of upper and lower key point pairs included in the segmented text image can be less than 2.
[0076] In step 103, the segmented text image is corrected based on the pairing of the upper and lower key points to obtain a corresponding segmented corrected image.
[0077] The embodiment of the present invention corrects the text image according to the preset direction, and the corresponding correction target may be: making the obtained corrected image match the preset direction.
[0078] In an optional embodiment of the present invention, the method may further include: stitching the segmented rectified images to obtain a rectified image. In the embodiment of the present invention, the segmented rectified images may be stitched according to the position order of the segmented rectified images corresponding to the segmented text images to obtain a rectified image. Figure 3 , which shows a schematic diagram of a corrected image according to an embodiment of the present invention, which can be used for Figure 2 The text image shown is rectified.
[0079] In an optional embodiment of the present invention, the above-mentioned correction of the segmented text image specifically includes: determining the mapping relationship between the source point and the target point corresponding to the segmented text image based on the pairing of the upper and lower key points; and mapping the segmented text image based on the mapping relationship to obtain a corresponding segmented corrected image.
[0080] The source point can represent the pixel point in the segmented text image, and the target point can represent the pixel point in the segmented rectified image.
[0081] In an optional embodiment of the present invention, the above-mentioned determination of the mapping relationship between the source point and the target point corresponding to the segmented text image may specifically include: determining the target area corresponding to the segmented text image based on the height between the upper and lower key point pairs, a preset direction, and the upper and lower key point pairs included in the segmented text image; determining the mapping relationship between the source point and the target point corresponding to the segmented text image based on the upper and lower key point pairs corresponding to the target area and the upper and lower key point pairs corresponding to the segmented text image.
[0082] Reference Figure 4 , which shows a schematic diagram of a text image, a rectified image, and a mapping relationship between a source point and a target point according to an embodiment of the present invention.
[0083] The width of the corrected image may be the width difference of the first and last upper and lower key point pairs, and the height of the corrected image may be the height difference of the first upper and lower key point pairs. Of course, the embodiment of the present invention does not limit the width of the corrected image and the height of the corrected image. For example, the width of the corrected image may be equal to the width of the text image. Alternatively, the height of the corrected image may be the average of the height differences of all upper and lower key point pairs, etc.
[0084] The embodiment of the present invention can pair the first upper and lower key points included in the segmented text image as the source point. In addition, the Y coordinate of the source point of the segmented text image can be adjusted to obtain the target point. For a segmented text image, in the corresponding segmented rectified image, the upper key point corresponds to the same Y coordinate, and the lower key point corresponds to the same Y coordinate.
[0085] The height of the target area can be the height of the corrected image, and the width of the target area can be obtained based on the width difference of the upper and lower key point pairs included in the segmented text image. The upper and lower key point pairs corresponding to the target area can correspond to the target point, and the upper and lower key point pairs corresponding to the segmented text image can correspond to the source point.
[0086] After the source point and the target point corresponding to the segmented text image are determined, the mapping relationship between the source point and the target point can be determined according to the positions of the source point and the target point corresponding to the segmented text image.
[0087] Optionally, the mapping relationship between the source point and the target point may be represented by a mapping matrix. Parameters of the mapping matrix may include: at least one of a rotation parameter, a scaling parameter, and a displacement parameter.
[0088] For example, formula (2) shows an example of a mapping matrix.
[0089]
[0090] Among them (b x , b y ) represents the displacement parameter, parameter a ij Represent the rotation parameters and scaling parameters respectively.
[0091] Optionally, the mapping of the segmented text image specifically includes: using a mapping matrix to perform a mapping transformation on the segmented text image. The mapping transformation process can be expressed by formula (3).
[0092]
[0093] Among them, (x, y) represents the coordinates of the target point, and (X, Y) represents the coordinates of the source point.
[0094] After obtaining the segmented rectified images, the segmented rectified images can be sequentially spliced into the corresponding segmented text images according to the position order of the segmented rectified images. Figure 4 On the rectified image, we can obtain Figure 3 The corrected image is shown. Figure 3 It can be seen that by applying the technical solution of the embodiment of the present invention, the originally distorted text can be corrected to nearly horizontal text.
[0095] The embodiment of the present invention can use the corrected image obtained in step 103 for text recognition to obtain text information in the corrected image. The text recognition method may include: OCR (Optical Character Recognition) method, etc. It can be understood that the embodiment of the present invention does not limit the specific text recognition method.
[0096] In summary, the image processing method of the embodiment of the present invention corrects the text image based on the pairing of upper and lower key points. Among them, the above-mentioned pairing of upper and lower key points specifically includes: an upper key point located above the text line, and a lower key point located below the text line. Since the above-mentioned pairing of upper and lower key points can characterize the trend of the text line, the embodiment of the present invention can correct the text image based on the trend of the text line, and is not limited to the background of the text image or the type of text content. Therefore, the embodiment of the present invention has good applicability to complex backgrounds such as picture books or mixed Chinese and English scenes, and further, the embodiment of the present invention can improve the accuracy of text image correction in complex backgrounds such as picture books or mixed Chinese and English scenes.
[0097] Furthermore, the embodiment of the present invention segments the text image, and corrects the obtained segmented text image based on the pairing of the upper and lower key points. The above segmentation-based image correction can improve the correction accuracy of the text image.
[0098] In addition, when the field of view of the image acquisition device is too narrow to directly capture a complete text image, it is usually necessary to splice the sequence frame images of the image acquisition device to obtain a complete text image. The segmentation of the embodiment of the present invention can make the segmented correction image more compatible with the frame image captured by the image acquisition device, and on this basis, the accuracy of text image correction can be further improved.
[0099] Method Example 2
[0100] As a learning tool that can realize self-service word lookup, translation, and spoken English learning, the dictionary pen has gradually been used in learning scenarios in recent years. It can provide a quick word lookup experience in learning scenarios where mobile phones are restricted.
[0101] The dictionary pen first uses the pen tip camera to scan the text, and then outputs a line of spliced text images for image recognition. Since the field of view of the pen tip camera is relatively narrow, the text images obtained by scanning are usually sequential frame images; therefore, in order to obtain a complete line of text images, image stitching technology is required.
[0102] In order to obtain better stitching effects, current image stitching technologies usually first perform image preprocessing on the sequential frame images, and then perform stitching on the preprocessed sequential frame images. The above image preprocessing uses operations such as binarization and dilation to estimate the tilt angle of the text in the sequential frame images, and uses the estimation results to correct the sequential frame images; in this way, the above correction can overcome the text distortion problem in the sequential frame images, and sending the corrected sequential frame images to the image stitching process can improve the flatness of the stitched images.
[0103] The inventors found in the process of implementing the embodiments of the present invention that in current image stitching technologies, in backgrounds such as white background with black text or black background with white text, the text and the background are clearly distinguishable, and better preprocessing effects and image stitching effects can be obtained; however, in complex backgrounds such as picture books, the text and the background are not clearly distinguishable, and both the obtained preprocessing results and image stitching effects are poor.
[0104] Moreover, current stitching technologies usually include: image registration and image fusion. Commonly used image registration methods are usually methods of image features. However, this method depends on the texture information of the image. If the texture information of the image is rich, more image features can be extracted; if there are many blanks or less texture information in the image, few image feature points can be extracted, and the accuracy of image registration is low. For example, in the case of a large blank or many simple-structured characters (such as the character "one") appearing in the text image, the method of image features will obtain poor image registration results.
[0105] Refer to Figure 5 , which shows the step flowchart of an embodiment of a method for determining a text image according to an embodiment of the present invention, and specifically may include the following steps:
[0106] Step 501, receive the sequential frame images collected by the image acquisition device;
[0107] Step 502, perform first image registration on the above sequential frame images according to the method of image features to obtain the corresponding registration results;
[0108] Step 503, if the above registration result is a registration failure, then perform second image registration on the above sequential frame images according to the method of image templates;
[0109] Step 504: perform image fusion on the sequence frame images according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0110] The embodiment of the present invention directly performs image registration on the sequence frame images collected by the image acquisition device. Since the embodiment of the present invention does not perform pre-processing operations such as binarization and dilation on the sequence frame images before image registration, the embodiment of the present invention can overcome the problem of inaccurate image registration caused by inaccurate pre-processing effects in complex backgrounds such as picture books, and improve the accuracy of image registration.
[0111] In addition, in order to solve the technical problem that the image feature method will obtain poor image registration results when there are large blank spaces or many characters with simple structures in the text image, the embodiment of the present application combines the image feature method and the image template method to perform image registration on the frame images. Specifically, firstly, according to the image feature method, the first image registration is performed on the sequence frame images to obtain the corresponding registration result; then, when the registration result is a registration failure, the second image registration is performed on the sequence frame images according to the image template method.
[0112] Since a failed registration result may be obtained when there are large blank spaces or more characters with simple structures in the text image, the embodiment of the present invention performs a second image registration on the sequence frame images based on the image template method in this case, which can improve the accuracy of image registration.
[0113] Figure 5 The method embodiment shown may be executed by a client and / or a server. It is to be understood that the embodiment of the present invention does not limit the specific execution subject of the method embodiment.
[0114] In step 501, the terminal may have an image acquisition device built in or externally, and collects a sequence of frame images via the image acquisition device. The sequence of frame images may include: at least two frames of images. It can be understood that the embodiment of the present invention does not limit the specific acquisition method of the sequence of frame images.
[0115] In order to improve the accuracy of image registration of the sequence frame images, the embodiment of the present invention combines step 502 and step 503 to perform image registration on the sequence frame images.
[0116] The image feature method first extracts image features, then generates feature descriptors, and finally matches the features of the two frames of images according to the similarity of the feature descriptors. Image features may include but are not limited to: points, lines (edges), regions (surfaces), etc., and may also include but are not limited to: local features and global features.
[0117] Image features may include: texture features. When there are large blank spaces or more characters with simple structures in the text image, the image feature method is likely to obtain poor image registration results. Therefore, the embodiment of the present application first performs a first image registration on the sequence frame images according to the image feature method to obtain a corresponding registration result; then, when the registration result is a registration failure, a second image registration is performed on the sequence frame images according to the image template method to overcome the problems of the image feature method and thereby improve the accuracy of image registration.
[0118] According to an embodiment, the registration result can be determined based on the matching degree between the image features. For example, if the matching degree between the image features of two adjacent frame images is less than a first threshold, the registration result is a registration failure. Alternatively, if the average matching degree between the image features of all adjacent frame images is less than a second threshold, the registration result is a registration failure, etc.
[0119] According to another embodiment, the above-mentioned first image registration of the sequence frame images specifically includes: performing feature matching on two adjacent frame images in the sequence frame images to obtain a feature matching pair; clustering the feature matching pairs to obtain corresponding clustering results; if the clustering results do not meet preset conditions, the obtained registration result includes a registration failure.
[0120] The embodiment of the present invention determines the registration result based on the clustering result of the feature matching pair. The clustering result can characterize the overall matching situation of the sequence frame images in terms of image features, and thus can be used as a basis for determining the registration result.
[0121] Optionally, the above preset conditions specifically include: the number of feature matching pairs contained in any clustering category is greater than the number threshold. In this way, when the preset conditions are not met, the number of feature matching pairs contained in all clustering categories is not greater than the number threshold, which can indicate that the overall matching of the sequence frame images in terms of image features does not meet expectations. In this case, image registration will result in a lower accuracy rate. Therefore, in this case, the registration result can be set as registration failure, so that another registration method can be used for registration.
[0122] In practical applications, the number of feature matching pairs contained in all clustering categories can be compared with the number threshold, respectively. Alternatively, the target clustering category containing the largest number of feature matching pairs can be first determined, and then the number of feature matching pairs contained in the target clustering category can be compared with the number threshold.
[0123] In an optional embodiment of the present invention, the first image registration of the sequence frame images may further include: if the clustering result meets the preset conditions, a registration result of successful configuration may be obtained. In this case, the motion transformation parameters corresponding to a single feature matching pair may be determined based on the statistical results of the motion transformation parameters corresponding to the multiple feature matching pairs contained in the sequence frame images. The motion transformation parameters may be used for further image fusion.
[0124] If the clustering result meets the preset conditions, it can indicate that the overall matching of the sequence frame images in terms of image features can meet expectations. In this case, image registration will achieve a higher accuracy. The embodiment of the present invention can perform the first image registration using the image feature method to obtain the corresponding motion transformation parameters.
[0125] The statistical results of the motion transformation parameters corresponding to the multiple feature matching pairs may include: the average of the motion transformation parameters corresponding to the multiple feature matching pairs, etc. The statistical results are used as the motion transformation parameters corresponding to the single feature matching pair, so as to fuse the two frames of images corresponding to the single feature matching pair according to the motion transformation parameters corresponding to the single feature matching pair.
[0126] In an application example of the present invention, it is assumed that the image frame sequence is {I1, I2, …, I n}, the method based on image features, performing first image registration on the sequence frame images, may specifically include the following steps:
[0127] Step A1: extract features from the above sequence frame images to obtain image I i image features; i can be a natural number greater than 0, and n can be a natural number greater than 1;
[0128] Step A2: image I i-1 and image I i Perform feature matching on the image features to obtain a feature matching pair;
[0129] The feature matching pair can be represented by the displacement vector p j =(dx j ,dy j ) is used to represent the distance between feature matching pairs, and d(p i ,p j )=|dx i -dx j |+|dy i -dy j | to indicate.
[0130] Step A3: clustering all feature matching pairs to obtain multiple cluster categories;
[0131] Step A4: for the target cluster category containing the most feature matching pairs, the number m of feature matching pairs contained in the target cluster category is compared with the number threshold T. If m<T, it is considered that the registration has failed, otherwise it is considered that the registration has succeeded.
[0132] If the registration is successful, the image I is determined based on the mean of the displacement vectors of all feature matching pairs. i-1 and image I i The relative displacement (x i ,y i ), which can be expressed by formula (4):
[0133]
[0134] In step 503, if the registration result is a registration failure, a second image registration is performed on the sequence frame images according to an image template method.
[0135] The image template method can use correlation operations and other methods to calculate the correlation value to find the best matching position. Template matching (Blocking Matching) is to find a sub-image that matches the template image in another frame based on a known template image.
[0136] Specifically in the embodiment of the present invention, the image I i As a template image, in image I i-1 Total Search and Image I i The matching sub-image.
[0137] In an optional embodiment of the present invention, the above-mentioned second image registration of the sequence frame images specifically includes: determining the matching degree of the corresponding overlapping parts of two adjacent frame images in the sequence frame images; and determining the motion transformation parameters corresponding to the two adjacent frame images based on the motion transformation parameters corresponding to the matching degree.
[0138] Optionally, the image I i In the image I i-1 Slide on the image frame, determine the matching degree of the overlapping parts of the two frames in the case of real-time displacement vector, and record the displacement vector (x i ,y i ), as image I i-1 and image I i relative displacement.
[0139] It can be understood that the above displacement vector is only an example of motion transformation parameters. In fact, those skilled in the art can adopt other motion transformation parameters, such as image rotation parameters, image scaling parameters, etc. according to actual application requirements. It can be understood that the embodiments of the present invention do not limit the specific motion transformation parameters.
[0140] The embodiment of the present invention may output the motion transformation parameters obtained in step 502 or step 503, or may use the motion transformation parameters obtained in step 502 or step 503 in image processing scenarios such as image fusion.
[0141] In step 504, the sequence frame images are fused according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0142] Image fusion is the process of synthesizing at least two frames of images according to the motion transformation parameters between the images to obtain a complete image.
[0143] In an optional embodiment of the present invention, during the image fusion process, the first frame image in the sequence of frame images can be used as a reference frame, and the other frame images in the sequence of frame images except the first frame image can be transformed into the coordinate system of the first frame image. i The translation vector relative to image I1 can be expressed by formula (5):
[0144]
[0145] Optionally, in the process of image fusion of two adjacent frames of images, the pixel average of the overlapping parts of the two frames of images is taken.
[0146] In summary, the image processing method of the embodiment of the present invention directly performs image registration on the sequence frame images collected by the image acquisition device. Since the embodiment of the present invention does not perform pre-processing operations such as binarization and dilation on the sequence frame images before image registration, the embodiment of the present invention can overcome the problem of inaccurate image registration caused by inaccurate pre-processing effects in complex backgrounds such as picture books, and improve the accuracy of image registration.
[0147] It should be noted that the embodiment of the present invention does not perform preprocessing operations such as binarization and dilation on the sequence frame images before image registration, and directly performs image registration on the sequence frame images collected by the image acquisition device; this may cause problems such as distorted text in the text image obtained by image fusion. Figure 1 The method embodiment 1 shown corrects the text image based on the pairing of upper and lower key points, which can overcome the problem of distorted text in the text image to a certain extent. On this basis, the corrected image is used for text recognition, which can improve the accuracy of text recognition.
[0148] Method Example 3
[0149] Reference Figure 6 , shows a flowchart of the steps of a third embodiment of an image processing method of the present invention, which may specifically include the following steps:
[0150] Step 601, receiving a sequence of frame images acquired by an image acquisition device;
[0151] Step 602: Perform first image registration on the sequence frame images according to the image feature method to obtain corresponding registration results;
[0152] Step 603: If the registration result is a registration failure, a second image registration is performed on the sequence frame images according to an image template method;
[0153] Step 604: performing image fusion on the sequence frame images according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image;
[0154] Step 605: Determine the upper and lower key point pairs corresponding to the text lines in the text image;
[0155] The pairing of the upper and lower key points specifically includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0156] Step 606: segment the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0157] Step 607: correct the segmented text image according to the pairing of the upper and lower key points to obtain a corresponding segmented corrected image;
[0158] Step 608: stitching the above segmented corrected images to obtain a corrected image;
[0159] Step 609: Perform text recognition on the corrected image to obtain corresponding text information.
[0160] The image processing method of the embodiment of the present invention can be applied to scenarios such as dictionary pens to process sequence frame images captured by the dictionary pen and finally obtain text information corresponding to the frame images, thereby providing functions such as word search and translation based on the text information.
[0161] The image processing method may include: an image stitching process, an image correction process and a text recognition process to obtain text information in the source image.
[0162] Among them, steps 601 to 604 correspond to the image stitching process, steps 605 to 608 correspond to the image correction process, and step 609 corresponds to the text recognition process.
[0163] It should be noted that, for the method embodiments, for the sake of simplicity of description, they are all described as a series of motion action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the described motion actions, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the motion actions involved are not necessarily required by the embodiments of the present invention.
[0164] Device Embodiment
[0165] Reference Figure 8 , shows a structural block diagram of an embodiment of an image processing device of the present invention, which may specifically include:
[0166] The determination module 801 is used to determine the upper and lower key point pairs corresponding to the text line in the text image; the upper and lower key point pairs may include: an upper key point located above the text line, and a lower key point located below the text line; the line between the upper key point and the lower key point is perpendicular to a preset direction;
[0167] A segmentation module 802 is used to segment the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0168] The correction module 803 is used to correct the segmented text image according to the pairing of the upper and lower key points to obtain a corresponding segmented corrected image.
[0169] Optionally, the correction module 803 may include:
[0170] A mapping determination module, used to determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the pairing of the upper and lower key points;
[0171] The mapping module is used to map the segmented text image according to the mapping relationship to obtain a corresponding segmented corrected image.
[0172] Optionally, the interval between two adjacent upper key points is a preset interval.
[0173] Optionally, the determination module 801 may include:
[0174] A detection module, used to determine the detection result of the upper and lower key point pairing corresponding to the text line in the text image according to the detection model; the above-mentioned detection model is trained based on the text image samples and their corresponding annotated upper and lower key point pairings;
[0175] A removal module is used to remove the first and last key point pairs in the above detection results;
[0176] A prediction module, used to determine the prediction result of the head and tail upper and lower key point pairing according to the non-head and tail upper and lower key point pairing in the above detection results;
[0177] The pairing determination module is used to determine the upper and lower key point pairs corresponding to the text lines in the text image based on the non-first and last upper and lower key point pairs in the above detection results and the above prediction results.
[0178] Optionally, the number of the segmented text images is obtained according to the width of the text image and the field of view width of the image acquisition device.
[0179] Optionally, the mapping determination module may include:
[0180] A target region determination module, used for determining a target region corresponding to the segmented text image according to a height between the first upper and lower key point pairs, a preset direction, and the upper and lower key point pairs that the segmented text image may include;
[0181] The mapping relationship determination module is used to determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the upper and lower key point pairings corresponding to the target area and the upper and lower key point pairings corresponding to the segmented text image.
[0182] Optionally, the above device may further include:
[0183] The stitching module is used to stitch the above segmented rectified images to obtain a rectified image.
[0184] Optionally, the above device may further include:
[0185] A receiving module, used for receiving a sequence of frame images collected by an image acquisition device;
[0186] A first image registration module, used to perform first image registration on the sequence frame images according to the image feature device to obtain a corresponding registration result;
[0187] A second image registration module, configured to perform a second image registration on the sequence frame images according to the image template device if the registration result is a registration failure;
[0188] The image fusion module is used to perform image fusion on the sequence frame images according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0189] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0190] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0191] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0192] Fig. 9 1 is a block diagram of an apparatus 1300 for image processing according to an exemplary embodiment. For example, the apparatus 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0193] Reference Fig. 9 , the device 1300 may include one or more of the following components: a processing component 1302 , a memory 1304 , a power component 1306 , a multimedia component 1308 , an audio component 1310 , an input / output (I / O) interface 1312 , a sensor component 1314 , and a communication component 1316 .
[0194] The processing component 1302 generally controls the overall operation of the device 1300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 1302 may include one or more modules to facilitate interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate interaction between the multimedia component 1308 and the processing component 1302.
[0195] The memory 1304 is configured to store various types of data to support operations on the device 1300. Examples of such data include instructions for any application or method operating on the device 1300, contact data, phone book data, messages, pictures, videos, etc. The memory 1304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0196] The power supply component 1306 provides power to the various components of the device 1300. The power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 1300.
[0197] The multimedia component 1308 includes a screen that provides an output interface between the device 1300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front camera and / or a rear camera. When the device 1300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0198] The audio component 1310 is configured to output and / or input audio signals. For example, the audio component 1310 includes a microphone (MIC), and when the device 1300 is in an operation mode, such as a call mode, a recording mode, and a voice data processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1304 or sent via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.
[0199] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0200] The sensor assembly 1314 includes one or more sensors for providing various aspects of the status assessment of the device 1300. For example, the sensor assembly 1314 can detect the open / closed state of the device 1300, the relative positioning of components, such as the display and keypad of the device 1300, the sensor assembly 1314 can also detect the position change of the device 1300 or a component of the device 1300, the presence or absence of user contact with the device 1300, the orientation or acceleration / deceleration of the device 1300, and the temperature change of the device 1300. The sensor assembly 1314 can include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1314 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 can also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0201] The communication component 1316 is configured to facilitate wired or wireless communication between the device 1300 and other devices. The device 1300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency data processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0202] In an exemplary embodiment, the device 1300 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned methods.
[0203] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1304 including instructions, and the instructions can be executed by the processor 1320 of the device 1300 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0204] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a terminal, enables the terminal to execute an image processing method, the method comprising: determining an upper and lower key point pairing corresponding to a text line in a text image; the upper and lower key point pairing comprises: an upper key point located above the text line, and a lower key point located below the text line; the line between the upper key point and the lower key point is perpendicular to a preset direction; based on the upper and lower key point pairing, the text image is segmented to obtain a segmented text image; based on the upper and lower key point pairing, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0205] Fig.10 1 is a schematic diagram of the structure of the server in an embodiment of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.
[0206] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0207] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0208] It should be understood that the present invention is not limited to the precise structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0209] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0210] The embodiment of the present invention discloses A1, an image processing method, comprising:
[0211] Determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0212] Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0213] According to the pairing of the upper and lower key points, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0214] A2. According to the method of A1, the correction of the segmented text image comprises:
[0215] Determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the pairing of the upper and lower key points;
[0216] According to the mapping relationship, the segmented text image is mapped to obtain a corresponding segmented rectified image.
[0217] A3. According to the method described in A1, the interval between two adjacent upper key points is a preset interval.
[0218] A4. The method according to A1, wherein determining the pairing of upper and lower key points corresponding to the text lines in the text image comprises:
[0219] Determine the detection result of the upper and lower key point pairing corresponding to the text line in the text image according to the detection model; the detection model is trained based on the text image sample and its corresponding annotated upper and lower key point pairing;
[0220] Remove the first and last key point pairs in the detection result;
[0221] Determine the prediction result of the head and tail upper and lower key point pairing according to the non-head and tail upper and lower key point pairing in the detection result;
[0222] The upper and lower key point pairs corresponding to the text lines in the text image are determined according to the non-first and last upper and lower key point pairs in the detection results and the prediction results.
[0223] A5. According to the method described in A1, the number of the segmented text images is obtained based on the width of the text image and the field of view width of the image acquisition device.
[0224] A6. The method according to A2, wherein determining the mapping relationship between the source point and the target point corresponding to the segmented text image comprises:
[0225] Determine a target area corresponding to the segmented text image according to a height between the first upper and lower key point pairs, a preset direction, and the upper and lower key point pairs included in the segmented text image;
[0226] According to the pairing of upper and lower key points corresponding to the target area and the pairing of upper and lower key points corresponding to the segmented text image, a mapping relationship between source points and target points corresponding to the segmented text image is determined.
[0227] A7. The method according to any one of A1 to A6, further comprising:
[0228] The segmented rectified images are spliced to obtain a rectified image.
[0229] A8. According to any one of the methods described in A1 to A6, the text image is determined by the following steps:
[0230] Receiving a sequence of frame images acquired by an image acquisition device;
[0231] Performing a first image registration on the sequence frame images according to an image feature method to obtain a corresponding registration result;
[0232] If the registration result is a registration failure, performing a second image registration on the sequence frame images according to an image template method;
[0233] The sequence frame images are fused according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0234] The embodiment of the present invention discloses B9, an image processing device, comprising:
[0235] A determination module, used to determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0236] A segmentation module, used for segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0237] The correction module is used to correct the segmented text image according to the pairing of the upper and lower key points to obtain a corresponding segmented corrected image.
[0238] B10. According to the device described in B9, the correction module comprises:
[0239] A mapping determination module, used to determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the pairing of the upper and lower key points;
[0240] A mapping module is used to map the segmented text image according to the mapping relationship to obtain a corresponding segmented corrected image.
[0241] B11. According to the device described in B9, the interval between two adjacent upper key points is a preset interval.
[0242] B12. According to the apparatus described in B9, the determining module includes:
[0243] A detection module, used to determine the detection result of the upper and lower key point pairing corresponding to the text line in the text image according to the detection model; the detection model is trained based on the text image samples and the corresponding annotated upper and lower key point pairings;
[0244] A removal module, used to remove the first and last key point pairs in the detection result;
[0245] A prediction module, used to determine the prediction result of the head and tail upper and lower key point pairing according to the non-head and tail upper and lower key point pairing in the detection result;
[0246] The pairing determination module is used to determine the upper and lower key point pairs corresponding to the text lines in the text image based on the non-first and last upper and lower key point pairs in the detection results and the prediction results.
[0247] B13. According to the device described in B9, the number of segmented text images is obtained based on the width of the text image and the field of view width of the image acquisition device.
[0248] B14. According to the apparatus described in B10, the mapping determination module includes:
[0249] A target region determination module, used to determine a target region corresponding to the segmented text image according to a height between the first upper and lower key point pairs, a preset direction, and the upper and lower key point pairs included in the segmented text image;
[0250] The mapping relationship determination module is used to determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the upper and lower key point pairings corresponding to the target area and the upper and lower key point pairings corresponding to the segmented text image.
[0251] B15. The device according to any one of B9 to B14, further comprising:
[0252] The stitching module is used to stitch the segmented rectified images to obtain a rectified image.
[0253] B16. The device according to any one of B9 to B14, further comprising:
[0254] A receiving module, used for receiving a sequence of frame images collected by an image acquisition device;
[0255] A first image registration module, configured to perform first image registration on the sequence frame images according to the image feature device to obtain a corresponding registration result;
[0256] A second image registration module, configured to perform a second image registration on the sequence frame images according to an image template device if the registration result is a registration failure;
[0257] The image fusion module is used to perform image fusion on the sequence frame images according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0258] The embodiment of the present invention discloses C17, a device for image processing, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations:
[0259] Determine an upper and lower key point pair corresponding to a text line in a text image; the upper and lower key point pair includes: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction;
[0260] Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image;
[0261] According to the pairing of the upper and lower key points, the segmented text image is corrected to obtain a corresponding segmented corrected image.
[0262] C18. According to the device described in C17, the correcting of the segmented text image comprises:
[0263] Determine the mapping relationship between the source point and the target point corresponding to the segmented text image according to the pairing of the upper and lower key points;
[0264] According to the mapping relationship, the segmented text image is mapped to obtain a corresponding segmented rectified image.
[0265] C19. According to the device described in C17, the interval between two adjacent upper key points is a preset interval.
[0266] C20. According to the apparatus described in C17, the step of determining the pairing of upper and lower key points corresponding to the text lines in the text image comprises:
[0267] Determine the detection result of the upper and lower key point pairing corresponding to the text line in the text image according to the detection model; the detection model is trained based on the text image sample and its corresponding annotated upper and lower key point pairing;
[0268] Remove the first and last key point pairs in the detection result;
[0269] Determine the prediction result of the head and tail upper and lower key point pairing according to the non-head and tail upper and lower key point pairing in the detection result;
[0270] The upper and lower key point pairs corresponding to the text lines in the text image are determined according to the non-first and last upper and lower key point pairs in the detection results and the prediction results.
[0271] C21. According to the device described in C17, the number of segmented text images is obtained based on the width of the text image and the field of view width of the image acquisition device.
[0272] C22. According to the apparatus described in C18, the determining of the mapping relationship between the source point and the target point corresponding to the segmented text image comprises:
[0273] Determine a target area corresponding to the segmented text image according to a height between the first upper and lower key point pairs, a preset direction, and the upper and lower key point pairs included in the segmented text image;
[0274] According to the pairing of upper and lower key points corresponding to the target area and the pairing of upper and lower key points corresponding to the segmented text image, a mapping relationship between source points and target points corresponding to the segmented text image is determined.
[0275] C23. The device according to any one of C17 to C22, wherein the device is further configured to execute, by one or more processors, the one or more programs including instructions for performing the following operations:
[0276] The segmented rectified images are spliced to obtain a rectified image.
[0277] C24. The device according to any one of C17 to C22, wherein the device is further configured to execute, by one or more processors, the one or more programs including instructions for performing the following operations:
[0278] Receiving a sequence of frame images acquired by an image acquisition device;
[0279] According to the device of the image features, a first image registration is performed on the sequence frame images to obtain a corresponding registration result;
[0280] If the registration result is a registration failure, performing a second image registration on the sequence frame images according to the device of the image template;
[0281] The sequence frame images are subjected to image fusion according to the motion transformation parameters obtained by the first image registration or the second image registration to obtain a text image.
[0282] The embodiment of the present invention discloses D25, one or more machine-readable media having instructions stored thereon, which, when executed by one or more processors, enable the device to execute one or more of the methods described in A1 to A8.
[0283] The above is a detailed introduction to an image processing method, an image processing device and a device for image processing provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An image processing method, characterized in that: The method comprises: Determining upper and lower key point pairs corresponding to text lines in a text image, comprising: acquiring upper and lower key point pairing information based on a detection model; the upper and lower key point pairs comprising: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction; Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image; According to the upper and lower key point pairings, the segmented text image is corrected to obtain a corresponding segmented corrected image, including: determining a mapping relationship between source points and target points corresponding to the segmented text image according to the upper and lower key point pairings; mapping the segmented text image according to the mapping relationship to obtain a corresponding segmented corrected image; the determining the mapping relationship between source points and target points corresponding to the segmented text image includes: determining a target area corresponding to the segmented text image according to a height between the upper and lower key point pairings, a preset direction, and the upper and lower key point pairings included in the segmented text image; determining a mapping relationship between source points and target points corresponding to the segmented text image according to the upper and lower key point pairings corresponding to the target area and the upper and lower key point pairings corresponding to the segmented text image.
2. The method according to claim 1, characterized in that The interval between two adjacent upper key points is the preset interval.
3. The method according to claim 1, characterized in that The step of determining the pairing of upper and lower key points corresponding to the text lines in the text image includes: Determine the detection result of the upper and lower key point pairing corresponding to the text line in the text image according to the detection model; the detection model is trained based on the text image sample and its corresponding annotated upper and lower key point pairing; Remove the first and last key point pairs in the detection result; Determine the prediction result of the head and tail upper and lower key point pairing according to the non-head and tail upper and lower key point pairing in the detection result; The upper and lower key point pairs corresponding to the text lines in the text image are determined according to the non-first and last upper and lower key point pairs in the detection results and the prediction results.
4. The method according to claim 1, characterized in that: The number of the segmented text images is obtained according to the width of the text image and the field of view width of the image acquisition device.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The segmented rectified images are spliced to obtain a rectified image.
6. An image processing device, characterized in that: include: A determination module, used to determine the upper and lower key point pairing corresponding to the text line in the text image, comprising: obtaining the upper and lower key point pairing information based on the detection model; the upper and lower key point pairing includes: an upper key point located above the text line, and a lower key point located below the text line; a line between the upper key point and the lower key point is perpendicular to a preset direction; A segmentation module, used for segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image; The correction module is used to correct the segmented text image according to the upper and lower key point pairing to obtain a corresponding segmented corrected image, including: determining the mapping relationship between the source point and the target point corresponding to the segmented text image according to the upper and lower key point pairing; mapping the segmented text image according to the mapping relationship to obtain a corresponding segmented corrected image; the determining the mapping relationship between the source point and the target point corresponding to the segmented text image includes: determining the target area corresponding to the segmented text image according to the height between the upper and lower key point pairings, a preset direction, and the upper and lower key point pairings included in the segmented text image; determining the mapping relationship between the source point and the target point corresponding to the segmented text image according to the upper and lower key point pairings corresponding to the target area and the upper and lower key point pairings corresponding to the segmented text image.
7. A device for image processing, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations: Determining upper and lower key point pairs corresponding to text lines in a text image, comprising: acquiring upper and lower key point pairing information based on a detection model; the upper and lower key point pairs comprising: an upper key point located above the text line, and a lower key point located below the text line; a line connecting the upper key point and the lower key point is perpendicular to a preset direction; Segmenting the text image according to the pairing of the upper and lower key points to obtain a segmented text image; According to the upper and lower key point pairings, the segmented text image is corrected to obtain a corresponding segmented corrected image, including: determining a mapping relationship between source points and target points corresponding to the segmented text image according to the upper and lower key point pairings; mapping the segmented text image according to the mapping relationship to obtain a corresponding segmented corrected image; the determining the mapping relationship between source points and target points corresponding to the segmented text image includes: determining a target area corresponding to the segmented text image according to a height between the upper and lower key point pairings, a preset direction, and the upper and lower key point pairings included in the segmented text image; determining a mapping relationship between source points and target points corresponding to the segmented text image according to the upper and lower key point pairings corresponding to the target area and the upper and lower key point pairings corresponding to the segmented text image.
8. One or more machine-readable media, characterized in that Instructions are stored thereon, which, when executed by one or more processors, cause the apparatus to perform the method as claimed in any one of claims 1 to 5.
