A method, device, electronic device and storage medium for generating curved surface images

Through the continuous updating of the surface mapping matrix, surface images with complex surface effects are generated, which solves the problems of low surface image generation efficiency and insufficient detection accuracy in the existing technology, and achieves efficient surface image generation and content detection.

CN114581508BActive Publication Date: 2024-10-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210179218.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-25
Publication Date
2024-10-18
Estimated Expiration
2042-02-25

AI Technical Summary

Technical Problem

The existing technology is inefficient when generating curved surface images, is difficult to achieve complex curved surface effects, and ignores the influence of content deformation factors in curved surface images, resulting in insufficient detection accuracy.

Method used

By acquiring the plane image, mapping the pixel point coordinates based on the surface mapping matrix, calculating the coordinate weight and position increment, updating the surface mapping matrix until the mapping end condition is reached, generating the target surface image, and achieving various surface transformation effects.

Benefits of technology

It improves the efficiency and complexity of curved image generation, improves the efficiency of curved image generation, and enhances the accuracy of content detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114581508B_ABST
    Figure CN114581508B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, electronic device and storage medium for generating a curved surface image. The embodiment of the present invention can be applied to scenarios such as cloud technology, artificial intelligence, smart transportation, and Internet of Vehicles. The coordinates of each pixel point in a plane image can be mapped based on a surface mapping matrix to obtain an initial coordinate value of each pixel point, determine a bending positioning line from the plane image, calculate the distance from each pixel point to the bending positioning line, calculate the coordinate weight corresponding to each pixel point based on the image bending type and the distance, calculate the surface mapping coordinate value of each pixel point according to the coordinate weight and the initial coordinate value of each pixel point, calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, return to execute the above steps until the mapping end condition is met, and generate a target curved surface image based on the surface mapping coordinate value and the pixel value of each pixel point. The generation efficiency of the curved surface image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device, electronic equipment and storage medium for generating a curved image. Background Art

[0002] With the development of current technology, methods for detecting content in images are becoming more and more mature. However, current methods for detecting image content basically assume that the image is a flat image, ignoring the influence of factors such as content deformation in curved images. Therefore, more and more R&D personnel need more curved images for testing to improve the accuracy of content detection.

[0003] At present, the main method used to generate curved surface images is to transform the flat image into a curved surface using the curve equation pre-set by the technician. With this solution, the effect of the surface transformation is single. If a complex surface effect is to be achieved, the technician needs to perform multiple transformation operations using the same surface equation, resulting in low efficiency in generating curved surface images. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, electronic device and storage medium for generating a curved surface image, which can achieve various curved surface transformation effects and improve the efficiency of generating curved surface images.

[0005] An embodiment of the present invention provides a method for generating a curved surface image, comprising:

[0006] Acquire a plane image, and map the coordinates of each pixel point in the plane image based on a curved surface mapping matrix to obtain an initial coordinate value of each pixel point in the plane image in a curved surface coordinate system;

[0007] Determine, from the planar image, a bending positioning line when the planar image is bent, and calculate a distance from each of the pixel points to the bending positioning line;

[0008] Based on a preset image curvature type and the distance, calculating a coordinate weight corresponding to each of the pixel points;

[0009] Calculating the surface mapping coordinate value of each pixel point according to the coordinate weight corresponding to each pixel point and the initial coordinate value;

[0010] Calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system until the mapping end condition is met;

[0011] A target curved surface image is generated based on the curved surface mapping coordinate values ​​of each pixel point and the pixel value of each pixel point.

[0012] Accordingly, an embodiment of the present invention further provides a curved surface image generating device, comprising:

[0013] A coordinate mapping unit, used to acquire a plane image, map the coordinates of each pixel point in the plane image based on a curved surface mapping matrix, and obtain an initial coordinate value of each pixel point in the plane image in a curved surface coordinate system;

[0014] A distance calculation unit, used to determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line;

[0015] A weight calculation unit, used for calculating the coordinate weight corresponding to each pixel point based on a preset image curvature type and the distance;

[0016] A surface coordinate calculation unit, used to calculate the surface mapping coordinate value of each pixel point according to the coordinate weight corresponding to each pixel point and the initial coordinate value;

[0017] a matrix updating unit, configured to calculate a position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until a mapping end condition is met;

[0018] The curved surface image generating unit is used to generate a target curved surface image based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0019] Optionally, the curved surface image generating unit is used to determine a neighborhood range with each pixel point as the neighborhood center based on the curved surface mapping coordinate value of each pixel point and a preset neighborhood distance;

[0020] Taking a neighborhood center as a target neighborhood center, determining neighborhood pixels in a neighborhood range corresponding to the target neighborhood center, and calculating a target pixel value of the target neighborhood center according to the distance between each of the neighborhood pixels and the target neighborhood center and the pixel value of each of the neighborhood pixels;

[0021] Return to the step of taking a neighborhood center as the target neighborhood center until the target pixel value of each neighborhood center is obtained;

[0022] A target surface image is generated according to the surface mapping coordinate values ​​of the target neighborhood centers and the target pixel values.

[0023] Optionally, the image curvature type includes a convex curvature type, a concave curvature type and a folded curvature type;

[0024] The weight calculation unit is used to calculate the convex parameter corresponding to each pixel point as the coordinate weight according to the distance corresponding to each pixel point and a preset curvature index when the image curvature type is a convex curvature type; or

[0025] When the image curvature type is a concave curvature type, the concave parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index; or,

[0026] When the image curvature type is a folding curvature type, a folding parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index.

[0027] Optionally, the curved surface generating device provided by the embodiment of the present invention further includes a plane image generating unit, which is used to receive an image generating instruction, wherein the image generating instruction includes image size information and text information;

[0028] Generate an initial image canvas according to the image size information;

[0029] Determining text layout information of the initial image canvas based on the image size information;

[0030] According to the text typesetting information, the preset character size and character spacing, the text information is divided into texts to obtain divided texts;

[0031] A content map is generated according to the divided text, and the content map is added to the initial image canvas to obtain a planar image.

[0032] Optionally, the surface generation device provided by the embodiment of the present invention further includes a binary image generation unit, which is used to determine a neighborhood range with each pixel point as the neighborhood center based on the surface mapping coordinate value of each pixel point and a preset neighborhood distance;

[0033] Determine, according to the surface mapping matrix, the initial coordinate values ​​corresponding to the centers of the neighborhoods in the plane image, and the initial neighborhood ranges corresponding to the neighborhood ranges in the plane image;

[0034] Taking a neighborhood center as the target neighborhood center, determining the initial neighborhood pixel point in the initial neighborhood range corresponding to the target neighborhood center, and taking the pixel value of the initial neighborhood pixel point with the smallest distance from the initial coordinate value of the target neighborhood center as the reference pixel value of the target neighborhood center;

