Image processing method and device, electronic device, and readable storage medium

By combining spherical projection transformation and cylindrical projection transformation, the problem of image distortion during shooting of wide-angle cameras is solved, and the global dedistortion of the avatar and body area is achieved, and the integrity of the field of view is maintained.

CN115147286BActive Publication Date: 2024-12-20GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110339892.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2024-12-20
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

Traditional image processing methods cannot effectively eliminate image distortion during wide-angle camera shooting, especially for portraits and background areas at the edge of the image, and often lose field angle.

Method used

Using a combination of spherical projection transformation and cylindrical projection transformation, the original image is subjected to the first projection transformation and the second projection transformation, and the avatar area and the body area are processed respectively. The distortion of the avatar area and the cylindrical projection transformation are eliminated through spherical projection transformation and the body is eliminated. Distortion of the region enables global dedistortion of the image.

Benefits of technology

It realizes effective dedistortion of both the avatar area and the body area in the image, with good fusion effect, realistic and natural, and no loss of field of view angle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115147286B_ABST
    Figure CN115147286B_ABST
Patent Text Reader

Abstract

The present application relates to an image processing method and device, an electronic device, and a computer-readable storage medium, wherein a first projection transformation is performed on an original image to obtain an intermediate image; the original image includes a head area to be dedistorted and a body area to be dedistorted; a second projection transformation is performed on the intermediate image to obtain a target image after dedistortion; wherein the target image includes a head area after spherical projection transformation and a body area after cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. It is known that the head area in the original image can be dedistorted by a preset spherical projection transformation, and the body area in the original image can be dedistorted by a preset cylindrical projection transformation. Therefore, by using the image processing method in the present application, distortion can be removed from both the head area and the body area at the same time, and the fusion effect is good and realistic and natural.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] As the camera function of electronic devices becomes more and more powerful, multiple cameras are configured on electronic devices for users to take photos. Generally, in addition to the standard camera, electronic devices are also equipped with a telephoto camera or a wide-angle camera. Among them, the focal length of the wide-angle lens used in the wide-angle camera is shorter than that of the standard lens, but the field of view is larger than that of the standard lens. Therefore, using a wide-angle camera for shooting can obtain an image with a larger field of view, but the image will be severely distorted.

[0003] In order to compensate for the serious distortion of the image, it is necessary to perform distortion correction on the image. However, the traditional distortion correction method cannot eliminate the distortion well. Summary of the invention

[0004] The embodiments of the present application provide an image processing method and device, an electronic device, and a readable storage medium, which can effectively remove distortion in an image.

[0005] An image processing method, characterized in that the method comprises:

[0006] Performing a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image region to be dedistorted and a body region to be dedistorted;

[0007] A second projection transformation is performed on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image area after a spherical projection transformation and a body area after a cylindrical projection transformation; and the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

[0008] An image processing device, comprising:

[0009] A first projection transformation module, used to perform a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image area to be dedistorted and a body area to be dedistorted;

[0010] The second projection transformation module is used to perform a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image area after a spherical projection transformation and a body area after a cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

[0011] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the Bluetooth communication method as described above.

[0012] A computer-readable storage medium stores a computer program, which implements the steps of the Bluetooth communication method described above when executed by a processor.

[0013] The above-mentioned image processing method and device, electronic device, and computer-readable storage medium perform a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image area to be dedistorted and a body area to be dedistorted; the intermediate image performs a second projection transformation to obtain a dedistorted target image; wherein the target image includes a head image area after spherical projection transformation and a body area after cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. It is known that the head image area in the original image can be dedistorted by a preset spherical projection transformation, and the body area in the original image can be dedistorted by a preset cylindrical projection transformation, and the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. Therefore, after the original image is subjected to the first projection transformation and the second projection transformation, the head image area in the dedistorted target image obtained is equivalent to the head image area obtained by the spherical projection transformation of the original image. After the original image is subjected to the first projection transformation and the second projection transformation, the body area in the dedistorted target image obtained is equivalent to the body area obtained by the cylindrical projection transformation of the original image. Therefore, by using the image processing method in the present application, it is possible to simultaneously remove distortion from both the head area and the body area, and the fusion effect is good and realistic and natural. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0015] Figure 1 A diagram showing an application environment of an image processing method in an embodiment;

[0016] Figure 2 is a flowchart of an image processing method in one embodiment;

[0017] Figure 3 for Figure 2 A flowchart of a method for performing a first projection transformation on an original image to obtain an intermediate image;

[0018] Figure 4 for Figure 3 A schematic diagram of a method for obtaining a second intermediate image is shown in which the coordinates of the head image region to be dedistorted in the original image are replaced with the coordinates of the head image region after the first projection transformation;

[0019] Figure 5 is a schematic diagram of an image processing method in one embodiment;

[0020] Figure 6 is a flowchart of an image processing method in yet another embodiment;

[0021] Figure 7 is a flowchart of an image processing method in a specific embodiment;

[0022] Figure 8 is a structural block diagram of an image processing device in one embodiment;

[0023] Fig. 9 for Figure 8 The structural block diagram of the first projection transformation module;

[0024] Fig.10 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0026] As the camera function of electronic devices becomes more and more powerful, multiple cameras are configured on electronic devices for users to take photos. Generally, in addition to the standard camera, electronic devices are also configured with a telephoto camera or a wide-angle camera. Using a wide-angle camera to shoot can obtain an image with a larger field of view, but the edge of the image will be severely distorted, especially for the portrait at the edge of the image, the distortion is more obvious.

[0027] Among them, a traditional image processing method can eliminate the distortion of the portrait by using spherical projection transformation on the image, but it cannot eliminate the distortion of the background area very well, so that the straight lines in the background area appear obviously curved and part of the field of view angle is lost.

[0028] Another traditional image processing method uses cylindrical projection transformation to eliminate the distortion of the portrait on the horizontal axis, but the portrait still has distortion in other directions. And the vertical straight lines in the background area will be obviously bent. Similarly, part of the field of view will also be lost.

[0029] Figure 1 FIG. 1 is an application scenario diagram of an image processing method in an embodiment. Figure 1 As shown, the application environment includes an electronic device 120, which performs a first projection transformation on the original image to obtain an intermediate image; the original image includes a head area to be dedistorted and a body area to be dedistorted; the intermediate image is subjected to a second projection transformation to obtain a target image after dedistortion; wherein the target image includes a head area after spherical projection transformation and a body area after cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. Here, the electronic device 120 can be any terminal device with a camera function, such as a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a wearable device (smart bracelet, smart watch, smart glasses), a smart home, etc.

