A method and device for generating three-dimensional deformed text image

By determining the deformation curve function and generating a three-dimensional surface, and combining two-dimensional text images for projection and interpolation, the problems of high cost and slow generation of three-dimensional deformation text images in the prior art are solved, and fast and effective three-dimensional deformation text image generation is achieved, which is suitable for text recognition training in complex scenarios.

CN112330786BActive Publication Date: 2025-02-28阳光保险集团股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011215288.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-03
Publication Date
2025-02-28
Estimated Expiration
2040-11-03

AI Technical Summary

Technical Problem

In the process of simulating three-dimensional deformation text in real scenes, the prior art requires manual preparation of a large number of three-dimensional scene grids in advance, resulting in high cost and slow speed.

Method used

By determining the deformation curve function, a three-dimensional surface of the three-dimensional deformation text image is generated based on the direction length and curve function of the two-dimensional text image, and a three-dimensional deformation text image is combined for projection and interpolation, and a three-dimensional deformation text image is generated in real time and randomly.

Benefits of technology

It realizes the generation of three-dimensional deformation text images quickly and effectively simulates the generation of three-dimensional deformation text images, reduces the need for artificial grid preparation, improves efficiency and accuracy, and is suitable for text recognition training in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112330786B_ABST
    Figure CN112330786B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method and device for generating a three-dimensional deformed text image, the method comprising determining a deformation curve function; determining a curve segment corresponding to a cross section of the three-dimensional deformed text image according to a first direction length of a two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle; extending the curve segment in a second direction of the two-dimensional text image according to a second direction length of the two-dimensional text image to obtain a three-dimensional curved surface of the three-dimensional deformed text image; and obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image. This method can not only simulate three-dimensional deformed text images in real time, randomly, quickly, and effectively, but also the three-dimensional deformed text images generated by this method can be used as samples for text recognition in complex scenes and trained, which is conducive to improving the accuracy of text recognition in complex scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a method and device for generating a three-dimensional deformed text image. Background Art

[0002] With the continuous improvement of deep learning-based text recognition technology and the performance of hardware such as image processors, the application scenarios of text recognition have been continuously expanded, from simple scenarios such as ID card and bank card recognition with fixed layout, limited text content, and text that is not easily deformed in three dimensions, to complex scenarios such as medical bills, insurance contracts, and compensation agreements with variable layout, dense text, large length, and text that is easily deformed in three dimensions.

[0003] There are two main methods for synthesizing three-dimensional deformed text samples: one is to quickly synthesize three-dimensional deformed text samples simply through perspective transformation. This method has a fast synthesis speed and can provide three-dimensional visual effects, but it can only simulate rigid body deformation and stretching effects, and it is difficult to simulate three-dimensional deformation in real scenes. The other is to generate a three-dimensional grid of text deformation in real scenes in advance, and then synthesize the final two-dimensional image sample through two-dimensional projection and two-dimensional interpolation methods. The synthesis effect is closest to the real situation. The disadvantage is that a large number of three-dimensional scene grids need to be manually prepared in advance to meet the synthesis requirements of text recognition samples. The synthesis cost is high and the speed is slow. In view of this, it is necessary to design a text sample synthesis method that can generate text in real time and randomly, and can simulate the three-dimensional deformation of real scenes. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method and device for generating a three-dimensional deformed text image, so as to improve the existing simulation of three-dimensional deformed text in real scenes, which requires a large number of three-dimensional scene grids to be manually prepared in advance, resulting in high costs and slow speed.

[0005] In a first aspect, an embodiment of the present application provides a method for generating a three-dimensional deformed text image, the method comprising: determining a deformation curve function; determining a curve segment corresponding to a cross-section of the three-dimensional deformed text image based on a first direction length of a two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle; extending the curve segment in a second direction of the two-dimensional text image based on a second direction length of the two-dimensional text image to obtain a three-dimensional surface of the three-dimensional deformed text image; and obtaining the three-dimensional deformed text image based on the three-dimensional surface and the two-dimensional text image.