[0035] Returning to the step of taking a neighborhood center as the target neighborhood center, until the reference pixel values ​​of the neighborhood centers are obtained;

[0036] A text area binary image corresponding to the target curved surface image is generated according to the reference pixel values ​​of the target neighborhood centers.

[0037] Optionally, the surface generation device provided by the embodiment of the present invention further includes a text annotation unit, which is used to determine the adding position of each content map in the initial image canvas, and the divided text corresponding to each content map;

[0038] Determining a mapping position of each of the content maps in the target surface image according to the surface mapping matrix and each of the adding positions;

[0039] Based on the divided texts corresponding to the mapping positions and the content maps, text annotations of the target curved surface image are generated.

[0040] Optionally, the curved surface generation device provided by the embodiment of the present invention further includes a network training unit, which is used to obtain a content detection network to be trained, wherein the content detection network is used to detect the content of the curved surface image;

[0041] Performing content detection on the target curved surface image by using the content detection network to be trained to obtain detection content information;

[0042] Calculating the detection loss of the content detection network to be trained based on the detection content information and the text annotation of the target curved surface image;

[0043] The network parameters of the content detection network to be trained are adjusted according to the detection loss to obtain a trained content detection network.

[0044] Correspondingly, an embodiment of the present invention further provides an electronic device, comprising a memory and a processor; the memory stores an application, and the processor is used to run the application in the memory to execute the steps in any one of the surface image generation methods provided in the embodiments of the present invention.

[0045] Correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the surface image generation methods provided in the embodiments of the present invention.

[0046] In addition, an embodiment of the present invention further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in any one of the curved surface image generation methods provided in the embodiments of the present invention.

[0047] By adopting the scheme of the embodiment of the present invention, a plane image can be acquired, and the coordinates of each pixel point in the plane image can be mapped based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, and the bending positioning line of the plane image when it is bent is determined from the plane image, and the distance from each pixel point to the bending positioning line is calculated. Based on the preset image bending type and the distance, the coordinate weight corresponding to each pixel point is calculated, and the surface mapping coordinate value of each pixel point is calculated according to the coordinate weight corresponding to each pixel point and the initial coordinate value, and the position increment between the surface mapping coordinate value and the initial coordinate value is calculated, and a new surface mapping is generated based on the position increment and the surface mapping matrix. The mapping matrix is ​​returned to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is reached, and the target surface image is generated based on the surface mapping coordinate value of each pixel point and the pixel value of each pixel point; because in the embodiment of the present invention, each time after the image is surface transformed, the surface mapping matrix can be updated according to the surface mapping coordinate value after the surface transformation and the initial coordinate value, therefore, through the continuous updating of the surface mapping matrix, a variety of surface transformation effects can be achieved, a surface image with a more complex surface effect can be quickly constructed, and the efficiency of generating surface images is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1 is a scene schematic diagram of a curved surface image generation method provided by an embodiment of the present invention;

[0050] Figure 2 is a flow chart of a method for generating a curved surface image provided by an embodiment of the present invention;

[0051] Figure 3 is a schematic diagram of a curved surface image generation process provided by an embodiment of the present invention;

[0052] Figure 4 is a schematic diagram of a curved surface image generation process provided by an embodiment of the present invention;

[0053] Figure 5 is a schematic diagram of a text area binary image provided by an embodiment of the present invention;

[0054] Figure 6 is another schematic flow chart of the method for generating a curved surface image provided by an embodiment of the present invention;

[0055] Figure 7 is a schematic structural diagram of a curved surface image generating device provided by an embodiment of the present invention;

[0056] Figure 8 is another structural schematic diagram of the curved surface image generating device provided by an embodiment of the present invention;

[0057] Fig. 9 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0059] The embodiments of the present invention provide a curved surface image generation method, device, electronic device and computer-readable storage medium. Specifically, the embodiments of the present invention provide a curved surface image generation method applicable to a curved surface image generation device, and the curved surface image generation device can be integrated in an electronic device.

[0060] The electronic device can be a terminal or other device, including but not limited to a mobile terminal and a fixed terminal. For example, a mobile terminal includes but is not limited to a smart phone, a smart watch, a tablet computer, a laptop computer, a smart car-mounted terminal, etc., wherein a fixed terminal includes but is not limited to a desktop computer, a smart TV, etc.

[0061] The electronic device can also be a device such as a server. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms, but is not limited to these.

[0062] The curved surface image generation method of the embodiment of the present invention may be implemented by a server, or may be implemented by a terminal and a server together.

[0063] The method is described below by taking the method of generating the curved surface image jointly implemented by a terminal and a server as an example.

[0064] like Figure 1 As shown, the surface image generation system provided by the embodiment of the present invention includes a terminal 10 and a server 20, etc.; the terminal 10 and the server 20 are connected via a network, for example, via a wired or wireless network connection, etc., wherein the terminal 10 can exist as a terminal for sending a plane image to the server 20.

[0065] The terminal 10 may be a terminal for uploading a planar image for a user who needs to generate a curved image, and is used to send the planar image to the server 20 .

[0066] The server 20 can be used to obtain a plane image, map the coordinates of each pixel in the plane image based on a surface mapping matrix, obtain the initial coordinate value of each pixel in the plane image in the surface coordinate system, determine the bending positioning line when the plane image is bent from the plane image, calculate the distance from each pixel to the bending positioning line, calculate the coordinate weight corresponding to each pixel based on a preset image bending type and distance, and calculate the surface mapping coordinate value of each pixel according to the coordinate weight and initial coordinate value corresponding to each pixel.

[0067] The server 20 can calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is reached, and generate the target surface image based on the surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0068] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0069] The embodiment of the present invention will be described from the perspective of a curved surface image generating device, which can be specifically integrated in a server or a terminal.

[0070] like Figure 2 As shown, the specific process of the curved surface image generation method of this embodiment can be as follows:

[0071] 201. Acquire a plane image, map the coordinates of each pixel point in the plane image based on a surface mapping matrix, and obtain an initial coordinate value of each pixel point in the plane image in a surface coordinate system.

[0072] Specifically, the content of the plane image may include only text, or only include non-text content such as people, scenery, etc., or may be a combination of text and non-text content. The embodiment of the present invention does not limit the image content of the plane image.

[0073] For example, the plane image may be an image of a page of text, or the plane image may be a portrait of a person, or the plane image may include a picture and an analysis of the picture, and so on.

[0074] The surface mapping matrix may be used to map the coordinates of each pixel point in the plane image in the coordinate system where the plane image is located to the coordinates in the surface coordinate system where the target surface image to be generated is located.