[0030] Figure 2 FIG. 1 is a flowchart of an image processing method in an embodiment. The image processing method in this embodiment is executed on Figure 1 The electronic device 120 in the embodiment is used as an example for description. The image processing method includes:

[0031] Step 220, performing a first projection transformation on the original image to obtain an intermediate image; the original image includes a head area to be dedistorted and a body area to be dedistorted.

[0032] Among them, the original image is an image taken by a wide-angle camera. Due to the large field of view of the wide-angle camera, the edge of the image will be distorted, especially for the portrait at the edge of the image, the distortion is more obvious. Therefore, it is necessary to perform de-distortion processing on the portrait area on the original image. The portrait area in the original image includes the head area to be de-distorted and the body area to be de-distorted. Among them, the head area includes the head area and the neck area; the body area includes the areas corresponding to the limbs and the torso. Of course, this is just one way to divide the portrait area into the head area and the neck area. In other embodiments, the portrait area can also be divided into the head area and the body area according to other division methods, and this application does not limit this.

[0033] In order to remove the distortion of the portrait area at the edge of the original image, first, the original image is subjected to a first projection transformation to obtain an intermediate image. The projection transformation is mainly used to perform a projection transformation on the coordinates of the pixel points in the original image to generate new coordinates. The distortion in the original image can be eliminated by the projection transformation. The original image is subjected to a first projection transformation to obtain an intermediate image. On the intermediate image, the head portrait area to be dedistorted in the original image can be preliminarily dedistorted to obtain a head portrait area with preliminarily dedistorted. The preliminarily dedistorted head portrait area here means that for the preliminarily dedistorted head portrait area, a second projection transformation is required to eliminate the distortion of the head portrait area to be dedistorted. In other words, the preliminarily dedistorted head portrait area is a sub-step in the distortion elimination process.

[0034] Step 240, performing a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes the head image area after the spherical projection transformation and the body area after the cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

[0035] The intermediate image includes a head image region that has been preliminarily dedistorted. The first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation, so the second projection transformation is performed on the intermediate image, that is, the second projection transformation is performed again on the head image region that has been preliminarily dedistorted in the intermediate image. At this time, the target image obtained can achieve the elimination of distortion in the head image region. Because the head image region in the target image is equivalent to the head image obtained by sequentially performing the first projection transformation and the second projection transformation on the head image region to be dedistorted in the original image, and the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation, performing the first projection transformation and the second projection transformation in sequence is equivalent to performing the spherical projection transformation. It is known that the head image region in the original image can be dedistorted by the spherical projection transformation, so the target image can achieve the elimination of distortion in the head image region.

[0036] For the body region to be dedistorted in the original image, the distortion can be eliminated in the first projection transformation or the second projection transformation to obtain the body region after the cylindrical projection transformation. It is known that the body region in the original image can be dedistorted by the cylindrical projection transformation, so the target image can achieve the dedistortion of the body region.

[0037] At this point, in the target image, not only the head area can be dedistorted, but also the body area can be dedistorted at the same time.

[0038] In the embodiment of the present application, it is known that the head image region in the original image can be dedistorted by a preset spherical projection transformation, and the body region in the original image can be dedistorted by a preset cylindrical projection transformation, and the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. Therefore, after the original image is subjected to the first projection transformation and the second projection transformation, the head image region in the dedistorted target image obtained is equivalent to the head image region obtained by the spherical projection transformation of the original image. After the original image is subjected to the first projection transformation and the second projection transformation, the body region in the dedistorted target image obtained is equivalent to the body region obtained by the cylindrical projection transformation of the original image. Therefore, by adopting the image processing method in the present application, it is possible to simultaneously achieve dedistortion of both the head image region and the body region in the original image on the intermediate image, and the fusion effect is good and realistic and natural.

[0039] In one embodiment, the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation.

[0040] Specifically, assume that f(x,y)=g(x,y)*h(x,y), where f(x,y) represents the function of spherical projection transformation, g(x,y) represents the function of the first projection transformation, and h(x,y) represents the function of the second projection transformation. Therefore, it can be seen that the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation.

[0041] It can be seen from the above embodiments that performing the first projection transformation and the second projection transformation on the head image area to be dedistorted in the original image is equivalent to performing a spherical projection transformation. When performing the projection transformation, the function corresponding to the projection transformation is used to realize the projection transformation of the coordinates of the pixel points in the image to generate new coordinates. That is, performing the first projection transformation using the function of the first projection transformation and performing the second projection transformation using the function of the second projection transformation on the head image area to be dedistorted in the original image is equivalent to performing a spherical projection transformation using the function of the spherical projection transformation. Therefore, it can be concluded that the product of the function of the first projection transformation and the function of the second projection transformation is equal to the function of the spherical projection transformation. That is, the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation.

[0042] In the embodiment of the present application, because the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation, the image region after the distortion is obtained by performing the first projection transformation and the second projection transformation on the head region to be distorted in the original image can have an image difference less than a preset difference threshold value with the image region after the distortion is obtained by performing the spherical projection transformation. That is, the distortion effect of the head region after the distortion is obtained by performing the first projection transformation and the second projection transformation on the head region to be distorted in the original image is consistent with that of the head region after the distortion is obtained by performing the spherical projection transformation. The spherical projection transformation required for distorting the head region is divided into two steps, the first projection transformation and the second projection transformation, and they are performed separately. For example, the first projection transformation or the second projection transformation is a cylindrical projection transformation, so that the body region can be distorted in the first projection transformation or the second projection transformation. Thus, the distortion of the head region and the body region in the original image is removed at the same time, and the fusion effect is good and realistic and natural.

[0043] Continuing from the previous embodiment, an image processing method is provided, including: performing a first projection transformation on an original image to obtain an intermediate image; the original image includes a head image region to be dedistorted and a body region to be dedistorted; performing a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image region after a spherical projection transformation and a body region after a cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. wherein the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation, and the second projection transformation is a cylindrical projection transformation.