[0006] In the above implementation process, by determining the deformation curve function, then determining the curve segment corresponding to the cross section of the three-dimensional deformed text image according to the first direction length of the two-dimensional text image and the deformation curve function, and extending the curve segment in the second direction of the two-dimensional text image according to the second direction length of the two-dimensional text image, a three-dimensional surface of the three-dimensional deformed text image is obtained, and then a three-dimensional deformed text image is obtained according to the three-dimensional surface and the two-dimensional text image. This method can not only simulate the three-dimensional deformed text image in real time, randomly, quickly and effectively, but also the three-dimensional deformed text image generated by this method can be used as a sample for text recognition in complex scenes and trained, which is conducive to improving the accuracy of text recognition in complex scenes.

[0007] In combination with the first aspect, in one embodiment, obtaining the three-dimensional deformed text image based on the three-dimensional curved surface and the two-dimensional text image includes: vertically projecting the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image; gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image; and performing two-dimensional interpolation on the grid coordinates according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

[0008] In the above implementation process, grid coordinates close to the resolution of the two-dimensional text image are generated according to the vertical projection of the three-dimensional surface and the size of the two-dimensional text image, and then the generated grid coordinates are two-dimensionally interpolated according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image, thereby quickly and effectively simulating the synthesis of three-dimensional deformed text.

[0009] In combination with the first aspect, in another implementation, the three-dimensional deformed text image is obtained based on the three-dimensional surface and the two-dimensional text image, including: obtaining an initial three-dimensional deformed text image based on the three-dimensional surface and the two-dimensional text image; performing at least one of depth of field blur simulation, lighting simulation and perspective transformation on the initial three-dimensional deformed text image to obtain the three-dimensional deformed text image.

[0010] In the above implementation process, by performing depth of field blur simulation on the initial three-dimensional deformed text image, it is possible to simulate the real scene. Text images are mostly shot at close range, and the three-dimensional deformed images are prone to blurring due to the depth of field; lighting simulation is performed on the initial three-dimensional deformed text image, so that the three-dimensional objects in the real scene can be simulated. Due to the change in height, uneven lighting and shadow effects are often produced; perspective transformation is performed on the initial three-dimensional deformed text image, so that complex three-dimensional projection simulation can be achieved.

[0011] In combination with the first aspect, in another embodiment, performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to the cross-sectional height of the initial three-dimensional deformed text image; performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to the cross-sectional gradient of the initial three-dimensional deformed text image.

[0012] In the above implementation process, the depth of field blur simulation is performed on the initial three-dimensional deformed text image according to the cross-sectional height of the initial three-dimensional deformed text image, which can simulate the real scene. Text images are mostly shot at a close distance, and the three-dimensional deformed images are prone to blurring due to the depth of field; the lighting simulation is performed on the initial three-dimensional deformed text image according to the cross-sectional gradient of the initial three-dimensional deformed text image, which can simulate the three-dimensional objects in the real scene. Due to the change in height, uneven lighting and shadow effects often occur.

[0013] In a second aspect, an embodiment of the present application provides a device for generating a three-dimensional deformed text image, the device comprising: a generation module for determining a deformation curve function; a processing module for determining a curve segment corresponding to a cross-section of the three-dimensional deformed text image based on a first direction length of the two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle; the processing module is also used to extend the curve segment in a second direction of the two-dimensional text image based on a second direction length of the two-dimensional text image to obtain a three-dimensional surface of the three-dimensional deformed text image; the processing module is also used to obtain the three-dimensional deformed text image based on the three-dimensional surface and the two-dimensional text image.

[0014] In combination with the second aspect, in one embodiment, the processing module is used to obtain the three-dimensional deformed text image based on the three-dimensional curved surface and the two-dimensional text image, and is specifically used to: vertically project the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image; grid the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image; and perform two-dimensional interpolation on the grid coordinates according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

[0015] In combination with the second aspect, in another embodiment, the processing module is used to obtain the three-dimensional deformed text image based on the three-dimensional surface and the two-dimensional text image, and is specifically used to: obtain an initial three-dimensional deformed text image based on the three-dimensional surface and the two-dimensional text image; perform at least one of depth of field blur simulation, lighting simulation and perspective transformation on the initial three-dimensional deformed text image to obtain the three-dimensional deformed text image.