[0075] For example, each pixel point in a plane image has integer coordinates in the coordinate system of the plane image, but has floating-point coordinates in the curved surface coordinate system. At this time, the integer coordinates of each pixel point in the plane image can be mapped based on the surface mapping matrix to obtain the initial coordinate values ​​corresponding to each pixel point in the plane image in the curved surface coordinate system.

[0076] It is understandable that the floating point coordinate is actually a logical coordinate. When it is actually displayed, it needs to correspond to the actual device through a certain mapping relationship. For example, if a pixel point is displayed at the position (4, 1) in the coordinate system of integer coordinates, the floating point coordinate can be (4, 1.15) after coordinate conversion. However, when it is displayed, the actual required coordinate point (4, 1.15) can be displayed at the position (400, 115) of the surface coordinate system. At this time, the initial coordinate value is (400, 115).

[0077] In some optional examples, the surface mapping matrix when mapping the coordinates of each pixel point in the plane image for the first time can be randomly initialized, or it can be an all-1 matrix, or the surface mapping matrix can be set by a technician corresponding to different image curvature types.

[0078] For example, the technician may set four different surface mapping matrices corresponding to four types of image curvature, namely, convex curvature, concave curvature, upward folding, and downward folding.

[0079] Specifically, the dimension of the surface mapping matrix is ​​H×W, where H is the height of the plane image and W is the width of the plane image.

[0080] It should be noted that the surface coordinate system is not a three-dimensional coordinate system, but a two-dimensional coordinate system of the plane. However, the coordinate descriptions of the same coordinate point in the surface coordinate system and the coordinate system where the plane image originally resides may be different.

[0081] 202. Determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line.

[0082] The bending positioning line is a line segment or a straight line that needs to be referenced when the plane image is bent. Specifically, the bending positioning line can be pre-set or randomly determined each time the plane image is bent.

[0083] For example, the technician may pre-specify the bending positioning line as the straight line y=2x passing through the plane image. Alternatively, the bending positioning line may be any randomly determined straight line passing through the plane image.

[0084] For another example, when determining the curved positioning line, an initial point p can be randomly selected in the area where the plane image is located, and then another point v can be randomly selected along any direction (such as diagonal direction, horizontal or vertical direction, etc.). The curved positioning line can be a straight line pv or a line segment pv.

[0085] When calculating the distance from each pixel point to the curved positioning line, what is calculated is the vertical distance, normalized distance or Euclidean distance, etc. from each pixel point to the straight line pv or the straight line where the line segment pv is located.

[0086] Taking the plane text image with a height and width of 1280*720 as an example, a point p can be randomly selected within the pixel range of [200,520] in the horizontal direction and [400,800] in the vertical direction, and a point v can be randomly selected within the horizontal increment of point p [-50,-25]∪[25,50] and the vertical increment of [-100,-50]∪[50,100].

[0087] Among them, when determining the bending positioning line and calculating the distance, it can be determined based on the coordinates of each pixel point in the plane image in the coordinate system where the plane image is located, or it can be determined based on the initial coordinate value of each pixel point in the curved surface coordinate system. The embodiment of the present invention does not limit this, and technicians can choose according to actual conditions. Generally speaking, the solution of using the initial coordinate value of each pixel point in the curved surface coordinate system can reduce calculation errors and improve the accuracy of image bending.

[0088] 203. Calculate the coordinate weight corresponding to each pixel point based on the preset image curvature type and distance.

[0089] In the embodiment of the present invention, in order to make each bending of the image closer to the bending effect in real life, a plurality of different image bending types are set.

[0090] In some optional embodiments, the image curvature type may include a convex curvature type, a concave curvature type, and a folded curvature type, and the step of “calculating the coordinate weight corresponding to each pixel point based on the image curvature type and the axis distance” may specifically include:

[0091] When the image curvature type is a convex curvature type, the convex parameter corresponding to each pixel point is calculated as the coordinate weight according to the distance corresponding to each pixel point and the preset curvature index; or,

[0092] When the image curvature type is a concave curvature type, the concave parameter corresponding to each pixel point is calculated as the coordinate weight according to the distance corresponding to each pixel point and the preset curvature index; or,

[0093] When the image curvature type is a folding curvature type, a folding parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index.

[0094] Specifically, the convex parameter corresponding to each pixel point can be ω=1-d α , where d is the vertical parameter corresponding to each pixel point, and α is the preset curvature index. For example, in the curvature type (convex curvature and concave curvature), the value range of α can be [0.8, 2.8]. The concave parameter corresponding to each pixel point can be ω=1+d α The folding parameter corresponding to each pixel point may be ω=α / (d+α). For example, under the folding type (folding up or folding down), the value range of α may be [0.4, 0.9].

[0095] It can be understood that the value range of α can be adjusted by technicians according to the actual bending effect, and the embodiment of the present invention does not limit the specific value of α.

[0096] In the related art, to achieve the transformation from a plane image to a curved surface image, the original coordinates of the plane image are generally directly transformed by the transformation equation pre-set by the technician to obtain the coordinates corresponding to each point in the plane image under the curved surface effect. However, with this solution, the transformation process relies on a single transformation equation for mapping. If you want to achieve a complex curved surface effect, such as the concave and curved effect of a crumpled paper, it cannot be achieved with a single transformation equation.

[0097] In the embodiment of the present invention, a plurality of different bending types are provided. When a complex curved surface effect needs to be realized, the image can be mapped by selecting a corresponding bending type, so that the generation effect of the curved surface image is more diverse.

[0098] 204. Calculate the surface mapping coordinate value of each pixel point according to the coordinate weight and the initial coordinate value corresponding to each pixel point.

[0099] In the embodiment of the present invention, the initial coordinate value of each pixel point can be directly multiplied by the coordinate weight to obtain the surface mapping coordinate value of each pixel point. Alternatively, the initial coordinate value of each pixel point can be multiplied by the coordinate weight, and the product result can be added to a certain parameter, or the initial coordinate value plus the coordinate weight can be used as the surface mapping coordinate value, and so on.

[0100] In some optional examples, the calculation methods of the surface mapping coordinate values ​​corresponding to different image curvature types may be the same or different.

[0101] By determining the surface mapping coordinate value through the coordinate weight and the initial coordinate value, the initial coordinate value of each pixel point can be adaptively adjusted through the coordinate weight. For the same coordinate point, the larger the value of the curvature index α, the greater the influence of the coordinate weight on the initial coordinate value.

[0102] For example, the initial coordinate value corresponding to a pixel point may be [100, 120], the distance is 10, the image curvature type is convex curvature, and the preset curvature index α = 1.0. At this time, the coordinate weight is the convex parameter ω = -9. If the surface mapping coordinate value is calculated by adding the initial coordinate value to the coordinate weight, the surface mapping coordinate value is [101, 111].