[0044] Specifically, if the second projection transformation is a cylindrical projection transformation, the first projection transformation can be considered as a special projection transformation. In step 220, the original image is subjected to the first projection transformation to obtain an intermediate image. That is, the original image is subjected to a special projection transformation (first projection transformation) to obtain an intermediate image, which includes a head image area with preliminary distortion elimination and a body area to be eliminated, that is, the body area in the intermediate image is still the body area to be eliminated in the original image. Then, in step 240, the intermediate image is subjected to a second projection transformation to obtain a target image after elimination. That is, the second projection transformation is performed on both the head image area with preliminary distortion elimination and the body area to be eliminated in the intermediate image. Because the second projection transformation is a cylindrical projection transformation at this time, the body area to be eliminated in the intermediate image can be subjected to a cylindrical projection transformation, so that the distortion of the body area can be eliminated directly. Because the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation, performing the second projection transformation (cylindrical projection transformation) on the head image area in the intermediate image where the distortion is initially eliminated is equivalent to performing a spherical projection transformation on the head image area to be dedistorted in the original image, which can eliminate the distortion of the head image area.

[0045] In an embodiment of the present application, if the second projection transformation is a cylindrical projection transformation, the first projection transformation is performed on the original image to obtain an intermediate image, which includes the head area from which the distortion is initially eliminated and the body area to be dedistorted. Then, the head area from which the distortion is initially eliminated and the body area to be dedistorted in the intermediate image are both subjected to a cylindrical projection transformation, and the distortion of the body area can be directly eliminated. At the same time, performing a cylindrical projection transformation on the head area from which the distortion is initially eliminated in the intermediate image is equivalent to performing a spherical projection transformation on the head area to be dedistorted in the original image, and thus the distortion of the head area can also be eliminated. Therefore, the distortion of the head area and the body area in the original image can be eliminated simultaneously on the intermediate image. While ensuring the distortion elimination effect, complex operations such as image fusion are omitted.

[0046] Continuing from the previous embodiment, if the second projection transformation is a cylindrical projection transformation, step 240, performing a second projection transformation on the intermediate image to obtain a dedistorted target image, includes:

[0047] The intermediate image is subjected to cylindrical projection transformation using a cylindrical projection transformation function to obtain a dedistorted target image.

[0048] In the embodiment of the present application, when performing the projection transformation, the function corresponding to the projection transformation is used to realize the projection transformation of the coordinates of the pixel points in the image to generate new coordinates. Therefore, the cylindrical projection transformation corresponds to the function of the cylindrical projection transformation. When the intermediate image is subjected to the second projection transformation to obtain the dedistorted target image, the intermediate image is subjected to the cylindrical projection transformation using the function of the cylindrical projection transformation to obtain the dedistorted target image.

[0049] In one embodiment, performing a second projection transformation on the intermediate image to obtain a dedistorted target image includes:

[0050] The intermediate image is subjected to cylindrical projection transformation in the horizontal direction by using a cylindrical projection transformation function to obtain a dedistorted target image;

[0051] and / or,

[0052] The intermediate image is subjected to cylindrical projection transformation in the longitudinal direction using a cylindrical projection transformation function to obtain a dedistorted target image.

[0053] Specifically, when the intermediate image is subjected to cylindrical projection transformation using the cylindrical projection transformation function to obtain the dedistorted target image, the intermediate image can be subjected to cylindrical projection transformation using the cylindrical projection transformation function in the horizontal axis direction to obtain the dedistorted target image, that is, the X-axis coordinates of the pixels in the intermediate image are subjected to cylindrical projection transformation, while the Y-axis coordinates remain unchanged. The cylindrical projection transformation function in the horizontal axis direction (X direction) is:

[0054] x1=r0(tan(0.5*atan(x / f)));

[0055] Wherein, r0=d / (2*tan(0.5*atan(d / f)));

[0056] Where d is the length of the short side of the image, r0 is the scaling factor, x is the horizontal coordinate of the pixel on the image, x1 is the new x coordinate generated after the image is transformed by cylindrical projection, and f is the correction strength coefficient. r0 can make the length of the short side of the image consistent before and after the cylindrical projection transformation. f can be set according to the lens parameters, or it can be fine-tuned according to the user's de-distortion effect.

[0057] Of course, when the intermediate image is subjected to cylindrical projection transformation using the cylindrical projection transformation function to obtain the target image after dedistortion, the intermediate image can also be subjected to cylindrical projection transformation using the cylindrical projection transformation function in the longitudinal direction to obtain the target image after dedistortion, that is, the Y-axis coordinates of the pixels in the intermediate image are subjected to cylindrical projection transformation, while the X-axis coordinates remain unchanged. Among them, the cylindrical projection transformation function in the longitudinal direction (Y direction) is:

[0058] y1=r0(tan(0.5*atan(y / f)));

[0059] Wherein, r0=d / (2*tan(0.5*atan(d / f))).

[0060] Where d is the length of the short side of the image, r0 is the scaling factor, x is the horizontal coordinate of the pixel on the image, y1 is the new y coordinate generated after the image is transformed by cylindrical projection, and f is the correction strength coefficient. r0 can make the length of the short side of the image consistent before and after the cylindrical projection transformation. f can be set according to the lens parameters, or it can be fine-tuned according to the user's de-distortion effect.

[0061] Of course, when the intermediate image is subjected to a cylindrical projection transformation using a cylindrical projection transformation function to obtain a target image after de-distortion, the intermediate image can also be subjected to a cylindrical projection transformation using a cylindrical projection transformation function in the horizontal axis direction and a cylindrical projection transformation using a cylindrical projection transformation function in the vertical axis direction to obtain a target image after de-distortion.

[0062] In the embodiment of the present application, when the intermediate image is subjected to cylindrical projection transformation using a cylindrical projection transformation function to obtain a target image after dedistortion, the cylindrical projection transformation can be performed from the horizontal axis direction to remove the distortion in the horizontal axis direction. The cylindrical projection transformation can also be performed from the vertical axis direction to remove the distortion in the vertical axis direction. The cylindrical projection transformation can also be performed from the horizontal axis direction and the vertical axis direction to remove the distortion in the horizontal axis direction and the vertical axis direction. Thus, different dedistortion effects can be achieved by performing cylindrical projection transformation on the intermediate image from different directions.

[0063] In one embodiment, Figure 3 As shown, step 220, performing a first projection transformation on the original image to obtain an intermediate image, includes:

[0064] Step 222, performing a first projection transformation on all regions in the original image to obtain a first intermediate image after the first projection transformation; wherein the first intermediate image includes the head image region after the first projection transformation and the body region after the first projection transformation.

