Grid mapping calculation method and device, computer-readable medium and electronic device

By acquiring and optimizing the grid, determining the reference points for normalization, and calculating the mapping relationship when shooting images with a wide-angle camera, the problem of severe distortion in wide-angle cameras is solved, the calculation process is simplified, and the efficiency of distortion correction is improved.

CN115311148BActive Publication Date: 2025-10-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110490676.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-06
Publication Date
2025-10-03
Estimated Expiration
2041-05-06

AI Technical Summary

Technical Problem

In the prior art, when using a wide-angle camera to capture images, especially when the face is located at the edge of the image, the distortion is severe, and the mapping relationship calculation is complex and computationally intensive.

Method used

By obtaining the original regular grid and the optimized original optimized grid of the area to be corrected, determining the reference point for normalization, and calculating the mapping relationship between the normalized regular grid and the normalized optimized grid, distortion correction is performed.

Benefits of technology

The mapping relationship calculation process is simplified, the amount of calculation and power consumption are reduced, and the performance of distortion correction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115311148B_ABST
    Figure CN115311148B_ABST
Patent Text Reader

Abstract

The present disclosure provides a grid mapping calculation method, a grid mapping calculation device, a computer-readable medium, and an electronic device, relating to the field of image processing technology. The method comprises: obtaining an original regular grid corresponding to the area to be corrected and an original optimized grid after optimizing the original regular grid; determining a reference point in the original regular grid, and normalizing the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid; calculating a mapping relationship between the normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship. The present disclosure can eliminate unnecessary elements in the original regular grid and the original optimized grid, making the normalized normalized regular grid and the normalized optimized grid simple, thereby reducing the complexity of calculating the mapping relationship between the normalized regular grid and the normalized optimized grid, and at the same time reducing the amount of calculation when calculating the mapping relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to a grid mapping calculation method, a grid mapping calculation device, a computer-readable medium, and an electronic device. Background Art

[0002] With the increasing prevalence of electronic devices, cameras on these devices can now be wide-angle cameras. Using wide-angle cameras allows for a wider field of view, but due to the characteristics of wide-angle cameras, areas closer to the edges of the image experience increased distortion. For example, when using a camera to capture an image containing a person, significant distortion may occur if the face is at the edge of the image. To address this issue, related technologies typically employ grid optimization to correct image distortion. Summary of the Invention

[0003] The purpose of the present disclosure is to provide a grid mapping calculation method, a grid mapping calculation device, a computer-readable medium and an electronic device, thereby overcoming the problem of high complexity in mapping relationship calculation at least to a certain extent, while reducing the amount of calculation when calculating the mapping relationship.

[0004] According to a first aspect of the present disclosure, a grid mapping calculation method is provided, comprising: obtaining an original regular grid corresponding to an area to be corrected and an original optimized grid after optimizing the original regular grid; determining a reference point in the original regular grid, and normalizing the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid; and calculating a mapping relationship between the normalized regular grid and the normalized optimized grid to perform distortion correction on the area to be corrected according to the mapping relationship.

[0005] According to a second aspect of the present disclosure, a grid mapping calculation device is provided, comprising: a grid acquisition module for acquiring an original regular grid corresponding to an area to be corrected and an original optimized grid after optimizing the original regular grid; a grid normalization module for determining a reference point in the original regular grid and normalizing the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid; and a mapping calculation module for calculating a mapping relationship between the normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship.

[0006] According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above method is implemented.

[0007] According to a fourth aspect of the present disclosure, an electronic device is provided, characterized in that it includes: a processor; and a memory for storing one or more programs, which, when the one or more programs are executed by one or more processors, enables the one or more processors to implement the above-mentioned method.

[0008] An embodiment of the present disclosure provides a grid mapping calculation method that, after obtaining the original regular grid and the corresponding original optimized grid corresponding to the area to be corrected, normalizes the original regular grid and the original optimized grid based on reference points determined in the original regular grid, and then calculates a mapping relationship based on the normalized normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship. By normalizing the original regular grid and the original optimized grid based on the reference points determined in the original regular grid, unnecessary elements in the original regular grid and the original optimized grid can be eliminated, making the normalized normalized regular grid and the normalized optimized grid simpler, thereby reducing the complexity of calculating the mapping relationship between the normalized regular grid and the normalized optimized grid, and at the same time reducing the amount of computation required for calculating the mapping relationship.

[0009] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:

[0011] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;