[0016] In combination with the second aspect, in another embodiment, performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to the cross-sectional height of the initial three-dimensional deformed text image; performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to the cross-sectional gradient of the initial three-dimensional deformed text image.

[0017] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory and a bus, wherein the processor is connected to the memory via the bus, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are executed.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a server, the steps in the method provided in the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 A flowchart of a method for generating a three-dimensional deformed text image provided by an embodiment of the present application;

[0021] Figure 2 A schematic diagram of a curve function expression of a three-dimensional deformed cross section provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a three-dimensional linear curve function of a three-dimensional deformed cross section provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of a curve segment of a ternary linear curve of a three-dimensional deformed cross section under the condition of length invariance provided by an embodiment of the present application;

[0024] Figure 5 A schematic diagram of a three-dimensional deformed text image generated after depth of field blur simulation and illumination simulation provided in an embodiment of the present application;

[0025] Figure 6A schematic diagram of a three-dimensional deformed text image generated after depth of field blur simulation, illumination simulation and perspective transformation provided in an embodiment of the present application;

[0026] Figure 7 A structural block diagram of a device for three-dimensional text image deformation provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0029] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0030] Please refer to Figure 1 , Figure 1 A flowchart of a method for generating a three-dimensional deformed text image provided in an embodiment of the present application, which can be applied to Figure 7 The device for generating a three-dimensional deformed text image shown in FIG. Figure 1 The methods shown include:

[0031] 110, determine the deformation curve function.

[0032] Determine the deformation curve function;

[0033] Specifically, the curve function of the three-dimensional deformed surface section is determined. It should be understood that the curve function can be obtained by modeling the three-dimensional deformed surface section through symbolic calculation, or it can be obtained by adjusting the parameters of the curve function on a known curve function, but the embodiments of the present application are not limited to this.

[0034] The deformation curve function may be in the form of a linear function, a quadratic curve function, a cubic curve function, or a quartic curve function, but the embodiments of the present application are not limited thereto.

[0035] As an embodiment, the deformation curve function is in the form of a cubic curve function, such as Figure 2 As shown, Figure 2 A schematic diagram of a curve function expression of a three-dimensional deformed cross section provided in an embodiment of the present application is shown in FIG. 1 , and the expression of the deformation curve function is:

[0036] f(x)=a*x 3 +b*x 2 +c*x+d (1)

[0037] Where x represents the horizontal coordinate of the curve;

[0038] f(x) represents the value of the curve function when the horizontal axis is x;

[0039] a, b, c, d represent the coefficients of the curve function.

[0040] By randomly changing the function coefficients of the curve function expression of the three-dimensional deformed section, different curve function expressions can be obtained, thereby obtaining an arbitrarily deformed curve section.

[0041] For Figure 2 The cubic curve function shown has four coefficients that need to be solved. The four conditions given can be solved. In order to achieve a fast solution, the following four conditions are given respectively:

[0042]

[0043] Wherein, f(0)=value1 means that when the horizontal coordinate x=0, the value of the curve function is value1;

[0044] f′(0)=value2 means that when the horizontal coordinate x=0, the value of the derivative of the curve function is value2;

[0045] f(1)=value3 means that when the horizontal coordinate x=1, the value of the curve function is value3;

[0046] f′(1)=value4 means that when the horizontal coordinate x=1, the value of the derivative of the curve function is value4.

[0047] The cross section parameters can be solved. Therefore, in actual use, only the above four conditions need to be given randomly to achieve modeling and solving of any cubic curve cross section.

[0048] As an embodiment, if the cross section is a three-dimensional linear curve, and f(0)=0, f(1)=0, f′(0)=-4, and f′(1)=1 are set respectively, the schematic diagram of the generated curve is as follows: Figure 3 As shown, Figure 3 A schematic diagram of a ternary linear curve function of a three-dimensional deformed cross section provided in an embodiment of the present application.