[0065] Specifically, when performing a first projection transformation on the original image to obtain an intermediate image, it includes performing a first projection transformation on all regions in the original image to obtain a first intermediate image after the first projection transformation. All regions in the original image include a head region to be dedistorted, a body region to be dedistorted, and a background region. Of course, the original image may also include other regions, and the present application is not exhaustive. Specifically, performing a first projection transformation on the head region to be dedistorted, the body region to be dedistorted, and the background region in the original image to obtain a first intermediate image after the first projection transformation. That is, the first intermediate image includes the head region after the first projection transformation and the body region after the first projection transformation.

[0066] Step 224 , replacing the coordinates of the head image region to be dedistorted in the original image with the coordinates of the head image region after the first projection transformation, to obtain a second intermediate image.

[0067] After performing the first projection transformation on all regions in the original image to obtain the first intermediate image after the first projection transformation, the coordinates of the head image region to be dedistorted in the original image are replaced with the coordinates of the head image region after the first projection transformation to obtain the second intermediate image. In this way, in step 240, when performing the second projection transformation on the second intermediate image to obtain the dedistorted target image, because the second intermediate image is obtained based on the original image, its image size is consistent with the original image, and the field of view angle will not be lost due to the first projection transformation. And the second intermediate image includes the head image region after the first projection transformation and the body region to be dedistorted, so by performing the second projection transformation (such as cylindrical projection transformation) on the second intermediate image, the distortion of the head image region and the body region can be eliminated at the same time. And the cylindrical projection transformation of the image will not lose the field of view angle.

[0068] In an embodiment of the present application, when performing a first projection transformation on an original image to obtain an intermediate image, a first intermediate image after the first projection transformation is obtained by performing a first projection transformation on all regions in the original image. Because the first intermediate image includes the head image region after the first projection transformation, the coordinates of the head image region to be dedistorted in the original image can be replaced with the coordinates of the head image region after the first projection transformation to obtain a second intermediate image. Thus, the second intermediate image includes the head image region after the first projection transformation and the body region to be dedistorted. Therefore, by subsequently performing a second projection transformation (such as a cylindrical projection transformation) on the second intermediate image, distortion elimination of the head image region and the body region can be achieved on the intermediate image at the same time, thereby avoiding excessive distortion elimination of the head image region.

[0069] In one embodiment, Figure 4 As shown, step 224, replacing the coordinates of the head image region to be dedistorted in the original image with the coordinates of the head image region after the first projection transformation, to obtain a second intermediate image, includes:

[0070] Step 224a, gridding the original image to obtain a grid map, and obtaining a grid map of the first intermediate image according to the grid map of the original image, wherein the grid map includes grid points.

[0071] Combination Figure 5 FIG. 1 is a schematic diagram of an image processing method in an embodiment. The original image is taken by a wide-angle camera. Figure 5 (a) is a grid map of the original image. Specifically, the original image is evenly divided into grids to obtain a grid map. Assuming that the pixel resolution of the original image is 3000*4000, the original image is evenly divided into 31*41 grid points to obtain a grid map, and the size of each grid in the grid map is 10*10.

[0072] Figure 5 (b) is a grid map of the first intermediate image, which is obtained based on the grid map of the original image. Specifically, it can be obtained by performing a first projection transformation on the grid map of the original image. Figure 5 In the figure corresponding to (b), it can be seen that the grids in the grid map of the first intermediate image are not evenly distributed.

[0073] Step 224b, updating the coordinates of the grid points of the head image region to be dedistorted in the original image to the coordinates of the grid points of the head image region after the first projection transformation, to obtain an updated grid map of the original image.

[0074] Specifically, an image recognition algorithm is used to segment the original image to obtain the head image area to be dedistorted. The coordinates of the original grid points corresponding to the head image area to be dedistorted are obtained from the grid map of the original image, and then the coordinates of the grid points of the head image area after the first projection transformation are obtained from the grid map of the first intermediate image. The coordinates of the original grid points corresponding to the head image area to be dedistorted are updated to the coordinates of the grid points of the head image area after the first projection transformation, and the updated grid map of the original image is obtained. That is, Figure 5 As shown in (c). Figure 5 As shown in (d), Figure 5 The grid graph obtained after optimizing the updated grid graph shown in (c).

[0075] Step 224c, performing interpolation operation according to the pixel points corresponding to the updated grid image to obtain a second intermediate image.

[0076] Among them, the grid points of the avatar area after the first projection transformation in the updated grid map may not have corresponding pixel points in the original image. Therefore, it is necessary to perform interpolation calculation based on the pixel points in the original image and the updated grid points to generate pixel points corresponding to the grid points of the avatar area after the first projection transformation. Finally, a second intermediate image is generated based on the pixel points and pixel values ​​corresponding to the updated grid map. Among them, the interpolation calculation method includes any one of the nearest neighbor interpolation method, the bilinear interpolation method, and the cubic polynomial interpolation method. This application does not limit this.

[0077] Before step 224c, the method further includes optimizing the updated grid to obtain an optimized grid. Specifically, optimizing the updated grid to obtain an optimized grid includes at least one of the following methods: smoothing the updated grid to obtain an optimized grid; or controlling the lines of the same object area in the updated grid to remain continuous to obtain an optimized grid; or controlling the difference in the stretching parameters of the background area in the horizontal and vertical directions in the updated grid to be less than a second preset difference threshold; or controlling the grid points in the edge area of ​​the updated grid to remain in a straight line. This application does not limit this.

[0078] In the embodiment of the present application, for the original image and the first intermediate image, the coordinates of the head area to be dedistorted of the original image are replaced with the coordinates of the head area after the first projection transformation by using a grid diagram, thereby obtaining a second intermediate image. The replacement is carried out by using a grid diagram, which is highly accurate and easy to operate. Thus, the second intermediate image includes the head area after the first projection transformation and the body area to be dedistorted. Therefore, by subsequently performing a second projection transformation (such as a cylindrical projection transformation) on the second intermediate image, distortion elimination of the head area and the body area can be achieved at the same time, avoiding excessive distortion elimination of the head area.

[0079] In one embodiment, performing a first projection transformation on the original image to obtain an intermediate image includes:

[0080] A first projection transformation is performed on the head image region to be dedistorted in the original image to obtain a third intermediate image after the first projection transformation; the third intermediate image includes the head image region after the first projection transformation.