[0012] Figure 2 A schematic diagram showing an electronic device to which the embodiments of the present disclosure may be applied;

[0013] Figure 3 A flowchart schematically illustrates a grid mapping calculation method in an exemplary embodiment of the present disclosure;

[0014] Figure 4 A flow chart schematically illustrates a method for determining a region to be corrected in an exemplary embodiment of the present disclosure;

[0015] Figure 5 A flowchart schematically illustrates a method for determining a face area to be corrected in an exemplary embodiment of the present disclosure;

[0016] Figure 6 A flowchart schematically illustrates another grid mapping calculation method in an exemplary embodiment of the present disclosure;

[0017] Figure 7 A schematic diagram schematically illustrates the composition of a grid mapping calculation device in an exemplary embodiment of the present disclosure;

[0018] Figure 8 The figure schematically shows the composition of another grid mapping calculation device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0020] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0021] Figure 1 A schematic diagram shows a system architecture of an exemplary application environment in which a grid mapping calculation method and apparatus according to an embodiment of the present disclosure can be applied.

[0022] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with image processing functions, including but not limited to desktop computers, portable computers, smart phones, and tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as needed. For example, the server 105 may be a server cluster consisting of multiple servers.

[0023] The grid mapping calculation method provided in the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the grid mapping calculation device is generally provided in the terminal devices 101, 102, and 103. However, it is easy for those skilled in the art to understand that the grid mapping calculation method provided in the embodiment of the present disclosure can also be executed by the server 105, and accordingly, the grid mapping calculation device can also be provided in the server 105, and this is not particularly limited in the present exemplary embodiment. For example, in an exemplary embodiment, the terminal devices 101, 102, and 103 may include a camera module to capture the image to be processed, and then send the image to be processed to the server 105 through the network 104, so that the server 105 executes the above-mentioned silver snake relationship calculation method to obtain the mapping relationship.

[0024] An exemplary embodiment of the present disclosure provides an electronic device for implementing a grid mapping calculation method, which may be Figure 1 The terminal device 101, 102, 103 or the server 105 in the embodiment of the present invention comprises at least a processor and a memory, wherein the memory is used to store executable instructions of the processor, and the processor is configured to execute the grid mapping calculation method by executing the executable instructions.

[0025] Below Figure 2 The structure of the electronic device is exemplarily described by taking the mobile terminal 200 in FIG. 1 as an example. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Figure 2 The structure in FIG. 2 can also be applied to fixed type devices. In other embodiments, the mobile terminal 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware. The interface connection relationship between the components is only shown schematically and does not constitute a structural limitation of the mobile terminal 200. In other embodiments, the mobile terminal 200 may also adopt the same Figure 2 Different interface connection methods, or a combination of multiple interface connection methods.

[0026] like Figure 2As shown, the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a receiver 272, a microphone 273, an earphone interface 274, a sensor module 280, a display 290, a camera module 291, an indicator 292, a motor 293, a button 294, and a subscriber identification module (SIM) card interface 295. The sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, and the like.

[0027] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0028] The NPU is a neural network (NN) computing processor that rapidly processes input information by drawing on biological neural network structures, such as the transmission patterns between neurons in the human brain, and can also continuously self-learn. The NPU can implement intelligent cognitive applications such as image recognition, face recognition, speech recognition, and text comprehension on the mobile terminal 200. In some embodiments, the NPU can perform face recognition on the processed image to determine the facial area to be corrected.

[0029] The processor 210 is provided with a memory that can store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and the execution of the instructions is controlled by the processor 210.

[0030] The charging management module 240 is configured to receive charging input from a charger. The power management module 241 is configured to connect the battery 242, the charging management module 240, and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240 to power the processor 210, the internal memory 221, the display 290, the camera module 291, and the wireless communication module 260.

[0031] The wireless communication function of mobile terminal 200 can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals; mobile communication module 250 can provide wireless communication solutions for mobile terminal 200, including 2G / 3G / 4G / 5G; the modem processor can include a modulator and a demodulator; and wireless communication module 260 can provide wireless communication solutions for mobile terminal 200, including wireless local area networks (WLAN) (such as Wireless Fidelity (Wi-Fi) networks) and Bluetooth (BT).

[0032] The mobile terminal 200 implements display functions through a GPU, a display screen 290 and an application processor, and can implement shooting functions through an ISP, a camera module 291, a video codec, a GPU, a display screen 290 and an application processor, and can also implement audio functions through an audio module 270, a speaker 271, a receiver 272, a microphone 273, a headphone jack 274 and an AP.