[0049] It should be understood that if a more complex cross-section expression is used, the corresponding solution conditions can be added. For example, if the cross-section expression is a quartic curve, then five conditions can be given to achieve modeling and solving of any quintic curve cross section, and the embodiments of the present application are not limited to this.

[0050] 120, generate a deformation curve segment.

[0051] Determining a curve segment corresponding to a cross section of the three-dimensional deformed text image according to a first direction length of the two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle;

[0052] Specifically, the deformed curve segments are generated considering the condition of length invariance.

[0053] The input shape is a rectangular 2D text image. Assuming that the width of the cross section of the 2D text image before deformation (i.e., the length in the first direction) is normalized, its width is 1. To obtain the cross-sectional projection of the image after deformation corresponding to the curve, i.e., the curve segment corresponding to the cross section of the 3D deformed text image, it is necessary to consider the invariance of the length of the paper in the real situation, i.e., the length of the curve corresponding to the image after deformation must meet the following conditions:

[0054]

[0055] in, This means that when x is in the range [0, x], the length of the curve is equal to 1.

[0056] Based on the solution of the curve function in 110, the curve function of x∈[0,1] can be obtained. In order to obtain the deformed curve segment, that is, x is in the range of [0, x], let The value of x is required, obviously x<1.

[0057] To solve the above integral, we need to find the original function corresponding to f(x) and solve it. However, the solution of the original function depends on the form of f(x). For complex expressions, we need to rely on manual mathematical derivation.

[0058] As an embodiment, the present application adopts a numerical solution, that is, [0, 1] is divided into 10,000 equal-spaced portions, that is, x i =0,0.0001,……1, and then calculate dy respectively i =f(xi )-f(x i-1 ), when Stop calculation when .

[0059] Among them, i represents a positive integer, l represents the length of the curve, and n represents the value of i when the length of the curve is greater than or equal to 1. The accuracy of this method can be controlled within 1e-4.

[0060] Optionally, in order to increase the accuracy of segmentation, an optimization algorithm may be used, which will improve both the accuracy and efficiency of the solution. The embodiments of the present application are not limited to this.

[0061] After solving according to the above method, the curve segment corresponding to the cross section of the three-dimensional deformed text image can be obtained.

[0062] For 110, Figure 3 The three-dimensional linear curve shown in the figure takes into account the condition of length invariance, and the generated curve segment is as follows Figure 4 As shown, Figure 4 A schematic diagram of a curve segment of a ternary linear curve of a three-dimensional deformed cross-section under the condition of length invariance provided in an embodiment of the present application.

[0063] 130, generating a three-dimensional surface.

[0064] Extending the curve segment in the second direction of the two-dimensional text image according to the second direction length of the two-dimensional text image to obtain a three-dimensional curved surface of the three-dimensional deformed text image;

[0065] According to the deformation curve segment generated in 120 , the change of the curve section is projected onto the cross section of the image.

[0066] Specifically, the deformed curve segment generated according to 120 is extended in the second direction of the two-dimensional text image, and the extended length is the second direction length of the two-dimensional text image. After the curve segment is extended, a three-dimensional surface of the three-dimensional deformed text image can be obtained.

[0067] 140, generating a three-dimensional deformed text image.

[0068] The three-dimensional deformed text image is obtained according to the three-dimensional curved surface and the two-dimensional text image.

[0069] The step of obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image comprises:

[0070] Performing vertical projection on the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image;

[0071] Gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image;

[0072] The grid coordinates are two-dimensionally interpolated according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

[0073] Obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image includes:

[0074] Obtaining an initial three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image;

[0075] The initial three-dimensional deformed text image is subjected to at least one of depth of field blur simulation, illumination simulation and perspective transformation to obtain the three-dimensional deformed text image.

[0076] Performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to a cross-sectional height of the initial three-dimensional deformed text image;

[0077] Performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to a cross-sectional gradient of the initial three-dimensional deformed text image.