[0103] 205. Calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is reached.

[0104] The mapping end condition may be the number of loop executions (the number of image distortions) preset by the technician, such as 2 or 4 times. Alternatively, the mapping end condition may be that the position increments of each pixel point are less than a preset increment threshold, such as 0.01. Alternatively, the mapping end condition may be that the curvature of the image reaches a certain degree. Alternatively, the mapping end condition may be manually ending the mapping, and so on.

[0105] Since in the embodiment of the present invention, the surface mapping matrix can be adaptively adjusted according to the position increment before each mapping, the technician does not need to manually modify the surface mapping matrix. However, in the related art, due to the reliance on a single transformation equation, if a certain surface effect is to be achieved, the technician needs to manually adjust the parameters of the transformation equation.

[0106] For example, if you want to achieve a 37-degree convex curvature effect, in the embodiment of the present invention, you only need to set the corresponding mapping end condition, while using the solution of the related art requires technicians to constantly test which specific parameters can achieve this effect. Therefore, the embodiment of the present invention has a higher construction efficiency when constructing a curved surface image.

[0107] Specifically, Figure 3 As shown, the position increment of a pixel point in the horizontal and vertical directions after mapping can be calculated based on the surface mapping coordinate value and the initial coordinate value of the pixel point, and the surface mapping matrix can be updated based on the position increment of each pixel point.

[0108] For example, Figure 3 As shown, the position increment of a certain pixel point can be the original increment of the pixel point plus the coordinate weight of the pixel point in this mapping process × the distance from the pixel point to the straight line pv, etc. The position increment can also be set with parameters related to the number of mappings, for example, the position increment of a certain pixel point can be the original increment of the pixel point plus the coordinate weight of the pixel point in this mapping process × the distance from the pixel point to the straight line pv × the inverse of the current mapping number (for example, the current mapping process is the 6th mapping of a certain plane image, and the inverse of the current mapping number is 1 / 6). The embodiment of the present invention does not limit this.

[0109] It should be noted that, in the process of looping through steps 201 to 204, the bending positioning line each time may be the same straight line or line segment, or the bending positioning line each time may be randomly determined. In addition, the image bending type each time may be the same or different.

[0110] 206. Generate a target curved surface image based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0111] When generating the target curved surface image, the color of the plane image can be retained, and the original pixel value of each pixel point can be directly used as the pixel value in the target curved surface image. Alternatively, in order to save storage space or achieve a black and white processing effect, the original pixel value of each pixel point can be binarized to obtain a black and white target curved surface image.

[0112] In some optional embodiments, in order to avoid pixel value errors, weighted difference processing may be performed on the pixel values ​​of each pixel point. The step of "generating a target curved surface image based on the curved surface mapping coordinate values ​​of each pixel point and the pixel values ​​of each pixel point" may specifically include:

[0113] Based on the surface mapping coordinate value of each pixel point and the preset neighborhood distance, a neighborhood range with each pixel point as the neighborhood center is determined;

[0114] Taking a neighborhood center as the target neighborhood center, determining the neighborhood pixel points in the neighborhood range corresponding to the target neighborhood center, and calculating the target pixel value of the target neighborhood center according to the distance between each neighborhood pixel point and the target neighborhood center and the pixel value of each neighborhood pixel point;

[0115] Return to the step of taking a neighborhood center as the target neighborhood center until the target pixel value of each neighborhood center is obtained;

[0116] The target surface image is generated according to the surface mapping coordinate values ​​of each target neighborhood center and the target pixel value.

[0117] The neighborhood distance may be a preset value, for example, the neighborhood distance may be Euclidean distance=1, and the neighborhood range with pixel point A as the neighborhood center may be a region range whose Euclidean distance to pixel point A is 1.

[0118] Among them, the neighborhood pixel point is the pixel point within the neighborhood range. The neighborhood center is the pixel point at the center of the neighborhood range. For example, there are pixel points A, B, and C, and the neighborhood distance can be 2. In the embodiment of the present invention, the pixel points A, B, and C are respectively used as the neighborhood centers. The neighborhood range with pixel point A as the neighborhood center is a circular area with A as the center and 2 as the radius, and so on.

[0119] For example, the point set attributes of the pixel set of the original image contained in the neighborhood of each pixel point of the surface text can be obtained based on the surface mapping coordinate value of each pixel point. The pixel point neighborhood refers to the neighborhood range with the pixel point as the center and the Euclidean distance from it as 1; the point set attributes include: the pixel value val of each point in the point set i , the Euclidean distance dist from each point in the point set to the center pixel of the area i .

[0120] According to the point set of each surface text pixel point obtained, the weighted average value val is calculated with the inverse of the distance as the weight mean , calculated as val mean =(∑val i / dist i ) / (∑1 / dist i ).

[0121] The weighted average value corresponding to each surface text pixel is rounded down to the integer, which is used as the interpolation result of the pixel.

[0122] In some optional embodiments, if you want to obtain a curved surface image with specific text content, you can generate a flat image based on the text content. Before the step of "obtaining a flat image", the curved surface image generation method provided by the embodiment of the present invention may also include:

[0123] receiving an image generation instruction, the image generation instruction including image size information and text information;

[0124] Generate an initial image canvas based on the image size information;

[0125] Based on the image size information, determine the text layout information of the initial image canvas;

[0126] According to the text typesetting information, the preset character size and character spacing, the text information is divided to obtain the divided text;

[0127] A content map is generated according to the divided text, and the content map is added to the initial image canvas to obtain a planar image.

[0128] That is to say, Figure 4 As shown, an initial canvas of corresponding size (such as 1280*720 in height and width) can be generated according to the image size information, and then the text information (original corpus) can be read line by line for processing. The text information can come from English novels or articles, etc., so the original corpus is generally divided into paragraphs.

[0129] When dividing text information, first determine whether the current text exceeds the maximum length that can be displayed in one line based on the configured character size and spacing. If it exceeds, divide the corpus into multiple lines. After the text division is completed, generate one or more lines of maps for the divided text, and then place them on the initial image canvas in order.

[0130] In some examples, if the text currently being processed is the last line, the canvas is saved and exited after processing is completed to obtain a flat image; otherwise, it is determined whether the current canvas is full. If so, a new initial canvas is generated and the above operation is repeated.

[0131] In actual application, if the curved surface image needs to be used for model training and other processes, a binary image with content areas marked may be required. Therefore, in some optional embodiments, the curved surface image generation method provided by the embodiment of the present invention may also include:

[0132] Based on the surface mapping coordinate value of each pixel point and the preset neighborhood distance, a neighborhood range with each pixel point as the neighborhood center is determined;

[0133] According to the surface mapping matrix, determine the initial coordinate value corresponding to each neighborhood center in the plane image, and the initial neighborhood range corresponding to each neighborhood range in the plane image;

[0134] Taking a neighborhood center as the target neighborhood center, determining the initial neighborhood pixel point in the initial neighborhood range corresponding to the target neighborhood center, and taking the pixel value of the initial neighborhood pixel point with the smallest distance from the initial coordinate value of the target neighborhood center as the reference pixel value of the target neighborhood center;

[0135] Return to the step of taking a neighborhood center as the target neighborhood center until the reference pixel values ​​of each neighborhood center are obtained;

[0136] According to the reference pixel value of each target neighborhood center, a binary image of the text area corresponding to the target surface image is generated.

[0137] Among them, the neighborhood center and the neighborhood range are the same as the above definitions, and the embodiments of the present invention are not repeated here. The initial neighborhood range is the interval range corresponding to the neighborhood range in the plane image. For example, when the pixel point A in the curved image is used as the neighborhood center, the corresponding neighborhood range is a circular area with coordinates (1, 1) as the center and 1 as the radius, and the initial neighborhood range corresponding to the neighborhood range may be a circular area with (0.8, 1.2) as the center and 1.1 as the radius in the plane image, and so on.

[0138] It is understandable that due to the change in the coordinate values ​​of each pixel point in the plane image and the curved surface image caused by the mapping, the coordinate values ​​of each pixel point in the initial neighborhood range may be different from the coordinate values ​​of each pixel point in the neighborhood range, and the shape and size of the initial neighborhood range may also be different from the neighborhood range.

[0139] That is to say, in an embodiment of the present invention, according to the generated surface mapping matrix, the pixel value of the pixel point of the plane image that is closest to the corresponding pixel point in the neighborhood of each pixel point mapped to the surface image can be used as the reference pixel value; and the reference pixel value corresponding to each surface text pixel point can be used as the interpolation result of the pixel point.

[0140] Taking the example of a plane image and a curved image containing n lines of text, the binary image of the text area corresponding to the target curved image can be expressed as Figure 5 shown.

[0141] In actual application, if the curved surface image needs to be used for model training and other processes, it may be necessary to annotate the content with specific image content. Therefore, taking the image content as text as an example, the curved surface image generation method provided by the embodiment of the present invention may also include:

[0142] Determine the location of each content map in the initial image canvas and the divided text corresponding to each content map;

[0143] Determine the mapping position of each content map in the target surface image according to the surface mapping matrix and each added position;

[0144] Based on the divided texts corresponding to each mapping position and each content map, text annotations of the target surface image are generated.

[0145] In the related art, if you want to achieve line-level text annotation for a curved text image, you need to divide the text in the generated curved text image into lines, and perform text recognition based on the line division, so that you can achieve image annotation. However, in the embodiment of the present invention, since the plane text image is generated line by line, the position and text annotation of each line can be naturally obtained during the generation process, and the target curved image annotated with text can be obtained.

[0146] In some optional embodiments, the curved surface image generation method provided by the embodiment of the present invention may further include: obtaining a content detection network to be trained, where the content detection network is used to detect the content of the curved surface image;

[0147] Performing content detection on the target surface image through the content detection network to be trained to obtain detection content information;

[0148] Based on the detection content information and the text annotation of the target surface image, the detection loss of the content detection network to be trained is calculated;

[0149] The network parameters of the content detection network to be trained are adjusted according to the detection loss to obtain the trained content detection network.

[0150] Among them, the construction process of the content detection network relies on computer vision technology (Computer Vision, CV). Computer vision is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multidimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.

[0151] The target curved surface image generated by the embodiment of the present invention can be used for the training of the OCR algorithm model, and the specific application scenarios include but are not limited to: text detection and recognition of curved surface images, text detection and recognition of product labels, restoration of curved surface images, etc.

[0152] As can be seen from the above, the embodiment of the present invention can obtain a plane image, map the coordinates of each pixel point in the plane image based on the surface mapping matrix, obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, determine the bending positioning line when the plane image is bent from the plane image, calculate the distance from each pixel point to the bending positioning line, calculate the coordinate weight corresponding to each pixel point based on the preset image bending type and distance, calculate the surface mapping coordinate value of each pixel point according to the coordinate weight corresponding to each pixel point and the initial coordinate value, calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return The steps of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system are performed until the mapping end condition is reached, and the target surface image is generated based on the surface mapping coordinate value of each pixel point and the pixel value of each pixel point; since in the embodiment of the present invention, each time after the image is surface transformed, the surface mapping matrix can be updated according to the surface mapping coordinate value after the surface transformation and the initial coordinate value, therefore, through the continuous updating of the surface mapping matrix, a variety of surface transformation effects can be achieved, and a surface image with a more complex surface effect can be quickly constructed, thereby improving the efficiency of generating the surface image.

[0153] The method described in the above embodiments is further described in detail below with examples.

[0154] In this embodiment, the Figure 1system is described below.

[0155] like Figure 6 As shown, the method for generating a curved surface image in this embodiment may have the following specific process:

[0156] 601. The terminal receives image size information and text information, generates an initial image canvas according to the image size information, and determines text layout information of the initial image canvas based on the image size information.

[0157] First, generate an initial canvas of the corresponding size (such as 800*600 in height and width) according to the image size information, and determine the maximum length of each line of text that can be displayed in the initial canvas and the maximum number of lines that can be displayed according to the image size information, that is, the text layout information

[0158] 602. The terminal divides the text information according to the text layout information, the preset character size and the character spacing to obtain divided text, generates a content map according to the divided text, and adds the content map to the initial image canvas to obtain a planar image.

[0159] The terminal can read text information line by line for processing. The text information generally comes from English novels or articles, so the original text information is generally divided into paragraphs.

[0160] When processing each line of text information, it can be determined whether the text information of the current line exceeds the maximum length that can be displayed for each line of text in the initial canvas based on the configured font size and spacing. If so, the text information of the current line is divided into multiple lines.

[0161] After the text information is divided, one or more lines of content maps can be generated based on the API provided by Pygame, and then placed on the initial image canvas in the order of the text. If the current text information is the last line, save the canvas and exit after processing. Otherwise, determine whether the current canvas is full. If it is full, generate a new initial canvas and repeat the above operation.

[0162] In an embodiment of the present invention, in order to improve the authenticity of the data, after the initial planar image is generated, a data enhancement operation can be performed on the initial planar image (for example, it can be implemented through the API provided by Imgaug), specifically including background replacement, random noise addition, brightness modification and blurring processing, etc., to obtain a planar image.