[0033] The external memory interface 222 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile terminal 200. The external memory card communicates with the processor 210 via the external memory interface 222 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0034] The internal memory 221 can be used to store computer executable program code, which includes instructions. The internal memory 221 may include volatile memory, non-volatile memory, etc. The processor 210 executes various functional applications and data processing of the mobile terminal 200 by running instructions stored in the internal memory 221 and / or instructions stored in a memory provided in the processor.

[0035] The sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, etc., and sensors with other functions may also be set in the sensor module 280 according to actual needs, such as an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.

[0036] The mobile terminal 200 may also include other devices that provide auxiliary functions, such as the buttons 294 including a power button, a volume button, etc.; and the indicator 292, the motor 293, the SIM card interface 295, etc.

[0037] Figure 3 An exemplary process of a grid mapping calculation method is shown, which can be applied to the server 105 or to one or more of the terminal devices 101, 102, and 103, and includes the following steps S310 to S330:

[0038] In step S310, an original regular grid corresponding to the area to be corrected and an original optimized grid obtained by optimizing the original regular grid are obtained.

[0039] In one exemplary embodiment, to achieve better distortion correction results, when obtaining the original regular grid corresponding to the area to be corrected, a grid of a preset resolution can be used to describe the area to be corrected, thereby obtaining the original regular grid. The preset resolution can be set based on specific needs; typically, a lower resolution is selected to prevent the original regular grid from being too dense.

[0040] In one exemplary embodiment, when the area to be corrected is a face, initial image data of the face area can be detected, and then projected image data of the face area based on a stereographic plane projection can be determined. Subsequently, the face scale can be calculated based on the projected image data and the initial image data. The face area can then be described based on a grid of a preset resolution, with reference to the face scale, to obtain an original regular grid.

[0041] Among them, facial scale can be used to describe certain feature information of the facial image and serve as a reference weight in the facial distortion correction processing logic. When calculating facial scale based on the projected image data and the initial image data, facial scale can be used to describe parameter change information between the projected image data and the initial image data and serve as a reference weight in the facial distortion correction processing logic. For example, facial scale is used to describe the reference weight of length change information and / or angle change information in the facial distortion correction processing logic, but this disclosure is not limited to this.

[0042] In an exemplary embodiment, when the area to be corrected is a face, when obtaining the original optimized mesh, the original regular mesh can be optimized using perspective projection and stereographic projection to obtain the corresponding original optimized mesh. It should be noted that in addition to the aforementioned perspective projection and stereographic projection, other projection methods can also be used to optimize the original regular mesh to obtain the original optimized mesh.

[0043] In step S320 , a reference point is determined in the original regular grid, and the original regular grid and the original optimized grid are normalized based on the reference point to obtain a normalized regular grid and a normalized optimized grid.

[0044] In one exemplary embodiment, when determining the reference point, a grid point in the original regular grid may be determined according to a preset rule, and this grid point may be determined as the reference point. For example, the preset rule may include a rule for defining the location of the target grid point. Specifically, assuming the preset rule is the first grid point in the original regular grid, the first grid point may be determined as the reference point.

[0045] In an exemplary embodiment, after obtaining the reference point, the original regular grid and the original optimized grid can be normalized based on the reference point. Specifically, the reference point can be detected by each grid point in the original regular grid to obtain a normalized regular grid, and the reference point can be subtracted from each grid point in the original optimized grid to obtain a normalized optimized grid.

[0046] For example, the original regular grid can be denoted as P dst , the original optimized grid can be recorded as P src Assume that the reference point determined by the preset rule is P dst0 , then the normalization process of the original regular grid can be expressed as P dst -P dst0 , the normalization process of the original optimized grid can be expressed as P src -P dst0 .

[0047] In step S330 , a mapping relationship between the normalized regular grid and the normalized optimized grid is calculated, so as to perform distortion correction on the area to be corrected according to the mapping relationship.

[0048] In an exemplary embodiment, after obtaining the normalized regular grid and the normalized optimized grid, the mapping relationship between the normalized regular grid and the normalized optimized grid may be directly calculated to perform distortion correction on the area to be corrected based on the mapping relationship.

[0049] In an exemplary embodiment, the mapping relationship between grids can be represented by a mapping matrix H. Correspondingly, when calculating the mapping relationship between the normalized regular grid and the normalized optimized grid, it can be calculated by the following formula 1:

