Image distortion correction methods, devices, equipment and storage media
By determining anti-stretching constraints in wide-angle images and performing distortion correction based on the relative positional relationship between the face and body, the problem of distortion in face images captured by wide-angle cameras is solved, ensuring that image quality is not compromised.
Patent Information
- Application Number
- CN202110394697.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-13
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2041-04-13
AI Technical Summary
Wide-angle cameras are prone to distortion in facial images, resulting in poor image quality. Furthermore, existing distortion correction methods may stretch the human body, affecting image quality.
By determining the relative positional relationship between the target face and the body, anti-stretching constraints are set, and distortion correction is performed based on these constraints to prevent the body from being stretched during the distortion correction process.
It effectively prevents the human body from being stretched during distortion correction, ensuring image presentation quality and reducing the impact of distortion correction on the area around the face.
Smart Images

Figure CN115205130B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image distortion correction method, apparatus, device, and storage medium. Background Technology
[0002] With the development of science and technology, cameras have become increasingly common in people's daily lives. Among them, wide-angle cameras are a special type of camera, widely used because they can capture wide-angle images with a larger field of view. However, due to the optical characteristics of wide-angle cameras, the wide-angle images they capture often have a certain degree of distortion. In particular, users are generally more sensitive to faces. Therefore, if a wide-angle image captured by a wide-angle camera includes a face, users will easily notice the distortion of the face, thus seriously affecting the presentation quality of the wide-angle image.
[0003] In related technologies, when a wide-angle image contains a face, distortion correction parameters can be determined based on the position of the face in the wide-angle image and the proportion of the face region in the wide-angle image, and the determined distortion correction parameters can be used to perform distortion correction processing on the wide-angle image.
[0004] However, in related technologies, the human body in the image obtained after distortion correction of a wide-angle image is likely to be stretched, which will affect the image presentation. Summary of the Invention
[0005] Based on this, embodiments of this application provide an image distortion correction method, apparatus, device, and storage medium, which can improve the presentation effect of wide-angle images.
[0006] Firstly, an image distortion correction method is provided, the method comprising:
[0007] Based on the relative positional relationship between the target face requiring distortion correction in the target wide-angle image and each person in the target wide-angle image, the target person is identified from among the persons included in the target wide-angle image; based on the target person, an anti-stretching constraint condition is determined, which is used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction to be within a preset range; based on the anti-stretching constraint condition, distortion correction processing is performed on the target wide-angle image.
[0008] Secondly, an image distortion correction device is provided, the device comprising:
[0009] The first determining module is used to determine the target person from the people included in the target wide-angle image based on the relative positional relationship between the target face that needs to be distorted in the target wide-angle image and each person in the target wide-angle image.
[0010] The second determining module is used to determine the anti-stretching constraint conditions based on the target body. The anti-stretching constraint conditions are used to constrain the difference between the size of the target body after distortion correction and the size before distortion correction to be within a preset range.
[0011] The correction module is used to perform distortion correction processing on the wide-angle image of the target based on the anti-stretching constraint.
[0012] Thirdly, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, implements the image distortion correction method as described in the first aspect above.
[0013] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the image distortion correction method as described in the first aspect above.
[0014] The beneficial effects of the technical solutions provided in this application include at least the following:
[0015] By determining the relative positions of the target face requiring distortion correction within the target wide-angle image and the other figures in the image, the target person is identified from the figures included in the target wide-angle image. Then, an anti-stretching constraint is established based on this target person. This constraint ensures that the difference between the target person's size after distortion correction and its size before distortion correction is within a preset range. Next, distortion correction is performed on the target wide-angle image based on this anti-stretching constraint. In this way, targets that may be stretched due to distortion correction can be identified based on the target face requiring correction within the target wide-angle image. Next, based on the target human body, anti-stretching constraints are determined, and distortion correction processing is performed on the target wide-angle image according to the anti-stretching constraints. Since the anti-stretching constraints are used to constrain the difference between the size of the target human body after distortion correction and the size before distortion correction within a preset range, distortion correction processing of the target wide-angle image according to the anti-stretching constraints can ensure that the deformation of the target human body during distortion correction is not too large, that is, to avoid stretching of the target human body during distortion correction. Therefore, the presentation effect of the image obtained after distortion correction can be guaranteed. Attached Figure Description
[0016] Figure 1 A flowchart illustrating an image distortion correction method provided in this application embodiment;
[0017] Figure 2 A flowchart illustrating an image distortion correction method provided in this application embodiment;
[0018] Figure 3 A flowchart illustrating an image distortion correction method provided in this application embodiment;
[0019] Figure 4 A block diagram of an image distortion correction device provided in an embodiment of this application;
[0020] Figure 5 A block diagram of another image distortion correction device provided in the embodiments of this application;
[0021] Figure 6 This is a block diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0023] In practical applications, to avoid the adverse effects of facial distortion on the presentation of wide-angle images, distortion correction parameters are usually determined based on the position of the face in the wide-angle image and the proportion of the face area in the wide-angle image when the wide-angle image contains a face. The determined distortion correction parameters are then used to perform distortion correction processing on the wide-angle image, thereby eliminating facial distortion in the wide-angle image.
[0024] However, while the above methods for distortion correction of wide-angle images can eliminate facial distortion, they may introduce new distortions to the image region surrounding the face. For example, if the image region around the face in the wide-angle image contains straight lines, these lines may become curved after distortion correction. Since the human body is generally located around the face, the new distortions introduced by distortion correction most often affect the body; in many cases, the body appears stretched after distortion correction.
[0025] To ensure the rendering effect of the wide-angle image after distortion correction, this application provides an image distortion correction method. In this method, the target face in the target wide-angle image, which requires distortion correction, is determined from the faces included in the target wide-angle image based on their relative positions to the other figures in the image. Then, an anti-stretching constraint is determined based on the target face. This constraint ensures that the difference between the size of the target face after distortion correction and its size before distortion correction is within a preset range. Finally, distortion correction is performed on the target wide-angle image based on this constraint. Thus, the image can be distorted according to the face in the target wide-angle image. The target face to be corrected is identified as a target body that may be stretched during distortion correction. Then, anti-stretching constraints are determined based on the target body, and distortion correction is performed on the target wide-angle image according to these constraints. Since the anti-stretching constraints are used to ensure that the difference between the size of the target body after distortion correction and the size before distortion correction is within a preset range, performing distortion correction on the target wide-angle image according to these constraints can ensure that the deformation of the target body during distortion correction is not too large, that is, to avoid stretching of the target body during distortion correction. Therefore, the presentation effect of the image obtained after distortion correction can be guaranteed.
[0026] It should be noted that the entity executing the image distortion correction method provided in this application embodiment can be an image distortion correction device. This device can be implemented as part or all of a photographing device or server through software, hardware, or a combination of both. In this application embodiment, the photographing device can be equipped with a wide-angle camera, such as a smartphone, tablet, or digital camera; this application embodiment does not limit the specific type of photographing device. The server can be a single server or a server cluster composed of multiple servers.
[0027] When the executing entity is a photographing device, the photographing device can capture wide-angle images using its built-in wide-angle camera, and can perform distortion correction processing on the captured wide-angle images based on the image distortion correction method provided in this application embodiment. When the executing entity is a server, the server can receive wide-angle images sent by the photographing device, and can perform distortion correction processing on the received wide-angle images based on the image distortion correction method provided in this application embodiment. Furthermore, when the executing entity is a server, the server can store wide-angle images, and the server can perform distortion correction processing on the stored wide-angle images based on the image distortion correction method provided in this application embodiment.
[0028] For ease of explanation, the following embodiments will be described using a computer device as the execution subject. Readers should understand that the computer device can be the photographing device or server mentioned above.
[0029] Please refer to Figure 1 The diagram illustrates a flowchart of an image distortion correction method provided in an embodiment of this application, which can be applied to the computer device described above. Figure 1 As shown, the image distortion correction method may include the following steps:
[0030] Step 101: The computer device determines the target person from among the people included in the target wide-angle image based on the relative positional relationship between the target face that needs distortion correction in the target wide-angle image and each person in the target wide-angle image.
[0031] It should be noted that the target wide-angle image in step 101 is a wide-angle image that needs to be distorted. The target wide-angle image includes a face and a body. In this embodiment, the body may include the torso and limbs, or may include a part of the torso and limbs.
[0032] Computer equipment can identify faces from a target wide-angle image based on a face detection algorithm, and determine the target face that needs distortion correction from the identified faces. Optionally, the computer equipment can determine the target face from the identified faces based on face distortion correction conditions, wherein the face distortion correction conditions are conditions related to the position and size of the face in the target wide-angle image. In addition, the computer equipment can also identify human bodies from the target wide-angle image based on a human face detection algorithm.
[0033] Then, for each person included in the target wide-angle image, the computer device can obtain the relative positional relationship between the target face and the person. Then, the computer device can determine the target person from the people included in the target wide-angle image based on the obtained relative positional relationship. The target person is a person who may be stretched after distortion correction processing. In other words, the target person is a person whose probability of being stretched after distortion correction processing is greater than a preset threshold.
[0034] Step 102: The computer equipment determines the anti-stretching constraint conditions based on the target person.
[0035] In practical applications, distortion correction of wide-angle images is based on the projection transformation process of wide-angle images. The projection transformation process of wide-angle images can be described as follows: first, the wide-angle image is projected onto a three-dimensional transition sphere, and then the transition sphere is projected onto the final plane. The transition sphere is determined according to the optical parameters of the wide-angle lens. Distortion correction requires solving a mapping relationship from the coordinates of the transition sphere to the coordinates of the final plane, and using this mapping relationship to map each pixel in the wide-angle image onto the final plane to achieve distortion correction of the wide-angle image.
[0036] Typically, solving this mapping relationship requires certain constraints, such as conformal constraints, linear constraints, and smoothing constraints. In this embodiment, to prevent the target person from being stretched after distortion correction, anti-stretching constraints can be determined based on the target person. These anti-stretching constraints are used to ensure that the difference between the size of the target person after distortion correction and the size before distortion correction is within a preset range.
[0037] In subsequent steps, the computer equipment can solve for the mapping relationship based on the anti-stretching constraint, and then map each pixel in the target wide-angle image onto the final plane based on this mapping relationship, thereby achieving distortion correction processing of the target wide-angle image. Since the solution of this mapping relationship is constrained by the anti-stretching constraint, the obtained mapping relationship will ensure that the target person is not stretched, or at least not significantly stretched, thus preventing distortion of the target person after distortion correction processing and ensuring the image presentation effect.
[0038] In this embodiment of the application, the anti-stretch constraint condition can be an anti-stretch constraint function. Optionally, the process of determining the anti-stretch constraint function may include: the computer device acquiring preset dimensional constraint parameters and preset translation constraint parameters, wherein the dimensional constraint parameters are used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction, and the translation constraint parameters are used to constrain the difference between the position of the target person after distortion correction and the position before distortion correction. Then, the computer device constructs the anti-stretch constraint function based on the dimensional constraint parameters and the translation constraint parameters.
[0039] The following function is an example of a tensile constraint function:
[0040]
[0041] Among them, E p The error term has a target value of 0, v i Let s be the coordinates of the final plane. kp is a scale constraint parameter, which can take the value 1, indicating that the size of the target human body after distortion correction is equal to its size before distortion correction. i Let t be the coordinates in the wide-angle image of the target. k These are the translation constraint parameters.
[0042] Step 103: The computer equipment performs distortion correction processing on the target wide-angle image based on the anti-stretching constraint conditions.
[0043] As described above, the computer device can solve for the mapping relationship based on the anti-stretching constraint condition, and then map each pixel in the target wide-angle image onto the final plane based on this mapping relationship. Optionally, the computer device can construct a mesh in the target wide-angle image, and map each grid point in the mesh onto the final plane based on the mapping relationship. Then, the computer device can interpolate the pixel values of each pixel in the target wide-angle image to the grid points of the final plane, thereby achieving the purpose of mapping each pixel in the target wide-angle image onto the final plane based on this mapping relationship.
[0044] In practical applications, distortion correction of wide-angle images does not necessarily introduce new distortions to the image region surrounding a face. The inventors of this application, through detailed research, discovered that if the size difference between the face before and after distortion correction is not significant, distortion correction of the wide-angle image will not introduce new distortions to the image region surrounding the face, or in other words, it will not introduce significant new distortions to the image region surrounding the face. Considering this situation, to reduce the computational load of distortion correction, such as... Figure 2 As shown, computer equipment can be based on Figure 2 The steps shown are the technical process for implementing step 101 above.
[0045] Step 201: The computer device identifies candidate faces from the target face whose corrected deformation is greater than a preset deformation threshold.
[0046] The distortion correction parameter characterizes the difference between the size of the target face after distortion correction and its size before distortion correction. It should be noted that, for a target wide-angle image with a resolution of 640 x 480, this preset distortion threshold can be 20 pixels.
[0047] In one possible implementation, the computer device can sequentially perform perspective projection and spherical projection on the target face to obtain the projected face. Then, the computer device can determine the corrected deformation of the target face based on the size difference between the projected face and the target face.
[0048] In other words, computer equipment can simulate the distortion correction process based on perspective projection and spherical projection, and use the projected face to simulate the target face after distortion correction. Then, the computer equipment can determine the corrected deformation of the target face based on the size difference between the projected face and the target face.
[0049] Step 202: The computer device determines the target person from the people included in the target wide-angle image based on the relative positional relationship between the candidate's face and each person in the target wide-angle image.
[0050] Furthermore, the inventors of this application discovered through research that, generally, only when multiple new distortions are superimposed can a person's body be significantly stretched. In other words, only after distortion correction processing eliminates the distortions of multiple faces, and the new distortions introduced by each face during distortion elimination are superimposed, can a person's body be significantly stretched. Considering this situation, to reduce the computational load of distortion correction, the computer device can detect whether the number of target faces contained in the target wide-angle image is greater than 1. If the number of target faces contained in the target wide-angle image is greater than 1, the computer device can execute the technical process of step 101 above, that is, determine the target person from the people included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image. Of course, in the embodiments of this application, if the number of target faces contained in the target wide-angle image is greater than 1, the computer device can also... Figure 2 The steps shown are the technical process for implementing step 101 above.
[0051] Optionally, the embodiments of this application provide the following two exemplary methods for determining the target person. It should be noted that these two exemplary methods for determining the target person can be based on the limitations of the execution method of step 101 in the above embodiments.
[0052] In the first method, the computer device determines the person whose face intersects with the target face from among the people included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image. The computer device then takes the person whose face intersects with the target face as the target person.
[0053] It should be noted that "intersection" here refers to the overlapping area between the person's body and the target face. Optionally, the computer device can determine the mask of the target face and the masks of each person's body. Then, the computer device can determine whether the masks of each person's body intersect with the mask of the target face, or in other words, whether the masks of each person's body and the mask of the target face are connected, thereby determining whether each person's body intersects with the target face.
[0054] Normally, if a person's body intersects with a target face, it means that the distance between the person's body and the target face is very close. In this case, while eliminating the distortion of the target face through distortion correction, it may introduce significant new distortions to the person's body, causing the person's body to be stretched after distortion correction. Considering this, in this embodiment, the person's body intersecting with the target face can be considered as the target person's body.
[0055] It should be noted that computer equipment can also utilize Figure 2 The candidate face is determined in the manner shown. Then, the computer device can determine the person that intersects with the target face from among the people included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image, and take the determined person as the target person.
[0056] The method by which the computer device determines the person intersecting with the target face from among the persons included in the target wide-angle image based on the relative positional relationship between the candidate's face and each person in the target wide-angle image is the same as described above, and will not be repeated here in the embodiments of this application.
[0057] The second method involves the computer device determining the person located between two target faces from among the people included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image. The computer device then uses the person located between the two target faces as the target person.
[0058] In this embodiment of the application, the computer device can determine the line connecting each two target faces and determine whether the line intersects with a person. If a person intersects with the line, it means that the person is located between two target faces. In this case, the computer device can take the person as the target person.
[0059] As mentioned above, under normal circumstances, only when multiple new distortions are superimposed together can a person's body be significantly stretched. However, a person's body located between two target faces may have new distortions superimposed on the two target faces during distortion elimination. Therefore, it is more likely to be stretched after distortion correction. Considering this situation, in this embodiment of the application, a person's body located between two target faces can be used as the target person's body.
[0060] It should be noted that computer equipment can also utilize Figure 2 The candidate face is determined in the manner shown. Then, the computer device can determine the person located between two target faces from among the people included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image, and take the determined person as the target person.
[0061] The method by which the computer device determines the person located between two target faces from among the persons included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image is the same as described above, and will not be repeated here in the embodiments of this application.
[0062] It should also be noted that, in an optional embodiment of this application, the computer device may first determine candidate bodies from the bodies included in the target wide-angle image based on the relative positional relationship between the target face and each body in the target wide-angle image. For example, the computer device may take bodies that intersect with the target face and / or bodies located between two target faces as candidate bodies. Then, the computer device may take bodies among the candidate bodies whose width in the target direction is greater than a preset width threshold as the target body, wherein the target direction is determined based on the relative positional relationship between the candidate body and the target face.
[0063] Generally, if a person's width in the direction in which they might be stretched is small, even if stretched, it will not have a serious negative impact on the image presentation. Considering this, in order to save on the computational load of distortion correction processing, this embodiment of the application may not apply anti-stretching constraints to persons whose width in the direction in which they might be stretched. To achieve this, optionally, the computer device may first identify persons that might be stretched after distortion correction processing, determined based on the relative positional relationship between the target face and the persons in the target wide-angle image, as candidate persons. Then, among these candidate persons, those whose width in the target direction is greater than a preset width threshold are identified as target persons, and anti-stretching constraints are applied to these target persons. It should be noted that the target direction can be the direction of the line connecting the candidate face and the target face.
[0064] Furthermore, in an optional embodiment of this application, if the resolution of the target wide-angle image is 640 x 480, the preset width threshold mentioned above can be 50 pixels.
[0065] As mentioned above, computer equipment can determine the target face from the recognized faces based on face distortion correction conditions. These face distortion correction conditions are related to the position and size of the face in the target wide-angle image. In other words, computer equipment can determine the target face from the target wide-angle image based on the position and size of each face included in the target wide-angle image.
[0066] Please refer to Figure 3 In an optional embodiment of this application, the computer device may be based on Figure 3 The technical process shown identifies the target face in a wide-angle image of the target.
[0067] Step 301: The computer device determines the target distance between each face included in the target wide-angle image and the center point of the target wide-angle image based on the position of each face included in the target wide-angle image.
[0068] Step 302: The computer device determines the target face from the target wide-angle image based on the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image.
[0069] In practical applications, the distortion of wide-angle images is more severe closer to the edges and less severe closer to the center. At the same time, the degree of distortion of a face is related to the size of the face. Generally speaking, the larger the size of the face, the more sensitive the user is to the distortion and the greater the degree of distortion. Conversely, the smaller the size of the face, the less sensitive the user is to the distortion and the less significant the distortion.
[0070] Considering the above, in this embodiment of the application, the computer device can determine whether distortion correction of the face is required based on the target distance between the face and the center point of the target wide-angle image and the size of the face.
[0071] Optionally, in this embodiment of the application, the computer device can maintain a lookup table containing distance, size, and whether distortion correction is required. After obtaining the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image, the computer device can query the lookup table to determine whether each face included in the target wide-angle image needs distortion correction.
[0072] Please refer to Figure 4 This diagram illustrates a block diagram of an image distortion correction device 400 provided in an embodiment of this application. The image distortion correction device 400 can be configured in the computer device described above. Figure 4 As shown, the image distortion correction device 400 may include: a first determining module 401, a second determining module 402, and a correction module 403.
[0073] The first determining module 401 is used to determine the target person from the people included in the target wide-angle image based on the relative positional relationship between the target face that needs to be distorted in the target wide-angle image and each person in the target wide-angle image.
[0074] The second determining module 402 is used to determine anti-stretching constraint conditions based on the target person. The anti-stretching constraint conditions are used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction to be within a preset range.
[0075] The correction module 403 is used to perform distortion correction processing on the wide-angle image of the target based on the anti-stretching constraint condition.
[0076] In an optional embodiment of this application, the first determining module 401 is specifically used to: determine the person who intersects with the target face from among the persons included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image; and take the person who intersects with the target face as the target person.
[0077] In an optional embodiment of this application, the first determining module 401 is specifically used to: determine the person located between two target faces from among the people included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image; and take the person located between the two target faces as the target person.
[0078] In an optional embodiment of this application, the first determining module 401 is specifically used to: determine a candidate body from the bodies included in the target wide-angle image based on the relative positional relationship between the target face and each body in the target wide-angle image; and take the body whose width in the target direction is greater than a preset width threshold as the target body, wherein the target direction is determined based on the relative positional relationship between the candidate body and the target face.
[0079] In an optional embodiment of this application, the first determining module 401 is specifically used to: determine a candidate face from the target face whose corrected deformation is greater than a preset deformation threshold, wherein the corrected deformation is used to characterize the difference between the size of the target face after distortion correction processing and the size before distortion correction processing; and determine the target person from the persons included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image.
[0080] In an optional embodiment of this application, the first determining module 401 is specifically used to: sequentially perform perspective projection and spherical plane projection on the target face to obtain a projected face; and determine the correction deformation of the target face based on the size difference between the projected face and the target face.
[0081] In an optional embodiment of this application, the first determining module 401 is specifically used to: if the number of target faces included in the target wide-angle image is greater than 1, then determine the target person from the people included in the target wide-angle image according to the relative positional relationship between the target face and each person in the target wide-angle image.
[0082] In an optional embodiment of this application, the second determining module 402 is specifically used to: obtain preset scale constraint parameters and preset translation constraint parameters, wherein the scale constraint parameters are used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction, and the translation constraint parameters are used to constrain the difference between the position of the target person after distortion correction and the position before distortion correction; and construct the anti-stretch constraint function based on the scale constraint parameters and the translation constraint parameters.
[0083] Please refer to Figure 5 This application embodiment also provides another image distortion correction device 500, which, in addition to including the modules included in the image distortion correction device 400, also includes a third determining module 404.
[0084] The third determining module 404 is used to determine the target face from the target wide-angle image based on the position and size of each face included in the target wide-angle image.
[0085] In an optional embodiment of this application, the third determining module 404 is specifically used to: determine the target distance between each face included in the target wide-angle image and the center point of the target wide-angle image based on the position of each face included in the target wide-angle image; and determine the target face from the target wide-angle image based on the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image.
[0086] The image distortion correction device provided in this application embodiment can implement the above method embodiment, and its implementation principle and technical effect are similar, so it will not be described again here.
[0087] Specific limitations regarding the image distortion correction device can be found in the limitations of the image distortion correction method described above, and will not be repeated here. Each module in the aforementioned image distortion correction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the terminal's memory, so that the processor can call and execute the corresponding operations of each module.
[0088] Figure 6 This is a schematic diagram of the internal structure of a computer device in one embodiment. For example... Figure 6As shown, the computer device includes a processor and a memory connected via a system bus. The processor provides computing and control capabilities to support the operation of the entire computer device. The memory may include non-volatile storage media and internal memory. The non-volatile storage media stores an operating system and computer programs. These computer programs can be executed by the processor to implement an image distortion correction method provided in the various embodiments above. The internal memory provides a cached operating environment for the operating system and computer programs in the non-volatile storage media.
[0089] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0090] In one embodiment of this application, a computer device is provided, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0091] Based on the relative positional relationship between the target face requiring distortion correction in the target wide-angle image and each person in the target wide-angle image, the target person is identified from among the persons included in the target wide-angle image; based on the target person, an anti-stretching constraint condition is determined, which is used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction to be within a preset range; based on the anti-stretching constraint condition, distortion correction processing is performed on the target wide-angle image.
[0092] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: based on the relative positional relationship between the target face and each person in the target wide-angle image, determining the person intersecting with the target face from among the persons included in the target wide-angle image; and taking the person intersecting with the target face as the target person.
[0093] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: based on the relative positional relationship between the target face and each person in the target wide-angle image, determining the person located between two target faces from among the persons included in the target wide-angle image; and taking the person located between the two target faces as the target person.
[0094] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: determining a candidate body from the bodies included in the target wide-angle image based on the relative positional relationship between the target face and each body in the target wide-angle image; and taking the body among the candidate bodies whose width in the target direction is greater than a preset width threshold as the target body, wherein the target direction is determined based on the relative positional relationship between the candidate body and the target face.
[0095] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: determining a candidate face from the target face whose corrected deformation is greater than a preset deformation threshold, wherein the corrected deformation is used to characterize the difference between the size of the target face after distortion correction processing and the size before distortion correction processing; determining the target person from the persons included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image.
[0096] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: sequentially performing perspective projection and spherical plane projection on the target face to obtain a projected face; and determining the correction deformation of the target face based on the size difference between the projected face and the target face.
[0097] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: if the number of target faces included in the target wide-angle image is greater than 1, then the target person is determined from the people included in the target wide-angle image according to the relative positional relationship between the target face and each person in the target wide-angle image.
[0098] In one embodiment of this application, the anti-stretch constraint condition includes an anti-stretch constraint function. When the processor executes the computer program, it further implements the following steps: obtaining preset dimensional constraint parameters and preset translation constraint parameters, wherein the dimensional constraint parameters are used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction, and the translation constraint parameters are used to constrain the difference between the position of the target person after distortion correction and the position before distortion correction; and constructing the anti-stretch constraint function based on the dimensional constraint parameters and the translation constraint parameters.
[0099] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: determining the target face from the target wide-angle image based on the position and size of each face included in the target wide-angle image.
[0100] In one embodiment of this application, when the processor executes the computer program, it further implements the following steps: determining the target distance between each face included in the target wide-angle image and the center point of the target wide-angle image based on the position of each face included in the target wide-angle image; and determining the target face from the target wide-angle image based on the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image.
[0101] The computer device provided in this application embodiment has a similar implementation principle and technical effect to the above method embodiment, and will not be described again here.
[0102] In one embodiment of this application, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, it performs the following steps:
[0103] Based on the relative positional relationship between the target face requiring distortion correction in the target wide-angle image and each person in the target wide-angle image, the target person is identified from among the persons included in the target wide-angle image; based on the target person, an anti-stretching constraint condition is determined, which is used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction to be within a preset range; based on the anti-stretching constraint condition, distortion correction processing is performed on the target wide-angle image.
[0104] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: based on the relative positional relationship between the target face and each person in the target wide-angle image, determining the person intersecting with the target face from among the persons included in the target wide-angle image; and taking the person intersecting with the target face as the target person.
[0105] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: determining the person located between two target faces from among the people included in the target wide-angle image based on the relative positional relationship between the target face and each person in the target wide-angle image; and taking the person located between the two target faces as the target person.
[0106] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: determining a candidate body from the bodies included in the target wide-angle image based on the relative positional relationship between the target face and each body in the target wide-angle image; and taking the body among the candidate bodies whose width in the target direction is greater than a preset width threshold as the target body, wherein the target direction is determined based on the relative positional relationship between the candidate body and the target face.
[0107] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: determining a candidate face from the target face whose corrected deformation is greater than a preset deformation threshold, wherein the corrected deformation is used to characterize the difference between the size of the target face after distortion correction processing and the size before distortion correction processing; determining the target person from the persons included in the target wide-angle image based on the relative positional relationship between the candidate face and each person in the target wide-angle image.
[0108] In one embodiment of this application, when the computer program is executed by the processor, it further performs the following steps: sequentially performing perspective projection and spherical plane projection on the target face to obtain a projected face; and determining the correction deformation of the target face based on the size difference between the projected face and the target face.
[0109] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: if the number of target faces included in the target wide-angle image is greater than 1, then the target person is determined from the people included in the target wide-angle image according to the relative positional relationship between the target face and each person in the target wide-angle image.
[0110] In one embodiment of this application, the anti-stretch constraint condition includes an anti-stretch constraint function. When the computer program is executed by the processor, it further implements the following steps: obtaining preset dimensional constraint parameters and preset translation constraint parameters, wherein the dimensional constraint parameters are used to constrain the difference between the size of the target person after distortion correction and the size before distortion correction, and the translation constraint parameters are used to constrain the difference between the position of the target person after distortion correction and the position before distortion correction; and constructing the anti-stretch constraint function based on the dimensional constraint parameters and the translation constraint parameters.
[0111] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: determining the target face from the target wide-angle image based on the position and size of each face included in the target wide-angle image.
[0112] In one embodiment of this application, when the computer program is executed by the processor, it further implements the following steps: determining the target distance between each face included in the target wide-angle image and the center point of the target wide-angle image based on the position of each face included in the target wide-angle image; and determining the target face from the target wide-angle image based on the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image.
[0113] The computer-readable storage medium provided in this embodiment is similar in principle and technical effect to the method embodiment described above, and will not be repeated here.
[0114] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in M forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0115] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. An image distortion correction method characterized by, The method comprises: According to the relative position relationship between the target face in the target wide-angle image that needs to be corrected for distortion and each person in the target wide-angle image, a target person is determined from each person included in the target wide-angle image; including: determining a candidate face with a correction deformation greater than a preset deformation threshold from the target face; according to the relative position relationship between the candidate face and each person in the target wide-angle image, the target person is determined from each person included in the target wide-angle image; Based on the target person, a stretch prevention constraint condition is determined, and the stretch prevention constraint condition is used to constrain the difference between the size of the target person after the distortion correction processing and the size before the distortion correction processing within a preset difference range; Based on the stretch prevention constraint condition, the target wide-angle image is subjected to distortion correction processing.
2. The method of claim 1, wherein, According to the relative position relationship between the target face in the target wide-angle image that needs to be corrected for distortion and each person in the target wide-angle image, a target person is determined from each person included in the target wide-angle image, comprising: According to the relative position relationship between the target face and each person in the target wide-angle image, a person intersecting with the target face is determined from each person included in the target wide-angle image; The person intersecting with the target face is taken as the target person.
3. The method of claim 1, wherein, According to the relative position relationship between the target face in the target wide-angle image that needs to be corrected for distortion and each person in the target wide-angle image, a target person is determined from each person included in the target wide-angle image, comprising: According to the relative position relationship between the target face and each person in the target wide-angle image, a person located between two target faces is determined from each person included in the target wide-angle image; The person located between the two target faces is taken as the target person.
4. The method of claim 1, wherein, According to the relative position relationship between the target face in the target wide-angle image that needs to be corrected for distortion and each person in the target wide-angle image, a target person is determined from each person included in the target wide-angle image, comprising: According to the relative position relationship between the target face and each person in the target wide-angle image, a candidate person is determined from each person included in the target wide-angle image; The person in the candidate person whose width in a target direction is greater than a preset width threshold is taken as the target person, and the target direction is determined according to the relative position relationship between the candidate person and the target face.
5. The method of claim 1, wherein, Wherein, The correction deformation is used to represent the difference between the size of the target face after the distortion correction processing and the size before the distortion correction processing.
6. The method of claim 5, wherein, Before the candidate face with a correction deformation greater than a preset deformation threshold is determined from the target face, the method further comprises: The target face is sequentially subjected to perspective projection and spherical polar plane projection to obtain a projected face; According to the size difference between the projected face and the target face, the correction deformation of the target face is determined.
7. The method of claim 1, wherein, According to the relative position relationship between the target face in the target wide-angle image that needs to be corrected for distortion and each person in the target wide-angle image, a target person is determined from each person included in the target wide-angle image, comprising: If the target wide-angle image includes more than one target face, the target person is determined from each person in the target wide-angle image according to the relative position relationship between the target face and each person in the target wide-angle image.
8. The method of claim 1, wherein, The anti-stretching constraint condition includes an anti-stretching constraint function, and the anti-stretching constraint condition is determined based on the target person, including: obtaining a preset scale constraint parameter and a preset translation constraint parameter, wherein the scale constraint parameter is used to constrain the difference between the size of the target person after the distortion correction processing and the size of the target person before the distortion correction processing, and the translation constraint parameter is used to constrain the difference between the position of the target person after the distortion correction processing and the position of the target person before the distortion correction processing; The anti-stretching constraint function is constructed according to the scale constraint parameter and the translation constraint parameter.
9. The method of claim 1, wherein, Before the target person is determined from each person in the target wide-angle image according to the relative position relationship between the target face needing distortion correction in the target wide-angle image and each person in the target wide-angle image, the method further includes: The target face is determined from the target wide-angle image according to the position and size of each face included in the target wide-angle image.
10. The method of claim 9, wherein, The target face is determined from the target wide-angle image according to the position and size of each face included in the target wide-angle image, including: The target distance between each face included in the target wide-angle image and the center point of the target wide-angle image is determined according to the position of each face included in the target wide-angle image; The target face is determined from the target wide-angle image according to the target distance corresponding to each face included in the target wide-angle image and the size of each face included in the target wide-angle image.
11. An image distortion correction apparatus characterized by comprising: The device includes: The first determination module is configured to determine the target person from each person in the target wide-angle image according to the relative position relationship between the target face needing distortion correction in the target wide-angle image and each person in the target wide-angle image, and specifically configured to determine a candidate face with a correction deformation greater than a preset deformation threshold from the target face, and determine the target person from each person in the target wide-angle image according to the relative position relationship between the candidate face and each person in the target wide-angle image; The second determination module is configured to determine an anti-stretching constraint condition based on the target person, and the anti-stretching constraint condition is used to constrain the difference between the size of the target person after the distortion correction processing and the size of the target person before the distortion correction processing within a preset difference range; The correction module is configured to perform distortion correction processing on the target wide-angle image based on the anti-stretching constraint condition.
12. A computer device, comprising: The device includes a memory and a processor, and the memory stores a computer program, and the computer program is executed by the processor to implement the image distortion correction method of any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer program is stored on the device and executed by the processor to implement the image distortion correction method of any one of claims 1-10.
Citation Information
Patent Citations
Image processing method and device, terminal equipment and storage medium
CN111105366A
Image distortion correction method and device, electronic equipment and storage medium
CN112258418A
Image distortion correction method and device
CN112529784A