[0163] 603. The terminal sends the plane image to the server. The server obtains the plane image, maps the coordinates of each pixel in the plane image based on the surface mapping matrix, and obtains the initial coordinate value of each pixel in the plane image in the surface coordinate system.

[0164] The server may initialize a mapping matrix, the dimension of the matrix being H×W, where H and W are the height and width of the plane image, and the matrix maps the integer coordinates of the plane image to the floating-point coordinates (initial coordinate values) of the curved surface image.

[0165] 604. The server determines a bending positioning line when the plane image is bent from the plane image, and calculates a distance from each pixel point to the bending positioning line.

[0166] In some optional embodiments, the server may randomly select an initial point p from the middle area of ​​the plane image, and then randomly select another control point v along the diagonal, horizontal or vertical direction, and calculate the distances from all pixel points of the plane text image to the straight line pv. Taking the plane text image with a height and width of 1280*720 as an example, point p is randomly selected within the horizontal direction [200,520] and vertical direction [400,800] pixel ranges, and point v is randomly selected within the horizontal increment of point p [-50,-25]∪[25,50] and the vertical increment of point p [-100,-50]∪[50,100].

[0167] 605. The server calculates the coordinate weight corresponding to each pixel point based on the preset image curvature type and distance.

[0168] The server calculates the weight ω according to the selected basic mapping type. This solution includes three basic mapping types: convex, concave, and folded. The weight calculation method for convex bending is ω = 1-d α ; The weight calculation method for concave curvature is, ω=1+d α ; The folding weight is calculated as ω = α / (d + α). α in the formula is a hyperparameter set artificially. When the basic mapping type is curved, the value range of α is [0.82.8], and when the basic mapping type is folded, the value range of α is [0.4, 0.9].

[0169] 606. The server calculates the surface mapping coordinate value of each pixel point according to the coordinate weight and the initial coordinate value corresponding to each pixel point.

[0170] 607. The server calculates the position increment between the surface mapping coordinate value and the initial coordinate value, generates a new surface mapping matrix based on the position increment and the surface mapping matrix, and returns to execute steps 603-606 until the mapping end condition is met.

[0171] The server may calculate the position increments in the horizontal and vertical directions after the distortion, update the surface mapping matrix according to the position increments, and repeat steps 603 to 606 until the maximum distortion times are reached.

[0172] 608. The server generates a target surface image based on the surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0173] Specifically, the server can obtain the coordinates of the plane image mapped onto the surface image according to the generated surface mapping matrix, and then obtain the point set attributes of the pixel point set of the original plane image contained in the neighborhood of each pixel point of the surface image. The pixel point neighborhood refers to the neighborhood range centered on the pixel point and with a Euclidean distance of 1; the point set attributes include: the pixel value vali of each point in the point set, and the Euclidean distance disti of each point in the point set to the center pixel point of the area.

[0174] According to the point set of each surface text pixel point, the weighted average value valmean is calculated with the inverse of the distance as the weight, and the calculation method is valmean = (∑vali / disti) / (∑1 / disti). The weighted average value corresponding to each pixel point in the surface image is rounded down as the interpolation result of the pixel point.

[0175] 609. The server determines the adding position of each content map in the initial image canvas and the divided text corresponding to each content map.

[0176] 610. The server generates a text region binary map of the target surface image based on the added position of each content map in the initial image canvas, and generates a text annotation of the target surface image based on the divided text corresponding to each content map.

[0177] Since the planar image is generated line by line, the position and text annotation of each line can be naturally obtained in the generation process, and a binary image with text area annotated therein can be obtained.

[0178] From the above, it can be seen that in the embodiment of the present invention, each time after the image is transformed into a surface, the surface mapping matrix can be updated according to the surface mapping coordinate values ​​after the surface transformation and the initial coordinate values. Therefore, through the continuous updating of the surface mapping matrix, a variety of surface transformation effects can be achieved, and surface images with more complex surface effects can be quickly constructed, thereby improving the generation efficiency of surface images, and at the same time, data annotation at the text line level can be obtained.

[0179] In order to better implement the above method, accordingly, an embodiment of the present invention further provides a curved surface image generating device.

[0180] refer to Figure 7 , the device comprises:

[0181] The coordinate mapping unit 701 can be used to obtain a plane image, map the coordinates of each pixel in the plane image based on the curved surface mapping matrix, and obtain the initial coordinate value of each pixel in the plane image in the curved surface coordinate system;

[0182] A distance calculation unit 702 may be used to determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line;

[0183] The weight calculation unit 703 may be used to calculate the coordinate weight corresponding to each pixel point based on a preset image curvature type and distance;

[0184] The surface coordinate calculation unit 704 may be used to calculate the surface mapping coordinate value of each pixel point according to the coordinate weight and the initial coordinate value corresponding to each pixel point;

[0185] The matrix updating unit 705 may be used to calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system until the mapping end condition is met;

[0186] The curved surface image generating unit 706 may be configured to generate a target curved surface image based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0187] In some optional embodiments, the curved surface image generating unit 706 may be used to determine a neighborhood range with each pixel point as the neighborhood center based on the curved surface mapping coordinate value of each pixel point and a preset neighborhood distance;

[0188] Taking a neighborhood center as the target neighborhood center, determining the neighborhood pixel points in the neighborhood range corresponding to the target neighborhood center, and calculating the target pixel value of the target neighborhood center according to the distance between each neighborhood pixel point and the target neighborhood center and the pixel value of each neighborhood pixel point;

[0189] Return to the step of taking a neighborhood center as the target neighborhood center until the target pixel value of each neighborhood center is obtained;

[0190] The target surface image is generated according to the surface mapping coordinate values ​​of each target neighborhood center and the target pixel value.

[0191] In some optional embodiments, the image curvature type may include a convex curvature type, a concave curvature type, and a folded curvature type;

[0192] The weight calculation unit 703 may be used to calculate the convex parameter corresponding to each pixel point as the coordinate weight according to the distance corresponding to each pixel point and the preset curvature index when the image curvature type is the convex curvature type; or,

[0193] When the image curvature type is a concave curvature type, the concave parameter corresponding to each pixel point is calculated as the coordinate weight according to the distance corresponding to each pixel point and the preset curvature index; or,

[0194] When the image curvature type is a folding curvature type, a folding parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index.

[0195] In some optional embodiments, such as Figure 8 As shown, the curved surface generation device provided by the embodiment of the present invention may further include a plane image generation unit 707, which may be used to receive an image generation instruction, and the image generation instruction may include image size information and text information;

[0196] Generate an initial image canvas based on the image size information;

[0197] Based on the image size information, determine the text layout information of the initial image canvas;