[0050] H(P src -P dst0 )-(P dst -P dst0 )=0 Formula 1

[0051] Where H represents the mapping matrix; P src -P dst0 represents the normalized regular grid obtained after normalizing the original regular grid; P dst -P dst0 Represents the normalized optimized mesh obtained by normalizing the original optimized mesh. By calculating the mapping relationship based on the normalized normalized regular mesh and the normalized optimized mesh, unnecessary elements in the original regular mesh and the original optimized mesh can be eliminated before calculating the mapping relationship. This simplifies the mapping relationship calculation process, reduces the computational complexity, and thus reduces power consumption. Ultimately, when performing distortion correction on the area to be corrected based on the mapping relationship, performance is significantly improved.

[0052] In addition, before obtaining the original regular grid corresponding to the area to be corrected and the original optimized grid after optimizing the original regular grid, in order to determine the area to be corrected, refer to Figure 4 As shown, the following steps S410 and S420 may be included:

[0053] In step S410, an image to be processed is obtained.

[0054] The image to be processed refers to an image that can be used for distortion correction processing, for example, a portrait image that needs to be subjected to face distortion correction processing.

[0055] In an exemplary embodiment, the image to be processed can be acquired in real time by a camera or image sensor configured by the terminal device, for example, by directly capturing an original image containing a face through a mobile phone camera as the image to be processed; it can also be acquired from other specific image sources, such as from a locally stored photo album or historically taken images; it can also be downloaded from the cloud or the Internet, etc.

[0056] In step S420 , image detection is performed on the image to be processed to determine at least one area to be corrected in the image to be processed.

[0057] In one exemplary embodiment, after obtaining an image to be processed, in order to determine the area in the image to be processed that requires correction, image detection can be performed on the image to identify the area in the image to be processed that requires correction, and then the area to be corrected can be determined as the area to be corrected. The image detection performed on the image to be processed can be configured based on the specific correction requirements. For example, for a face correction task, the image detection performed on the image to be processed can include image detection processes such as face recognition.

[0058] In an exemplary embodiment, when the area to be corrected is a face area, image detection is performed on the image to be processed to determine at least one area to be corrected in the image to be processed, referring to Figure 5 As shown, the following steps S510 to S530 may be included:

[0059] In step S510, face detection is performed on the image to be processed.

[0060] In an exemplary embodiment, face detection can be performed on the image to be processed by extracting specific image features, such as color features, texture features, shape features, or spatial relationship features, to identify whether the image to be processed includes a face region. Considering that this exemplary embodiment is intended to identify a face region, the image features may include feature data that can reflect facial characteristics, such as facial shape, facial feature shape, facial feature structure, facial brightness, facial skin color, facial texture, facial orientation, or facial size, and this disclosure does not impose any particular limitations on this.

[0061] In addition, the present disclosure does not impose any special restrictions on the method of extracting image features. For example, when extracting image features, multiple Haar feature templates can be used to traverse the image to be processed to determine the feature values ​​to extract the corresponding image features.

[0062] Furthermore, when the image to be processed includes a face area, it is also necessary to detect whether the face area needs to be corrected for distortion, that is, to determine whether one or more face areas contained in the image to be processed are face areas to be corrected. If they are not face areas to be corrected, it means that the face area contained in the current image to be processed does not need to be corrected for distortion, and the image to be processed can be output directly; if they are face areas to be corrected, it means that there is a face area to be corrected in the current image to be processed that needs to be corrected for distortion, and the corresponding mapping relationship can be calculated for the face area to be corrected, and then the face area to be corrected can be locally corrected.

[0063] In step S520, when a face region is detected in the image to be processed, the area and position information of the face region are determined.

[0064] In an exemplary embodiment, if a detected face region exists in the image to be processed, the area and position information of the face region can be obtained. It should be noted that when there are multiple face regions in the image to be processed, the area and position information of each face region can be obtained separately, and the area, position information and corresponding face region can be saved in pairs to facilitate the distinction of the information corresponding to each face region. For example, the area and position information can be used as labels for the face region; for another example, the area and position information can be given the same name as the corresponding face region. The area of ​​the face region can be used to indicate the area occupied by the face region in the image to be processed, while the position information is used to indicate the specific position of the face region in the image to be processed.

[0065] In step S530 , it is determined whether the face region is a face region to be corrected based on the area and position information of the face region.