[0081] It can be understood that the third intermediate image is the intermediate image obtained by performing the first projection transformation on the head portrait area to be dedistorted in the original image, the second intermediate image and the third intermediate image correspond to different image processing methods for obtaining intermediate images, and the second intermediate image and the third intermediate image are both used for performing the second projection transformation.

[0082] Specifically, when the first projection transformation is performed on the original image to obtain the intermediate image, the first projection transformation is performed on the head image region to be dedistorted in the original image to obtain the third intermediate image after the first projection transformation. Specifically, the image recognition algorithm is used to perform image segmentation on the original image to obtain the head image region to be dedistorted. Then, the first projection transformation is performed on the head image region to be dedistorted in the original image, and the first projection transformation is not performed on the body region and the background region to be dedistorted in the original image to obtain the third intermediate image after the first projection transformation. That is, the third intermediate image includes only the head image region after the first projection transformation.

[0083] In this case, the first projection transformation is performed on the head image region to be dedistorted in the original image, and the first projection transformation is not performed on the body region and the background region to be dedistorted in the original image, so as to obtain the third intermediate image after the first projection transformation. That is, the third intermediate image includes the head image region after the first projection transformation and the body region to be dedistorted that has not been subjected to any projection transformation processing. Therefore, in step 240, when the second projection transformation is performed on the intermediate image to obtain the dedistorted target image, the second projection transformation can also be performed directly on the third intermediate image, without replacing the coordinates of the head image region to be dedistorted in the original image with the coordinates of the head image region after the first projection transformation. Therefore, by performing the second projection transformation (for example, cylindrical projection transformation) on the third intermediate image, distortion elimination of the head image region and the body region can be achieved at the same time. And performing cylindrical projection transformation on the image will not lose the field of view angle.

[0084] In an embodiment of the present application, when the first projection transformation is performed on the original image to obtain the intermediate image, the first projection transformation is performed on the head image area to be dedistorted in the original image to obtain the third intermediate image after the first projection transformation. Because the third intermediate image only includes the head image area after the first projection transformation, the second projection transformation (for example, cylindrical projection transformation) can be directly performed on the entire third intermediate image later. Thus, the distortion of the head image area and the body area can be eliminated at the same time on the third intermediate image. And because the third intermediate image includes the head image area after the first projection transformation and the body area that has not been subjected to any projection transformation processing, the body area will not be excessively distorted if the entire third intermediate image is subjected to projection transformation.

[0085] In one embodiment, an image processing method is provided, comprising: performing a first projection transformation on an original image to obtain an intermediate image; the original image includes a head image region to be dedistorted and a body region to be dedistorted; performing a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image region after spherical projection transformation and a body region after cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation. wherein the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation, and the first projection transformation is a cylindrical projection transformation.

[0086] Specifically, if the first projection transformation is a cylindrical projection transformation, in step 220, the original image is subjected to a first projection transformation to obtain an intermediate image. That is, the original image is subjected to a cylindrical projection transformation to obtain an intermediate image, and the intermediate image includes a head image region that has been preliminarily dedistorted and a body region that has been dedistorted, that is, the body region in the intermediate image has been dedistorted. Then, in step 240, the intermediate image is subjected to a second projection transformation to obtain a dedistorted target image. That is, the head image region that has been preliminarily dedistorted in the intermediate image is subjected to a second projection transformation, and since the body region in the intermediate image has been dedistorted, it is not necessary to perform a projection transformation on the body region. Since the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation, performing a second projection transformation on the head image region that has been preliminarily dedistorted in the intermediate image is equivalent to performing a spherical projection transformation on the head image region to be dedistorted in the original image, and the distortion of the head image region can be eliminated.

[0087] In the embodiment of the present application, if the first projection transformation is a cylindrical projection transformation, the first projection transformation is performed on the original image to obtain an intermediate image, and the intermediate image includes the head image area with preliminary distortion elimination and the body area after distortion elimination. Then, the head image area with preliminary distortion elimination in the intermediate image is subjected to a second projection transformation, and the distortion of the head image area can be eliminated directly. Therefore, the distortion elimination of the head image area and the body area in the original image can be achieved simultaneously on the intermediate image. While ensuring the distortion elimination effect, complex operations such as image fusion are omitted.

[0088] In one embodiment, performing a first projection transformation on the original image to obtain an intermediate image includes:

[0089] The original image is transformed into an intermediate image by using a cylindrical projection transformation function.

[0090] In the embodiment of the present application, when performing the projection transformation, the function corresponding to the projection transformation is used to realize the projection transformation of the coordinates of the pixel points in the image to generate new coordinates. Therefore, the cylindrical projection transformation corresponds to the function of the cylindrical projection transformation. When the first projection transformation is performed on the original image to obtain the intermediate image, the cylindrical projection transformation is performed on the original image using the function of the cylindrical projection transformation to obtain the intermediate image.

[0091] In one embodiment, performing a first projection transformation on the original image to obtain an intermediate image includes:

[0092] Perform cylindrical projection transformation on the original image in the horizontal direction using a cylindrical projection transformation function to obtain an intermediate image;

[0093] and / or,

[0094] The original image is subjected to cylindrical projection transformation in the longitudinal direction using a cylindrical projection transformation function to obtain an intermediate image.

[0095] Specifically, when the original image is subjected to cylindrical projection transformation using the cylindrical projection transformation function to obtain the intermediate image, the original image can be subjected to cylindrical projection transformation using the cylindrical projection transformation function in the horizontal axis direction to obtain the intermediate image, that is, the X-axis coordinates of the pixels in the original image are subjected to cylindrical projection transformation, while the Y-axis coordinates remain unchanged. Among them, the cylindrical projection transformation function in the horizontal axis direction (X direction) is:

[0096] x1=r0(tan(0.5*atan(x / f)));

[0097] Wherein, r0=d / (2*tan(0.5*atan(d / f)));

[0098] Where d is the length of the short side of the image, r0 is the scaling factor, x is the horizontal coordinate of the pixel on the image, x1 is the new X coordinate generated after the image is transformed by cylindrical projection, and f is the correction strength coefficient. r0 can make the length of the short side of the image consistent before and after the cylindrical projection transformation. f can be set according to the lens parameters, or it can be fine-tuned according to the user's de-distortion effect.