[0078] Specifically, the three-dimensional surface generated by 130 is vertically projected to obtain a three-dimensional deformed text image on a two-dimensional projection surface. According to the size of the input two-dimensional text image, gridding is performed on the two-dimensional projection surface to generate grid coordinates with a resolution close to that of the original two-dimensional text image. Then, according to the two-dimensional distribution of the input two-dimensional text image, two-dimensional interpolation is performed on the grid coordinates to finally obtain the three-dimensional deformed text image.

[0079] As an embodiment, the present application performs two-dimensional linear interpolation on grid coordinates according to the two-dimensional distribution of the input two-dimensional text image, and finally obtains a three-dimensional deformed text image, but the embodiments of the present application are not limited to this.

[0080] As another embodiment, the present application may also perform vertical projection on the three-dimensional surface generated by 130 to obtain a two-dimensional projection of the three-dimensional section, and generate grid coordinates close to the resolution of the original two-dimensional text image on the two-dimensional projection of the three-dimensional section according to the size of the input two-dimensional text image; then, based on the two-dimensional distribution of the input two-dimensional text image, perform two-dimensional interpolation on the grid coordinates to obtain an initial three-dimensional deformed text image; then, perform at least one of depth of field blur simulation, lighting simulation, and perspective transformation on the initial three-dimensional deformed text image to obtain a three-dimensional deformed text image.

[0081] Furthermore, the depth of field blur simulation method can add Gaussian blur to a partial area according to the three-dimensional cross-sectional height corresponding to the two-dimensional text image, thereby achieving depth of field blur simulation, but the embodiments of the present application are not limited to this.

[0082] Specifically, first, the maximum height h of the 3D image section corresponding to the initial 3D deformed text image is counted max , randomly give a coefficient a>0.5, and then for the corresponding 3D section height h>ah in the initial 3D deformed text image max The area may be subjected to Gaussian blur to complete the simulation of depth of field blur, but the embodiments of the present application are not limited thereto.

[0083] Because, in real scenes, text images are mostly shot at close range, and the three-dimensional deformed images are prone to blurring due to depth of field. By performing depth of field blurring on the initial three-dimensional deformed text image, depth of field blur simulation in real scenes can be achieved.

[0084] Furthermore, the lighting simulation method can be achieved by enhancing the lighting and adding shadows according to the positive or negative gradient of the cross-section, or it can be achieved through a rendering algorithm, but the embodiments of the present application are not limited thereto.

[0085] As an embodiment, the present application uses the method of enhancing illumination and adding shadows according to the positive or negative gradient of the cross section to achieve illumination simulation. Specifically, the cross-sectional gradient corresponding to the curve segment generated in 120 is calculated. When the gradient is positive, it is considered to be a light-facing surface, and the initial three-dimensional deformed text image area generated in step 140 corresponding to it is subjected to illumination enhancement methods such as equalization and contrast enhancement to increase its brightness; when its gradient is negative, it is considered to be a backlit surface, and the initial three-dimensional deformed text image area generated in step 140 corresponding to it is subjected to nonlinear adjustment, such as a gamma transformation coefficient less than 1, so that its brightness becomes darker and more realistic, but the embodiments of the present application are not limited to this.

[0086] Optionally, for the addition of lighting and shadows, irregular area shapes may be used to make the lighting and shadow effects closer to real scenes, but the embodiments of the present application are not limited to this.

[0087] Through the above-mentioned lighting simulation, three-dimensional objects in real scenes can be realized. Due to the change in height, uneven lighting and shadow effects often occur.

[0088] As an embodiment, after the input two-dimensional text image is subjected to depth of field blur simulation and illumination simulation, the generated three-dimensional deformed text image is as follows: Figure 5 As shown, Figure 5 A schematic diagram of a three-dimensional deformed text image generated after depth of field blur simulation and lighting simulation provided in an embodiment of the present application.

[0089] according to Figure 5It can be seen from the effect that after the input two-dimensional text image original image has been subjected to depth of field blur simulation and lighting simulation, the words "Garden, Haidian District, Beijing" have produced an obvious compression effect, which corresponds to the deformation of the cross-section and its captured image.

[0090] Furthermore, in order to realize complex three-dimensional projection simulation, the initial three-dimensional deformed text image generated in this step may also be subjected to perspective transformation.