[0066] In one exemplary embodiment, after obtaining the area and position information of a facial region, a determination can be made based on the area and position information. When the area and position information meet preset conditions, the facial region is determined to be a facial region to be corrected. Facial regions with different area and position information can have different preset conditions. That is, after determining the area and position information of a facial region, the corresponding preset conditions can be used to determine whether it is a facial region to be corrected. Specifically, the preset conditions can be determined based on prior information through preliminary image testing.

[0067] For example, based on prior information, a circular area with the image center as the origin and a radius of 500 pixels is determined (the circular area is only for schematic illustration; in other embodiments, it may also include other shape ranges, which is not specifically limited in this disclosure). When the face area is within the circular area, the face area will not be distorted, that is, when the area and position information of the face area meet the preset conditions within the circular area, it is determined that it is not the face area to be corrected; when the face area is outside the circular area and the area meets certain conditions, the face area will be distorted, that is, when the area and position information of the face area meet the preset conditions outside the circular area, it is determined that it is the face area to be corrected.

[0068] It should be noted that in actual applications, when a facial region is a facial region to be corrected, the degree of correction thereof may vary due to differences in the area and position information of the facial region. For example, when the facial region is between 500 and 600 pixel units and its area is greater than a first threshold and less than a second threshold (where the second threshold is greater than the first threshold), the degree of correction of the facial region to be corrected is the first degree; and when the facial region is between 600 and 700 pixel units and its area is greater than the second threshold, the degree of correction of the facial region to be corrected is the second degree, where the second degree is greater than the first degree. Based on this, this exemplary embodiment can determine whether each facial region contained in the image to be processed is a facial region to be corrected based on the area and position information of the facial region, and, if a facial region is determined to be a facial region to be corrected, what its degree of correction is, etc.

[0069] The following reference Figure 6 As shown, the technical solution of the disclosed embodiment is described by taking the area to be corrected as the face area to be corrected and performing local correction on the face area to be corrected as an example:

[0070] Step S601, performing semantic segmentation on the image to be processed, determining edge data of the face area to be corrected, and obtaining face mask information of the face image to be corrected;

[0071] Step S603: establishing a grid in the image to be processed based on a preset resolution, and determining an original regular grid corresponding to the face area to be corrected;

[0072] Step S605: Calculate scale information of the face region to be corrected based on the face detection result (i.e., whether the image to be processed contains a face), the semantic segmentation result, and the stereographic projection. The scale information can be calculated based on the area of ​​the face region in the image to be processed and the area of ​​the face region in the stereographic projection.

[0073] Step S607, optimizing the original regular grid according to scale information, perspective projection, and stereographic plane projection to obtain an original optimized grid;

[0074] Step S609: According to the preset rule (assuming the preset rule is the first grid point), the first grid point in the original regular grid is determined as the reference point P. dst0 ;

[0075] Step S611, based on the reference point P dst0 For the original regular grid P dst and the original optimized mesh P src Normalize and get the normalized regular grid P dst -P dst0 and the normalized optimized grid P src -P dst0 ;

[0076] Step S613, calculate the normalized regular grid P based on the mapping matrix H and formula 1 dst -P dst0 and the normalized optimized grid P src -P dst0 The mapping relationship between them;

[0077] Step S615 , interpolating the image to be processed based on the mapping matrix H to obtain a result of performing local correction on the face region to be corrected in the image to be processed.

[0078] It should be noted that the above-described local correction process for the face region to be corrected can also be applied to scenarios where other objects need to be corrected. In this case, it is only necessary to directly detect the other objects to be corrected during image detection, optimize the original regular grid corresponding to the other objects to be corrected to obtain the original optimized grid, and then normalize it according to the reference point and calculate the mapping relationship. In this way, the local area of ​​the processed image can be corrected based on the mapping relationship.

[0079] It should be noted that the above figures are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the above figures do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0080] For further reference, Figure 7 As shown, in the embodiment of this example, a grid mapping calculation device 700 is further provided, comprising a grid acquisition module 710, a grid normalization module 720 and a mapping calculation module 730. In particular:

[0081] The grid acquisition module 710 may be used to acquire an original regular grid corresponding to the area to be corrected and an original optimized grid obtained by optimizing the original regular grid.

[0082] The grid normalization module 720 may be configured to determine a reference point in the original regular grid, and normalize the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid.

[0083] The mapping calculation module 730 may be used to calculate a mapping relationship between the normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship.

[0084] In an exemplary embodiment, the grid normalization module 720 may be configured to determine a target grid point in the original regular grid according to a preset rule, and determine the target grid point as a reference point.