[0099] Of course, when the original image is subjected to cylindrical projection transformation using the cylindrical projection transformation function to obtain the intermediate image, the original image can also be subjected to cylindrical projection transformation using the cylindrical projection transformation function in the longitudinal direction to obtain the intermediate image, that is, the Y-axis coordinates of the pixels in the original image are subjected to cylindrical projection transformation, while the X-axis coordinates remain unchanged. Among them, the cylindrical projection transformation function in the longitudinal direction (Y direction) is:

[0100] y1=r0(tan(0.5*atan(y / f)));

[0101] Wherein, r0=d / (2*tan(0.5*atan(d / f))).

[0102] Of course, when the original image is subjected to a cylindrical projection transformation using a cylindrical projection transformation function to obtain an intermediate image, the original image can also be subjected to a cylindrical projection transformation using a cylindrical projection transformation function in the horizontal axis direction and in the vertical axis direction to obtain an intermediate image.

[0103] In the embodiment of the present application, when the original image is subjected to cylindrical projection transformation using the function of cylindrical projection transformation to obtain the intermediate image, the cylindrical projection transformation can be performed from the horizontal axis direction to remove the distortion in the horizontal axis direction. The cylindrical projection transformation can also be performed from the vertical axis direction to remove the distortion in the vertical axis direction. The cylindrical projection transformation can also be performed from the horizontal axis direction and the vertical axis direction to remove the distortion in the horizontal axis direction and the vertical axis direction. Thus, by performing cylindrical projection transformation on the original image from different directions, different de-distortion effects can be achieved.

[0104] In one embodiment, if the first projection transformation is a cylindrical projection transformation, and the function of the second projection transformation is the quotient of the function of the spherical projection transformation and the function of the first projection transformation; performing the second projection transformation on the intermediate image to obtain a dedistorted target image includes:

[0105] Performing a second projection transformation on all regions in the intermediate image to obtain a reference image; wherein the reference image includes the head image region after the second projection transformation and the body region after the second projection transformation;

[0106] The head image region after the first projection transformation in the intermediate image is replaced by the head image region after the second projection transformation in the reference image to obtain a dedistorted target image.

[0107] Specifically, Figure 6 As shown, an image processing method is provided, comprising:

[0108] Step 620, performing cylindrical projection transformation on the original image to obtain an intermediate image;

[0109] Step 640, performing a second projection transformation on all regions in the intermediate image to obtain a reference image;

[0110] Step 660, replace the head image region after the first projection transformation in the intermediate image with the head image region after the second projection transformation in the reference image to obtain a dedistorted target image.

[0111] In the above two cases, when the cylindrical projection transformation is performed on the original image, the first projection transformation can be performed on all areas in the original image to obtain an intermediate image after the first projection transformation. Because the first projection transformation is a cylindrical projection transformation, the size of the intermediate image is consistent with the size of the original image. Therefore, the second projection transformation is subsequently performed on all areas in the intermediate image to obtain a reference image, and then the head image area in the intermediate image is replaced with the head image area after the second projection transformation in the reference image to obtain a dedistorted target image. In this way, by replacing the head image area on the basis of the intermediate image, the dedistorted target image obtained can simultaneously eliminate the distortion of the head image area and the body area without losing the field of view.

[0112] In an embodiment of the present application, if the first projection transformation is a cylindrical projection transformation, a cylindrical projection transformation is performed on the original image to obtain an intermediate image after the cylindrical projection transformation. It can be seen that the body area in the intermediate image has eliminated distortion. Then a second projection transformation is performed on all areas in the intermediate image to obtain a reference image, and the head image area after the second projection transformation in the reference image is the head image area with the distortion eliminated. Therefore, the head image area after the first projection transformation in the intermediate image is replaced with the head image area after the second projection transformation in the reference image to obtain a dedistorted target image, and both the head image area and the body area in the target image have eliminated distortion. In this way, a replacement head image area is generated based on the intermediate image, and the obtained dedistorted target image can simultaneously eliminate distortion of the head image area and the body area without losing the field of view.

[0113] In one embodiment, replacing the head image region after the first projection transformation in the intermediate image with the head image region after the second projection transformation in the reference image to obtain a dedistorted target image includes:

[0114] The intermediate image is divided into grids to obtain a grid map, and a grid map of the reference image is obtained according to the grid map of the intermediate image; the grid map includes grid points;

[0115] The coordinates of the grid points in the avatar region after the first projection transformation in the intermediate image are updated to the coordinates of the grid points in the avatar region after the second projection transformation, so as to obtain an updated grid map of the intermediate image;

[0116] Interpolation operation is performed according to the pixel points corresponding to the updated grid map to obtain the dedistorted target image.

[0117] In an embodiment of the present application, for the intermediate image and the reference image, the coordinates of the head area of ​​the intermediate image are replaced with the coordinates of the head area after the second projection transformation by a grid diagram, thereby obtaining a reference image. The replacement by a grid diagram is highly accurate and easy to operate. Because the head area after the second projection transformation in the reference image has achieved distortion elimination of the head area, and the intermediate image has achieved distortion elimination of the body area, the coordinates of the head area of ​​the intermediate image are replaced with the coordinates of the head area after the second projection transformation by a grid diagram, thereby obtaining an updated grid diagram of the intermediate image. Thus, by performing interpolation operations on the pixel points corresponding to the updated grid diagram to obtain the dedistorted target image, distortion elimination of the head area and the body area can be achieved at the same time.

[0118] In one embodiment, performing a second projection transformation on the intermediate image to obtain a dedistorted target image includes:

[0119] A second projection transformation is performed on the head image region to be dedistorted in the intermediate image to obtain the dedistorted target image.

[0120] Specifically, an image processing method is provided, comprising:

[0121] Perform cylindrical projection transformation on the original image to obtain an intermediate image after cylindrical projection transformation;

[0122] A second projection transformation is performed on the head image region to be dedistorted in the intermediate image to obtain the dedistorted target image.

[0123] When the first projection transformation is performed on the original image, the first projection transformation can be performed on all areas in the original image to obtain an intermediate image after the first projection transformation. Because the first projection transformation is a cylindrical projection transformation, the size of the intermediate image is consistent with the size of the original image. And because the body area in the original image has been subjected to a cylindrical projection transformation, the distortion of the body area in the intermediate image has been eliminated. The cylindrical projection transformation is performed on the head portrait area in the original image, which is equivalent to only performing a preliminary distortion elimination. Therefore, subsequently, only the head portrait area to be dedistorted in the intermediate image can be subjected to a second projection transformation to achieve distortion elimination of the head portrait area alone, thereby obtaining the dedistorted target image.