[0198] According to the text typesetting information, the preset character size and character spacing, the text information is divided to obtain the divided text;

[0199] A content map is generated according to the divided text, and the content map is added to the initial image canvas to obtain a planar image.

[0200] In some optional embodiments, the surface generation device provided by the embodiment of the present invention may further include a binary image generation unit 708, which may be used to determine a neighborhood range with each pixel point as the neighborhood center based on the surface mapping coordinate value of each pixel point and a preset neighborhood distance;

[0201] According to the surface mapping matrix, determine the initial coordinate value corresponding to each neighborhood center in the plane image, and the initial neighborhood range corresponding to each neighborhood range in the plane image;

[0202] Taking a neighborhood center as the target neighborhood center, determining the initial neighborhood pixel point in the initial neighborhood range corresponding to the target neighborhood center, and taking the pixel value of the initial neighborhood pixel point with the smallest distance from the initial coordinate value of the target neighborhood center as the reference pixel value of the target neighborhood center;

[0203] Return to the step of taking a neighborhood center as the target neighborhood center until the reference pixel values ​​of each neighborhood center are obtained;

[0204] According to the reference pixel value of each target neighborhood center, a binary image of the text area corresponding to the target surface image is generated.

[0205] In some optional embodiments, the surface generation device provided by the embodiment of the present invention may further include a text annotation unit 709, which may be used to determine the adding position of each content map in the initial image canvas, and the divided text corresponding to each content map;

[0206] Determine the mapping position of each content map in the target surface image according to the surface mapping matrix and each added position;

[0207] Based on the divided texts corresponding to each mapping position and each content map, text annotations of the target surface image are generated.

[0208] In some optional embodiments, the curved surface generation device provided by the embodiment of the present invention may further include a network training unit 710, which may be used to obtain a content detection network to be trained, and the content detection network may be used to detect the content of the curved surface image;

[0209] Performing content detection on the target surface image through the content detection network to be trained to obtain detection content information;

[0210] Based on the detection content information and the text annotation of the target surface image, the detection loss of the content detection network to be trained is calculated;

[0211] The network parameters of the content detection network to be trained are adjusted according to the detection loss to obtain the trained content detection network.

[0212] As can be seen from the above, through the curved surface image generating device, a plane image can be obtained, and the coordinates of each pixel point in the plane image can be mapped based on the curved surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the curved surface coordinate system, and the bending positioning line when the plane image is bent is determined from the plane image, and the distance from each pixel point to the bending positioning line is calculated. Based on the preset image bending type and distance, the coordinate weight corresponding to each pixel point is calculated, and the surface mapping coordinate value of each pixel point is calculated according to the coordinate weight corresponding to each pixel point and the initial coordinate value, and the position increment between the surface mapping coordinate value and the initial coordinate value is calculated. Based on the position increment and the curved surface mapping matrix, a new curved surface mapping matrix is ​​generated. Return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is reached, and generate the target surface image based on the surface mapping coordinate value of each pixel point and the pixel value of each pixel point; because in the embodiment of the present invention, each time after the image is surface transformed, the surface mapping matrix can be updated according to the surface mapping coordinate value after the surface transformation and the initial coordinate value, therefore, through the continuous updating of the surface mapping matrix, a variety of surface transformation effects can be achieved, and a surface image with a more complex surface effect can be quickly constructed, thereby improving the efficiency of surface image generation.

[0213] In addition, an embodiment of the present invention further provides an electronic device, which may be a terminal or a server, etc. Fig. 9 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0214] The electronic device may include a radio frequency (RF) circuit 901, a memory 902 including one or more computer-readable storage media, an input unit 903, a display unit 904, a sensor 905, an audio circuit 906, a wireless fidelity (WiFi) module 907, a processor 908 including one or more processing cores, and a power supply 909. Those skilled in the art will appreciate that Fig. 9 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0215] The RF circuit 901 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 908 for processing; in addition, the data related to the uplink is sent to the base station. Usually, the RF circuit 901 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 901 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.

[0216] The memory 902 can be used to store software programs and modules, and the processor 908 executes various functional applications and data processing by running the software programs and modules stored in the memory 902. The memory 902 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 902 may also include a memory controller to provide the processor 908 and the input unit 903 with access to the memory 902.

[0217] The input unit 903 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, in a specific embodiment, the input unit 903 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touch pad, can collect the user's touch operations on or near it (such as the user's operation on or near the touch-sensitive surface using any suitable object or accessory such as a finger, a stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 908, and can receive and execute the command sent by the processor 908. In addition, the touch-sensitive surface can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch-sensitive surface, the input unit 903 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0218] The display unit 904 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 904 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 908 to determine the type of touch event. Subsequently, the processor 908 provides a corresponding visual output on the display panel according to the type of touch event. Although in Fig. 9 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.

[0219] The electronic device may also include at least one sensor 905, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the electronic device, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.

[0220] The audio circuit 906, the speaker, and the microphone can provide an audio interface between the user and the electronic device. The audio circuit 906 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 906 and converted into audio data, and then the audio data is output to the processor 908 for processing, and then sent to another electronic device through the RF circuit 901, or the audio data is output to the memory 902 for further processing. The audio circuit 906 may also include an earplug jack to provide communication between an external headset and the electronic device.

[0221] WiFi is a short-range wireless transmission technology. Electronic devices can help users send and receive emails, browse web pages, and access streaming media through WiFi module 907. It provides users with wireless broadband Internet access. Fig. 9 A WiFi module 907 is shown, but it is understandable that it is not an essential component of the electronic device and can be omitted as needed without changing the essence of the invention.

[0222] The processor 908 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 902, and calling data stored in the memory 902. Optionally, the processor 908 may include one or more processing cores; preferably, the processor 908 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 908.

[0223] The electronic device also includes a power supply 909 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 908 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 909 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0224] Although not shown, the electronic device may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 908 in the electronic device will load the executable files corresponding to the processes of one or more applications into the memory 902 according to the following instructions, and the processor 908 will run the application stored in the memory 902 to implement various functions, as follows:

[0225] Acquire a plane image, map the coordinates of each pixel point in the plane image based on the surface mapping matrix, and obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system;

[0226] Determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line;

[0227] Based on the preset image curvature type and distance, the coordinate weight corresponding to each pixel point is calculated;

[0228] Calculate the surface mapping coordinate value of each pixel point according to the coordinate weight and initial coordinate value corresponding to each pixel point;

[0229] Calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is met;

[0230] A target curved surface image is generated based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0231] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0232] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the curved surface image generation methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:

[0233] Acquire a plane image, map the coordinates of each pixel point in the plane image based on the surface mapping matrix, and obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system;

[0234] Determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line;