[0085] In an exemplary embodiment, the grid normalization module 720 may be configured to obtain a normalized regular grid by subtracting a reference point from each grid point in the original regular grid, and to obtain a normalized optimized grid by subtracting a reference point from each grid point in the original optimized grid.

[0086] In an exemplary embodiment, the grid acquisition module 710 may be configured to use a grid of preset resolution to describe the area to be corrected, and obtain an original regular grid.

[0087] In an exemplary embodiment, the grid acquisition module 710 may be configured to optimize the original regular grid using perspective projection and stereographic projection to obtain an original optimized grid.

[0088] In an exemplary embodiment, referring to Figure 8 As shown, the grid mapping calculation device 800 may further include a region determination module 810. The region determination module 810 may be used to obtain an image to be processed; perform image detection on the image to be processed to determine at least one region to be corrected in the image to be processed.

[0089] In an exemplary embodiment, the region determination module 810 can be used to perform face detection on the image to be processed; when a face region is detected in the image to be processed, the area and position information of the face region are determined; based on the area and position information of the face region, it is determined whether the face region is a face region to be corrected.

[0090] The specific details of each module in the above device have been described in detail in the implementation method part. For details not disclosed, please refer to the implementation method part, and they will not be repeated here.

[0091] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods, or program products. Therefore, various aspects of the present disclosure may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."

[0092] The exemplary embodiments of the present disclosure further provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present disclosure, for example, Figures 3 to 6 Any one or more steps in .

[0093] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0094] In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the foregoing.

[0095] In addition, the program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, and the like, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0096] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow from the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.

[0097] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A grid mapping calculation method, characterized in that: include: Obtaining an original regular grid corresponding to the area to be corrected and an original optimized grid obtained by optimizing the original regular grid; wherein the area to be corrected is a face area; obtaining the original optimized grid includes: optimizing the original regular grid using perspective projection and stereographic plane projection to obtain the original optimized grid; Determining a reference point in the original regular grid, and normalizing the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid; wherein determining the reference point in the original regular grid includes: determining a grid point in the original regular grid according to a preset rule, and determining the grid point as the reference point; Calculating a mapping relationship between the normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship; Normalizing the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid includes: A normalized regular grid is obtained by subtracting the reference point from each grid point in the original regular grid, and a normalized optimized grid is obtained by subtracting the reference point from each grid point in the original optimized grid.

2. The method according to claim 1, characterized in that The obtaining of the original regular grid corresponding to the area to be corrected includes: The area to be corrected is described using a grid of preset resolution to obtain an original regular grid.

3. The method according to claim 1, characterized in that Before obtaining the original regular grid corresponding to the area to be corrected and the original optimized grid obtained by optimizing the original regular grid, the method further includes: Get the image to be processed; Image detection is performed on the image to be processed to determine at least one area to be corrected in the image to be processed.

4. The method according to claim 3, characterized in that The area to be corrected includes a face area to be corrected; The performing image detection on the image to be processed to determine at least one area to be corrected in the image to be processed includes: Perform face detection on the image to be processed; When a face region is detected in the image to be processed, determining the area and position information of the face region; Determine whether the face region is a face region to be corrected based on the area and position information of the face region.

5. A grid mapping calculation device, characterized in that: include: a grid acquisition module, configured to acquire an original regular grid corresponding to the area to be corrected and an original optimized grid obtained by optimizing the original regular grid; wherein the area to be corrected is a face area; and acquiring the original optimized grid comprises: optimizing the original regular grid using perspective projection and stereographic plane projection to obtain the original optimized grid; a grid normalization module, configured to determine a reference point in the original regular grid and normalize the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid; wherein the area to be corrected is a face area; obtaining the original optimized grid comprises: optimizing the original regular grid using perspective projection and stereographic plane projection to obtain the original optimized grid; a mapping calculation module, configured to calculate a mapping relationship between the normalized regular grid and the normalized optimized grid, so as to perform distortion correction on the area to be corrected according to the mapping relationship; The normalizing of the original regular grid and the original optimized grid based on the reference point to obtain a normalized regular grid and a normalized optimized grid includes: subtracting the reference point from each grid point in the original regular grid to obtain a normalized regular grid, and subtracting the reference point from each grid point in the original optimized grid to obtain a normalized optimized grid.

6. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

7. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the method according to any one of claims 1 to 4 by executing the executable instructions.

Citation Information

Patent Citations

  • Perspective distortion correction on faces

    CN112055869A