[0124] In an embodiment of the present application, if the first projection transformation is a cylindrical projection transformation, a cylindrical projection transformation is performed on the original image to obtain an intermediate image after the cylindrical projection transformation. At this time, the body area in the intermediate image has been free of distortion. However, a cylindrical projection transformation is performed on the head image area in the original image, which is equivalent to only a preliminary distortion elimination. Therefore, a second projection transformation is performed on the head image area to be dedistorted in the intermediate image to obtain a dedistorted target image. In this way, the distortion of the head image area is eliminated separately on the intermediate image, so that the obtained dedistorted target image can simultaneously eliminate the distortion of the head image area and the body area without losing the field of view.

[0125] In a specific embodiment, the function of the special projection transformation is the quotient of the function of the spherical projection transformation and the function of the cylindrical projection transformation. Figure 7 As shown, an image processing method is provided, comprising:

[0126] Step 702, performing a special projection transformation on the entire original image to obtain a first intermediate image after the special projection transformation, wherein the first intermediate image includes a head image region after the special projection transformation and a body region after the special projection transformation;

[0127] Step 704, gridding the original image to obtain a grid map, and obtaining a grid map of the first intermediate image according to the grid map of the original image;

[0128] Step 706, updating the coordinates of the grid of the head image region to be dedistorted in the original image to the coordinates of the grid of the head image region after the special projection transformation, to obtain an updated grid map of the original image;

[0129] Step 708, optimizing the updated grid to obtain an optimized grid;

[0130] Step 710, performing interpolation operation according to the pixel points corresponding to the optimized grid image to obtain a second intermediate image;

[0131] Step 712: Perform cylindrical projection transformation on the intermediate image in the horizontal axis direction or in the vertical axis direction to obtain a dedistorted target image.

[0132] In the embodiments of the present application, it is known that the head image region in the original image can be dedistorted by a preset spherical projection transformation, and the body image region in the original image can be dedistorted by a preset cylindrical projection transformation, and both the special projection transformation and the cylindrical projection transformation are partial projection transformations in the spherical projection transformation. Therefore, after the special projection transformation is performed on the entire original image and then the cylindrical projection transformation is performed on the entire first intermediate image, the head image region in the dedistorted target image obtained is equivalent to the head image region obtained by performing a spherical projection transformation on the original image. The body region in the dedistorted target image obtained is equivalent to the body region obtained by performing a cylindrical projection transformation on the original image. Therefore, by using the image processing method in the present application, it is possible to simultaneously achieve dedistortion of both the head image region and the body region, and the fusion effect is good and realistic and natural.

[0133] In one embodiment, Figure 8 As shown, an image processing device 800 is provided, the device comprising:

[0134] A first projection transformation module 820 is used to perform a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image area to be dedistorted and a body area to be dedistorted;

[0135] The second projection transformation module 840 is used to perform a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes the head image area after the spherical projection transformation and the body area after the cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

[0136] In one embodiment, the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation.

[0137] In one embodiment, the second projection transformation is a cylindrical projection transformation.

[0138] In one embodiment, the second projection transformation module 840 is also used to perform a cylindrical projection transformation on the intermediate image in the horizontal axis direction using a function of the cylindrical projection transformation to obtain a dedistorted target image; and / or, perform a cylindrical projection transformation on the intermediate image in the vertical axis direction using a function of the cylindrical projection transformation to obtain a dedistorted target image.

[0139] In one embodiment, Fig. 9 As shown, the first projection transformation module 820 includes:

[0140] A first projection transformation unit 822 is used to perform a first projection transformation on all regions in the original image to obtain a first intermediate image after the first projection transformation; wherein the first intermediate image includes the head image region after the first projection transformation and the body region after the first projection transformation;

[0141] The first coordinate replacement unit 824 is used to replace the coordinates of the head image region to be dedistorted in the original image with the coordinates of the head image region after the first projection transformation, so as to obtain a second intermediate image.

[0142] In one embodiment, the coordinate replacement unit 824 is further used to divide the original image into a grid to obtain a grid map, and obtain the grid map of the first intermediate image based on the grid map of the original image; update the coordinates of the grid points of the head portrait area to be dedistorted in the original image to the coordinates of the grid points of the head portrait area after the first projection transformation, to obtain the updated grid map of the original image; perform interpolation operation on the pixel points corresponding to the updated grid map to obtain the second intermediate image.

[0143] In one embodiment, the first projection transformation module 820 is further used to perform a first projection transformation on the head portrait region to be dedistorted in the original image to obtain a third intermediate image after the first projection transformation; the third intermediate image includes the head portrait region after the first projection transformation.

[0144] In one embodiment, the first projection transformation is a cylindrical projection transformation.

[0145] In one embodiment, the first projection transformation module 820 is used to perform a cylindrical projection transformation on the original image in the horizontal axis direction using a function of the cylindrical projection transformation to obtain an intermediate image; and / or, to perform a cylindrical projection transformation on the original image in the vertical axis direction using a function of the cylindrical projection transformation to obtain an intermediate image.

[0146] In one embodiment, the second projection transformation module 840 includes:

[0147] A second projection transformation unit, used to perform a second projection transformation on all regions in the intermediate image to obtain a reference image; wherein the reference image includes the head image region after the second projection transformation and the body region after the second projection transformation;

[0148] The second coordinate replacement unit is used to replace the head portrait area after the first projection transformation in the intermediate image with the head portrait area after the second projection transformation in the reference image to obtain a dedistorted target image.

[0149] In one embodiment, the second coordinate replacement unit is further used to divide the intermediate image into a grid to obtain a grid map, and obtain the grid map of the reference image based on the grid map of the intermediate image; the grid map includes grid points; the coordinates of the grid points in the avatar area after the first projection transformation in the intermediate image are updated to the coordinates of the grid points in the avatar area after the second projection transformation to obtain an updated grid map of the intermediate image; interpolation operations are performed on the pixel points corresponding to the updated grid map to obtain a dedistorted target image.

[0150] In one embodiment, the second projection transformation module 840 is further used to perform a second projection transformation on the head image region to be dedistorted in the intermediate image to obtain a dedistorted target image.

[0151] It should be understood that, although the various steps in the flowcharts in the above-mentioned figures are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the above-mentioned figures may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0152] The division of the various modules in the above-mentioned image processing device is only for illustration. In other embodiments, the image processing device may be divided into different modules as needed to complete all or part of the functions of the above-mentioned image processing device.