[0235] Based on the preset image curvature type and distance, the coordinate weight corresponding to each pixel point is calculated;

[0236] Calculate the surface mapping coordinate value of each pixel point according to the coordinate weight and initial coordinate value corresponding to each pixel point;

[0237] Calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until the mapping end condition is met;

[0238] A target curved surface image is generated based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

[0239] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0240] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0241] Since the instructions stored in the computer-readable storage medium can execute the steps in any one of the curved surface image generation methods provided in the embodiments of the present invention, the beneficial effects that can be achieved by any one of the curved surface image generation methods provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0242] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in various optional implementations of the above embodiments.

[0243] The above is a detailed introduction to a surface image generation method, device, electronic device and storage medium provided in an embodiment of 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 technical personnel in this field, 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. A method for generating a curved surface image, characterized in that: include: Acquire a plane image, and map the coordinates of each pixel point in the plane image based on a curved surface mapping matrix to obtain an initial coordinate value of each pixel point in the plane image in a curved surface coordinate system; Determine, from the planar image, a bending positioning line when the planar image is bent, and calculate a distance from each of the pixel points to the bending positioning line; Based on a preset image curvature type and the distance, calculating a coordinate weight corresponding to each of the pixel points; Calculating the surface mapping coordinate value of each pixel point according to the coordinate weight corresponding to each pixel point and the initial coordinate value; Calculate the position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system until the mapping end condition is met; A target curved surface image is generated based on the curved surface mapping coordinate values ​​of each pixel point and the pixel value of each pixel point.

2. The method for generating a curved surface image according to claim 1, characterized in that: The generating a target curved surface image based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point comprises: Based on the surface mapping coordinate value of each pixel point and a preset neighborhood distance, determining a neighborhood range with each pixel point as the neighborhood center; Taking a neighborhood center as a target neighborhood center, determining neighborhood pixels in a neighborhood range corresponding to the target neighborhood center, and calculating a target pixel value of the target neighborhood center according to the distance between each of the neighborhood pixels and the target neighborhood center and the pixel value of each of the neighborhood pixels; Return to the step of taking a neighborhood center as the target neighborhood center until the target pixel value of each neighborhood center is obtained; A target curved surface image is generated according to the curved surface mapping coordinate values ​​of the target neighborhood centers and the target pixel values.

3. The method for generating a curved surface image according to claim 1, wherein: The image curvature type includes a convex curvature type, a concave curvature type and a folded curvature type; The calculating the coordinate weight corresponding to each pixel point based on the preset image curvature type and the distance includes: When the image curvature type is a convex curvature type, the convex parameter corresponding to each pixel point is calculated as the coordinate weight according to the distance corresponding to each pixel point and a preset curvature index; or, When the image curvature type is a concave curvature type, the concave parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index; or, When the image curvature type is a folding curvature type, a folding parameter corresponding to each pixel point is calculated as a coordinate weight according to the distance corresponding to each pixel point and a preset curvature index.

4. The method for generating a curved surface image according to claim 1, wherein: Before acquiring the planar image, the method further includes: receiving an image generation instruction, wherein the image generation instruction includes image size information and text information; Generate an initial image canvas according to the image size information; Determining text layout information of the initial image canvas based on the image size information; According to the text typesetting information, the preset character size and character spacing, the text information is divided into texts to obtain divided texts; A content map is generated according to the divided text, and the content map is added to the initial image canvas to obtain a planar image.

5. The method for generating a curved surface image according to claim 4, characterized in that: The method further comprises: Based on the surface mapping coordinate value of each pixel point and a preset neighborhood distance, determining a neighborhood range with each pixel point as the neighborhood center; Determine, according to the surface mapping matrix, the initial coordinate values ​​corresponding to the centers of the neighborhoods in the plane image, and the initial neighborhood ranges corresponding to the neighborhood ranges in the plane image; Taking a neighborhood center as the target neighborhood center, determining the initial neighborhood pixel point in the initial neighborhood range corresponding to the target neighborhood center, and taking the pixel value of the initial neighborhood pixel point with the smallest distance from the initial coordinate value of the target neighborhood center as the reference pixel value of the target neighborhood center; Returning to the step of taking a neighborhood center as the target neighborhood center, until the reference pixel values ​​of the neighborhood centers are obtained; A text area binary image corresponding to the target curved surface image is generated according to the reference pixel values ​​of the target neighborhood centers.

6. The method for generating a curved surface image according to claim 4, characterized in that: The method further comprises: Determine the adding position of each content map in the initial image canvas, and the divided text corresponding to each content map; Determining a mapping position of each of the content maps in the target surface image according to the surface mapping matrix and each of the adding positions; Based on the divided texts corresponding to the mapping positions and the content maps, text annotations of the target curved surface image are generated.

7. The method for generating a curved surface image according to claim 6, characterized in that: The method further comprises: Obtaining a content detection network to be trained, wherein the content detection network is used to detect content of a curved surface image; Performing content detection on the target curved surface image by using the content detection network to be trained to obtain detection content information; Calculating the detection loss of the content detection network to be trained based on the detection content information and the text annotation of the target curved surface image; The network parameters of the content detection network to be trained are adjusted according to the detection loss to obtain a trained content detection network.

8. A curved surface image generating device, characterized in that: include: A coordinate mapping unit, used to acquire a plane image, map the coordinates of each pixel point in the plane image based on a curved surface mapping matrix, and obtain an initial coordinate value of each pixel point in the plane image in a curved surface coordinate system; A distance calculation unit, used to determine a bending positioning line when the plane image is bent from the plane image, and calculate the distance from each pixel point to the bending positioning line; A weight calculation unit, used for calculating the coordinate weight corresponding to each pixel point based on a preset image curvature type and the distance; A surface coordinate calculation unit, used to calculate the surface mapping coordinate value of each pixel point according to the coordinate weight corresponding to each pixel point and the initial coordinate value; a matrix updating unit, configured to calculate a position increment between the surface mapping coordinate value and the initial coordinate value, generate a new surface mapping matrix based on the position increment and the surface mapping matrix, and return to execute the step of mapping the coordinates of each pixel point in the plane image based on the surface mapping matrix to obtain the initial coordinate value of each pixel point in the plane image in the surface coordinate system, until a mapping end condition is met; The image generating unit is used to generate a target curved surface image based on the curved surface mapping coordinate value of each pixel point and the pixel value of each pixel point.

9. An electronic device, characterized in that: It comprises a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to execute the steps in the curved surface image generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the curved surface image generation method according to any one of claims 1 to 7.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the curved surface image generation method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and computer readable storage medium

    CN113450253A

  • Distance measurement method and device, electronic equipment and storage medium

    CN113819890A