[0091] It should be understood that when the initial three-dimensional deformed text image is subjected to depth of field blur simulation and perspective transformation processing, the perspective transformation process may be before or after the depth of field blur simulation; when the initial three-dimensional deformed text image is subjected to illumination simulation and perspective transformation processing, the perspective transformation process may be before or after the illumination simulation; when the initial three-dimensional deformed text image is subjected to depth of field blur simulation, illumination simulation and perspective transformation processing, the perspective transformation process may be before or after the depth of field blur simulation and illumination simulation, or between the depth of field blur simulation and illumination simulation; when the initial three-dimensional deformed text image is subjected to depth of field blur simulation and illumination simulation, the depth of field blur simulation may be performed first and then illumination simulation, or the illumination simulation may be performed first and then the depth of field blur simulation; that is, the three processes of depth of field blur simulation, illumination simulation and perspective transformation may be arbitrarily combined and arranged, and are not limited here.

[0092] As an embodiment, the initial three-dimensional deformed text image is subjected to depth of field blur simulation, illumination simulation and perspective transformation processing. After the depth of field blur simulation and illumination simulation, the perspective transformation process realizes the three-dimensional projection simulation in a certain direction (optionally horizontal or vertical direction). In order to prevent the image discontinuity caused by the filling of blank areas after the perspective transformation, the coordinates of the four corner points of the boundary and the coordinates of the four corner points of the text area are respectively set in the embodiment of the present application. During the perspective transformation, the coordinates of the four corner points of the boundary are horizontally and vertically translated to realize the calculation of the perspective transformation rejection, and finally realize the perspective transformation of the entire image. However, the final image is cropped out of the final perspective transformation image according to the circumscribed rectangle of the four corner points of the text area on the perspective transformation image, but the embodiment of the present application is not limited to this.

[0093] After the input 2D text image is subjected to depth of field blur simulation, lighting simulation and perspective transformation, the generated 3D deformed text image is as follows: Figure 6 As shown, Figure 6 A schematic diagram of a three-dimensional deformed text image generated after depth of field blur simulation, lighting simulation and perspective transformation provided in an embodiment of the present application.

[0094] Please refer to Figure 7 , Figure 7 A structural block diagram of a device for three-dimensional text image deformation provided in an embodiment of the present application; Figure 7 The device for three-dimensional deformation of text images provided and Figure 1 The method described corresponds to having the implementation Figure 1 Functional modules of the method.

[0095] Specifically, Figure 7 The provided device for three-dimensional deformed text image includes: a generating module 710 and a processing module 720 .

[0096] A generation module for determining a deformation curve function;

[0097] The processing module is used to determine the curve segment corresponding to the cross section of the three-dimensional deformed text image according to the first direction length of the two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle;

[0098] The processing module is further used to extend the curve segment in the second direction of the two-dimensional text image according to the second direction length of the two-dimensional text image to obtain the three-dimensional curved surface of the three-dimensional deformed text image;

[0099] The processing module is also used to obtain the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image.

[0100] The processing module is used to obtain the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image, specifically used to:

[0101] Performing vertical projection on the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image;

[0102] Gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image;

[0103] The grid coordinates are two-dimensionally interpolated according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

[0104] The processing module is used to obtain the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image, specifically used to:

[0105] Obtaining an initial three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image;

[0106] The initial three-dimensional deformed text image is subjected to at least one of depth of field blur simulation, illumination simulation and perspective transformation to obtain the three-dimensional deformed text image.

[0107] Performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to a cross-sectional height of the initial three-dimensional deformed text image;

[0108] Performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to a cross-sectional gradient of the initial three-dimensional deformed text image.

[0109] It should be understood that Figure 7 The device provided for three-dimensional deformation of text images can realize Figure 1 The method embodiment involves various processes of generating a three-dimensional deformed text image. The operations and / or functions of various modules in the three-dimensional deformed text image device are respectively to achieve Figure 1 For details, please refer to the description in the above method embodiment. To avoid repetition, detailed description is appropriately omitted here.