[0153] For the specific definition of the image processing device, please refer to the definition of the image processing method above, which will not be repeated here. Each module in the above image processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0154] In one embodiment, an electronic device is provided, including a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor executes the steps of an image processing method provided in the above embodiments.

[0155] Fig.10 FIG. 1 is a schematic diagram of the internal structure of an electronic device in one embodiment. Fig.10As shown, the electronic device includes a processor and a memory connected via a system bus. The processor is used to provide computing and control capabilities to support the operation of the entire electronic device. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement an image processing method provided in each of the above embodiments. The internal memory provides a cached operating environment for the operating system computer program in the non-volatile storage medium. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, etc.

[0156] The implementation of each module in the image processing device provided in the embodiment of the present application may be in the form of a computer program. The computer program may be run on an electronic device or an electronic device. The program module constituted by the computer program may be stored in the memory of the electronic device or the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.

[0157] The embodiment of the present application also provides a computer-readable storage medium, which is one or more non-volatile computer-readable storage media containing computer-executable instructions, and when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the image processing method.

[0158] A computer program product comprising instructions, when executed on a computer, causes the computer to perform an image processing method.

[0159] Any reference to memory, storage, database or other media used in the embodiments of the present application may include non-volatile and / or volatile memory. Suitable 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), which is used as an external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM) and memory bus dynamic RAM (RDRAM).

[0160] The above image processing embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An image processing method, It is characterized in that The method comprises: Performing a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image region to be dedistorted and a body region to be dedistorted; the function of the first projection transformation is the quotient of a function of a spherical projection transformation and a function of a second projection transformation; A second projection transformation is performed on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image area after a spherical projection transformation and a body area after a cylindrical projection transformation; and the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

2. The image processing method according to claim 1, It is characterized in that The second projection transformation is a cylindrical projection transformation.

3. The image processing method according to claim 2, It is characterized in that The performing a second projection transformation on the intermediate image to obtain a dedistorted target image includes: Performing cylindrical projection transformation on the intermediate image in the horizontal axis direction using the cylindrical projection transformation function to obtain the dedistorted target image; and / or, The intermediate image is subjected to cylindrical projection transformation in the longitudinal direction using the cylindrical projection transformation function to obtain the dedistorted target image.

4. The image processing method according to any one of claims 1 to 3, It is characterized in that The step of performing a first projection transformation on the original image to obtain an intermediate image includes: Performing a first projection transformation on all regions in the original image to obtain a first intermediate image after the first projection transformation; wherein the first intermediate image includes a head image region after the first projection transformation and a body region after the first projection transformation; The coordinates of the head image region to be dedistorted in the original image are replaced with the coordinates of the head image region after the first projection transformation to obtain a second intermediate image.

5. The image processing method according to claim 4, It is characterized in that The step of replacing the coordinates of the head image region to be dedistorted in the original image with the coordinates of the head image region after the first projection transformation to obtain a second intermediate image includes: Divide the original image into grids to obtain a grid map, and obtain the grid map of the first intermediate image according to the grid map of the original image; the grid map includes grid points; Updating the coordinates of the grid points of the head image region to be dedistorted in the original image to the coordinates of the grid points of the head image region after the first projection transformation, to obtain an updated grid map of the original image; An interpolation operation is performed according to the pixel points corresponding to the updated grid image to obtain a second intermediate image.

6. The image processing method according to any one of claims 1 to 3, It is characterized in that The step of performing a first projection transformation on the original image to obtain an intermediate image includes: A first projection transformation is performed on the head portrait region to be dedistorted in the original image to obtain a third intermediate image after the first projection transformation; the third intermediate image includes the head portrait region after the first projection transformation.

7. The image processing method according to claim 1, It is characterized in that The first projection transformation is a cylindrical projection transformation.

8. The image processing method according to claim 7, It is characterized in that The step of performing a first projection transformation on the original image to obtain the intermediate image includes: Performing cylindrical projection transformation on the original image in the horizontal axis direction using the cylindrical projection transformation function to obtain the intermediate image; and / or, The original image is subjected to cylindrical projection transformation in the longitudinal direction using the cylindrical projection transformation function to obtain the intermediate image.

9. The image processing method according to any one of claims 7 to 8, It is characterized in that The performing a second projection transformation on the intermediate image to obtain a dedistorted target image includes: Performing a second projection transformation on all regions in the intermediate image to obtain a reference image; wherein the reference image includes the head image region after the second projection transformation and the body region after the second projection transformation; The head image region after the first projection transformation in the intermediate image is replaced by the head image region after the second projection transformation in the reference image to obtain a dedistorted target image.

10. The image processing method according to claim 9, It is characterized in that The step of replacing the head image region after the first projection transformation in the intermediate image with the head image region after the second projection transformation in the reference image to obtain a dedistorted target image includes: Dividing the intermediate image into grids to obtain a grid map, and obtaining the grid map of the reference image according to the grid map of the intermediate image; the grid map includes grid points; updating the coordinates of the grid points in the head portrait area after the first projection transformation in the intermediate image with the coordinates of the grid points in the head portrait area after the second projection transformation, to obtain an updated grid map of the intermediate image; An interpolation operation is performed based on the pixel points corresponding to the updated grid image to obtain a dedistorted target image.

11. The image processing method according to any one of claims 7 to 8, It is characterized in that The performing a second projection transformation on the intermediate image to obtain a dedistorted target image includes: A second projection transformation is performed on the head portrait region to be dedistorted in the intermediate image to obtain a dedistorted target image.

12. An image processing device, It is characterized in that The device comprises: A first projection transformation module is used to perform a first projection transformation on the original image to obtain an intermediate image; the original image includes a head image area to be dedistorted and a body area to be dedistorted; the function of the first projection transformation is the quotient of the function of the spherical projection transformation and the function of the second projection transformation; The second projection transformation module is used to perform a second projection transformation on the intermediate image to obtain a dedistorted target image; wherein the target image includes a head image area after a spherical projection transformation and a body area after a cylindrical projection transformation; the first projection transformation and the second projection transformation are both partial projection transformations in the spherical projection transformation.

13. An electronic device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the computer program is executed by the processor, the processor is caused to perform the steps of the image processing method according to any one of claims 1 to 11.

14. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 11 are implemented.