CN-115170633-B - Method, device and storage medium for creating 3D lens motion based on picture depth of field
Abstract
The application relates to a method, a device and a storage medium for creating 3D lens motion based on image depth, which comprises the steps of editing and preprocessing different depth areas of an input image to obtain a depth information graph; acquiring motion information of a lens; and calculates the offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph to obtain a 3D image of the input image, the depth fault area is shifted through the shift of the pixel points and is not displayed, and because the depth fault area is less in the whole image, the whole visual effect cannot be affected when the 3D image picture is displayed, so that the problems that in the prior art, the depth fault area is hard and unnatural in transition and is not suitable for pictures with larger depth of field are avoided.
Inventors
- YUAN JIASHENG
Assignees
- 广州光锥元信息科技有限公司
- 广州光锥元信息科技有限公司
Dates
- Publication Date
- 20260421
- Application Date
- 20220701
- Priority Date
- 20220701
Claims (5)
- 1. A method for creating 3D lens motion based on a depth of field of a picture, comprising: editing different depth areas of an input image to obtain a depth-of-field dividing map; preprocessing the scene depth dividing map to obtain a depth information map; Acquiring motion information of a lens; The movement information of the lens comprises the pushing distance information, the pitch angle information and the yaw angle information of the lens; calculating offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph to obtain a 3D image of the input image; the calculating the offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph comprises: Calculating offset information of pixel points of each depth region from a central point through a preset translation formula according to the depth information and the pushing distance information of each depth region in the depth information graph; the preset translation formula is as follows: For a pixel of depth d (0 < = d < = 1), assuming that the distance of forward and backward progress is p, the offset of the pixel from the center point is k2 p (1.0-D), wherein k2 is a translation constant; According to the depth information and pitch angle information of each depth region in the depth information graph, calculating offset information of the pixel point of each depth region on the X axis from the original position of the pixel point of each depth region through a preset deflection formula; According to the depth information and yaw angle information of each depth region in the depth information graph, calculating offset information of the pixel point of each depth region on the Y-axis from the original position of the pixel point of each depth region through a preset deflection formula; the preset deflection formula is: for a pixel with depth d (0 < = d < = 1), assuming that the rotation angle is θ, the pixel is moved by a distance k1 d Θ, where k1 is the deflection constant; Deflection canvas, get 3D picture of different angles; and cutting the display area to obtain a final output image.
- 2. The method of claim 1, wherein the step of determining the position of the substrate comprises, The preprocessing the scene depth dividing map to obtain a scene depth information map comprises the following steps: And performing eclosion, blurring and superposition operations on each depth region in the depth dividing map to obtain a depth information map, wherein the gray value of each pixel point in the depth information map represents the depth value corresponding to the pixel point.
- 3. The method of claim 2, wherein the step of determining the position of the substrate comprises, The step of editing the different depth areas of the input image to obtain a depth-of-field partition map comprises the following steps: and dividing the input image into a near field region, a middle field region and a far field region according to different depth regions of the input image to obtain a depth-of-field division map.
- 4. An apparatus for creating 3D lens motion based on a depth of field of a picture, the apparatus comprising: the depth of field generation module is used for editing different depth areas of the input image to obtain a depth of field division map, and preprocessing the depth of field division map to obtain a depth of field information map; The lens movement module is used for acquiring movement information of a lens, calculating offset information of each depth region pixel point according to the movement information of the lens and the depth information of each depth region pixel point in the depth information graph, and obtaining a 3D image of an input image; The movement information of the lens comprises the pushing distance information, the pitch angle information and the yaw angle information of the lens; the calculating the offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph comprises: Calculating offset information of pixel points of each depth region from a central point through a preset translation formula according to the depth information and the pushing distance information of each depth region in the depth information graph; the preset translation formula is as follows: For a pixel of depth d (0 < = d < = 1), assuming that the distance of forward and backward progress is p, the offset of the pixel from the center point is k2 p (1.0-D), wherein k2 is a translation constant; According to the depth information and pitch angle information of each depth region in the depth information graph, calculating offset information of the pixel point of each depth region on the X axis from the original position of the pixel point of each depth region through a preset deflection formula; According to the depth information and yaw angle information of each depth region in the depth information graph, calculating offset information of the pixel point of each depth region on the Y-axis from the original position of the pixel point of each depth region through a preset deflection formula; the preset deflection formula is: for a pixel with depth d (0 < = d < = 1), assuming that the rotation angle is θ, the pixel is moved by a distance k1 d Θ, where k1 is the deflection constant; The device is also used for deflecting canvas to obtain 3D images with different angles; and the output module is used for cutting the display area to obtain a final output image.
- 5. A storage medium storing a computer program which, when executed by a master, implements the steps of the method of creating 3D lens motion based on picture depth of field according to any one of claims 1-3.
Description
Method, device and storage medium for creating 3D lens motion based on picture depth of field Technical Field The invention relates to the technical field of image and video processing, in particular to a method, a device and a storage medium for creating 3D lens motion based on picture depth of field. Background The current method for reconstructing lens motion by using depth information images in the market is mostly practical modeling, namely a 3D model is actually built by using depth information, and then perspective changing Effect is obtained by moving a camera in a three-dimensional space, and the method mainly has the problems that depth fault areas are hard and unnatural in transition, not suitable for images with larger depth of field, and a Volumax land slope template exists in Adobe Effect, and the 3D perspective changing Effect is realized by using the multi-layer stacking and displacement image technology without depending on modeling, but the template is high in performance consumption and not suitable for a mobile terminal. Disclosure of Invention In view of the above, the present invention aims to provide a method, a device and a storage medium for creating 3D lens motion based on a depth of field of a picture, so as to solve the problems that in the prior art, a 3D model is actually created by using depth of field information, a perspective changing effect is obtained by moving a camera in a three-dimensional space, a depth fault area is hard and unnatural, and the method is not suitable for pictures with large depth of field. According to a first aspect of an embodiment of the present invention, there is provided a method of creating 3D lens motion based on a depth of field of a picture, comprising: editing different depth areas of an input image to obtain a depth-of-field dividing map; preprocessing the scene depth dividing map to obtain a depth information map; Acquiring motion information of a lens; calculating offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph to obtain a 3D image of the input image; Deflection canvas, get 3D picture of different angles; and cutting the display area to obtain a final output image. Preferably, the method comprises the steps of, The movement information of the lens comprises the pushing distance information, the pitch angle information and the yaw angle information of the lens. Preferably, the method comprises the steps of, The calculating the offset information of each depth region pixel point according to the motion information of the lens and the depth information of each depth region pixel point in the depth information graph comprises: And calculating offset information of the pixel points of each depth region from the central point through a preset translation formula according to the depth information and the pushing distance information of each depth region in the depth information graph. Preferably, the method further comprises: According to the depth information and pitch angle information of each depth region in the depth information graph, calculating offset information of the pixel point of each depth region on the X axis from the original position of the pixel point of each depth region through a preset deflection formula; And calculating offset information of the pixel points of each depth region from the original position of the pixel points on the Y axis according to the depth information and the yaw angle information of each depth region in the depth information graph by a preset deflection formula. Preferably, the method comprises the steps of, The preprocessing the scene depth dividing map to obtain a scene depth information map comprises the following steps: And performing eclosion, blurring and superposition operations on each depth region in the depth dividing map to obtain a depth information map, wherein the gray value of each pixel point in the depth information map represents the depth value corresponding to the pixel point. Preferably, the method comprises the steps of, The step of editing the different depth areas of the input image to obtain a depth-of-field partition map comprises the following steps: and dividing the input image into a near field region, a middle field region and a far field region according to different depth regions of the input image to obtain a depth-of-field division map. According to a second aspect of an embodiment of the present invention, there is provided an apparatus for creating 3D lens motion based on a depth of field of a picture, comprising: the depth of field generation module is used for editing different depth areas of the input image to obtain a depth of field division map, and preprocessing the depth of field division map to obtain a depth of field information map; The lens movement module is used for acquiring movement information of a lens, calcu