[0110] Please refer to Figure 8 , Figure 8 A structural diagram of an electronic device provided for an embodiment of the present application, the electronic device may include: at least one processor 810, such as a CPU, at least one communication interface 820, at least one memory 830 and at least one communication bus 840. Among them, the communication bus 840 is used to realize direct connection and communication between these components. Among them, the communication interface 820 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 830 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 830 can optionally also be at least one storage device located away from the aforementioned processor. The memory 830 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 810, the electronic device executes Figure 1 The method process is shown.

[0111] The present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a server, Figure 1 The method process shown.

[0112] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can also be implemented in other ways. The system embodiments described above are only illustrative. For example, the division of the system devices is only a logical function division. There may be other division methods in actual implementation. For example, multiple devices or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0113] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0114] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating a three-dimensional deformed text image, characterized in that: The method comprises: Determine the deformation curve function; Determining a curve segment corresponding to a cross section of the three-dimensional deformed text image according to a first direction length of the two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle; Extending the curve segment in the second direction of the two-dimensional text image according to the second direction length of the two-dimensional text image to obtain a three-dimensional curved surface of the three-dimensional deformed text image; Obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image; The step of obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image comprises: Performing vertical projection on the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image; Gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image; The grid coordinates are two-dimensionally interpolated according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

2. The method according to claim 1, characterized in that The step of obtaining the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image comprises: Obtaining an initial three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image; The initial three-dimensional deformed text image is subjected to at least one of depth of field blur simulation, illumination simulation and perspective transformation to obtain the three-dimensional deformed text image.

3. The method according to claim 2, characterized in that Performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to a cross-sectional height of the initial three-dimensional deformed text image; Performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to a cross-sectional gradient of the initial three-dimensional deformed text image.

4. A device for generating a three-dimensional deformed text image, characterized in that: The device comprises: A generation module for determining a deformation curve function; The processing module is used to determine the curve segment corresponding to the cross section of the three-dimensional deformed text image according to the first direction length of the two-dimensional text image and the deformation curve function, wherein the shape of the two-dimensional text image is a rectangle; The processing module is further used to extend the curve segment in the second direction of the two-dimensional text image according to the second direction length of the two-dimensional text image to obtain the three-dimensional curved surface of the three-dimensional deformed text image; The processing module is also used to obtain the three-dimensional deformed text image based on the three-dimensional curved surface and the two-dimensional text image; the obtaining of the three-dimensional deformed text image based on the three-dimensional curved surface and the two-dimensional text image includes: vertically projecting the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image; gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image; and performing two-dimensional interpolation on the grid coordinates according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

5. The device according to claim 4, characterized in that The processing module is used to obtain the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image, specifically used to: Performing vertical projection on the three-dimensional curved surface to generate a two-dimensional projection surface of the three-dimensional deformed text image; Gridding the projection surface according to the size of the two-dimensional text image to generate grid coordinates corresponding to the two-dimensional text image; The grid coordinates are two-dimensionally interpolated according to the two-dimensional distribution of the two-dimensional text image to obtain the three-dimensional deformed text image.

6. The device according to claim 4, characterized in that The processing module is used to obtain the three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image, specifically used to: Obtaining an initial three-dimensional deformed text image according to the three-dimensional curved surface and the two-dimensional text image; The initial three-dimensional deformed text image is subjected to at least one of depth of field blur simulation, illumination simulation and perspective transformation to obtain the three-dimensional deformed text image.

7. The device according to claim 6, characterized in that Performing depth of field blur simulation on the initial three-dimensional deformed text image includes performing depth of field blur simulation on the initial three-dimensional deformed text image according to a cross-sectional height of the initial three-dimensional deformed text image; Performing illumination simulation on the initial three-dimensional deformed text image includes performing illumination simulation on the initial three-dimensional deformed text image according to a cross-sectional gradient of the initial three-dimensional deformed text image.

8. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the processor is connected to the memory via the bus, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, they are used to implement the method according to any one of claims 1 to 3.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a server, implements the method as claimed in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Character recognition method and system

    CN101458770A

  • Three-dimensional registration method based on local deformation of two-dimensional image

    CN108182699A