The present application is a National Phase of International Application No. PCT/CN2019/112246, filed on Oct. 21, 2019 which claims priority to Chinese Patent Application No. 201910057169.3, filed on Jan. 22, 2019 and entitled “Generation Method for 3D Asteroid Dynamic Graph and Portable Terminal”, and the contents of which are herein incorporated by reference in their entireties.
The present disclosure relates to the field of images, and particularly to a method for generating a 3D asteroid dynamic graph and a portable terminal.
Currently, there are already some methods to generate a 3D view from an image, for example, using the micro-lens technology to generate a 3D view. The lens of the micro-lens is a magnifying lens array which is designed to magnify different images when viewed from slightly different angles. In order to generate the 3D view, it is first necessary to generate a multi-viewpoint image, such as 12-viewpoint or more viewpoint images, and then the multi-viewpoint image is mixed into a mixed image. The mixing of the multi-view images means a process of extracting suitable pixels from the multi-viewpoint image and combining them into a new image. The new image contains multi-viewpoint information of the original image. The lens of the micro-lens is configured to display these multi-viewpoint images at different viewpoints. Finally, through the micro-lens board, the viewer's left and right eyes can see different images, thereby producing a 3D effect. The disadvantage of this method is that it requires the use of the micro-lens board rather than naked eyes to view.
Another commonly used method is to manually convert a 2D image into a multi-viewpoint image. The operator usually needs to create a skin to extract an object from a target image, and then determines depth information for the skin according to own judgment. The depth information has a grayscale image with the same size as the original 2D image; and the gray in the grayscale image represents a depth of each portion in the image. The manually created depth information is configured to guide the computer to move the pixels of the original 2D image to form a new viewpoint map. A depth map can produce a strong 3D display effect. However, it takes hours or even days to generate a 3D view by using such existing method.
In view of this, the existing method and system for generating a 3D view from an image have disadvantages such as requiring tools or long processing time, and the user experience is not high.
The present disclosure provides a method for generating a 3D asteroid dynamic graph, a computer-readable storage medium and a portable terminal, which aims to automatically generate asteroid views under virtual viewpoints, and synthesize the render the asteroid views to generate an asteroid dynamic graph with a 3D effect from one panoramic image. The method has a high efficiency, the image quality is good, and the user experience is higher.
In the first aspect, the present disclosure provides a method for generating a 3D asteroid dynamic graph, including:
In the second aspect, the present disclosure provides computer-readable storage medium that stores one or more computer programs, the one or more computer programs, when executed by a processor, implement the steps of the method for generating the 3D asteroid dynamic graph:
In the third aspect, the present disclosure provides a portable terminal, including:
In the technical solution of the present disclosure, by calculating the image depth map, automatically generating the asteroid views under the virtual viewpoints, and synthesizing the rendering the asteroid views, an asteroid dynamic graph with a 3D effect is generated from one panoramic image, which not only enhances the visual effect, but also has advantages such as a fast processing speed.
In order to make the objectives, technical solution, and advantages of the present disclosure clearer, the present disclosure will be described in detail with reference to the accompanying drawings and embodiments. It should be appreciated that the specific embodiments described here are only used for explaining the present disclosure, rather than limiting the present disclosure.
In order to illustrate the technical solution of the present disclosure, specific embodiments are used for description below.
Referring to
S101: a panoramic image is acquired.
A panoramic image is acquired. The panoramic image can be generated by multiple fisheye images taken by at least two fisheye lenses through an optical flow stitching algorithm. The content of the panoramic image can include a picture taken by a panoramic camera held by a photographer.
S102: the panoramic image is identified and partitioned into a sky area, a human body area and a ground area.
The sky and the human body are identified from the panoramic image content and a semantic partition is performed. There are mainly three areas through the partition: sky area, human body area, and ground area.
The identifying and partition of the sky area can be performed by using a classical sky detection algorithm. The sky detection algorithm is not limited to the methods disclosed in the paper “Sky Region Detection in a Single Image for Autonomous Ground Robot Navigation” and the Chinese patent CN109003237A. The identifying and partition of the human body can be performed by using a classical image target detection algorithm. The target detection algorithm is not limited to a method disclosed in the document “Cascade R-CNN: Delving into High Quality Object Detection”, etc. After the sky area and the human body area are partitioned, the remaining portion is all partitioned into the ground area, that is, the ground area can include a tall building, a house, a tree, etc.
S103: the panoramic depth map is calculated for the sky area, the human body area and the ground area;
The relative depth between different objects can reflect a three-dimensional position relationship between the objects. The depth of an object represents a distance between the object and a camera in an actual scene. Therefore, the farther the object is from the camera, the greater the depth value; and the closer the object to the camera, the smaller the depth value.
The panoramic depth map is calculated according to the sky area, the human body area, and the ground area; and the process is provided as follows.
The depth value bodyDepth of a pixel (x1, y1) in the human body area can be calculated by a formula (1):
In the above formula (1), y1 is the row-coordinate of the pixel (x1, y1) in the panoramic image, x∈[minRowIdx, maxRowIdx]; minRowIdx is the minimum value of an row-coordinate of a pixel in the human body area; maxRowIdx is the maximum value of the row-coordinate of the pixel in the human body area; minBodyDepth is set as the minimum value of a pixel depth value in the human body area; maxBodyDepth is set as the maximum value of the pixel depth value in the human body area, where bodyDepth∈[minBodyDepth, maxBodyDepth].
The depth value of all pixels in the sky area is set to a fixed value skyDepth, and skyDepth∈(maxBodyDepth, 255].
The pixel (x2, y2) in the ground area are partitioned into a fixed depth value area and a gradient depth value area.
A range of the row-coordinate of the fixed depth area is [2maxRowIdx-imgH, imgH], where imgH is a height of the image, that is, the maximum value of the row-coordinate, so that the depth value of the pixel in the fixed depth area is set as the fixed value maxBodyDepth.
The area in the ground area except for the fixed depth area is the gradient depth value area. The depth value of the pixel (x2, y2) in the gradient depth value area can be calculated by a formula (2):
In the formula (2), y2 is the row-coordinate of the pixel (x2, y2) in the panoramic image, and y2<2maxRowIdx-imgH; edgeDepth is a set fixed value, and edgeDepth∈[maxBodyDepth, skyDepth).
After the depth value of the human body area, the depth value of the sky area and the depth value of the ground area are calculated respectively, the panoramic depth map can be obtained, referring to
S104: the panoramic image and the panoramic depth map are transformed respectively to generate the asteroid image and the asteroid depth map.
Referring to
S1041: the coordinate of the pixel point in the asteroid image is transformed from an image coordinate system to a physical coordinate system.
A south pole point of a unit ball is taken as an origin of the three-dimensional coordinates, the x-axis is to the right, the y-axis is vertically inward, and the z-axis is upward, such arrangement conforms to the right-handed coordinate system. A view point of the observer is set to be located on a line between a north pole point and a center of the unit ball; a coordinate value is denoted as (0,0,d); it is set that a projected asteroid plane is tangent to the unit ball at the coordinate origin (0,0,0); an outputted asteroid image size is set as (W, H); a coordinate (u, v) of a pixel point in the asteroid image is transformed as a coordinate (U, V) in the physical coordinate system; and the calculation formulas for U and V are a formula (3) and a formula (4) respectively as follows:
In the formulas (3) and (4), L=2 ·Radius·tan(fov·0.5),
is a transformation formula of radian system when an angle of view is set to 120° and a radius of the unit ball satisfies that Radius=1.
S1042: an azimuth angle φ of the pixel point in a spherical coordinate system is calculated; where the pixel point has the coordinate in the physical coordinate system.
The calculation formula for φ is as follows:
In the above formula (5), r is a radius of a latitude circle of the point (U, V) in the spherical coordinate system, r=√{square root over (U·U+V·V)}.
S1043: a zenith angle θ of the pixel point in the spherical coordinate system is calculated; where the pixel point has the coordinate in the physical coordinate system.
The tangent theorem and the sine theorem are utilized to calculate the zenith angle θ of the point (U, V) in the spherical coordinate system. The calculation formula is as follows:
θ=π−α−β (6)
In the formula (6),
S1044: the transformation formula between the pixel point (θ, φ) in the spherical coordinate system and the pixel point (x, y) in the panoramic image is calculated.
The latitude and longitude expansion method is utilized to project the spherical coordinate (θ, φ) to the panoramic image coordinate (x, y). The calculation formula for x is as follows:
The calculation formula for y is as follows:
According to the above method for mapping the asteroid image to the panoramic image, a reverse mapping method can be utilized to obtain the asteroid image from the panoramic image. The reverse mapping method specifically includes following steps.
A corresponding coordinate value in the panoramic image is reversely calculated from the coordinate value in the asteroid image.
Since the calculated coordinate value is floating-point type data, it is necessary to use bilinear interpolation algorithm to calculate a pixel value of the pixel point (u, v) in the asteroid image.
All the pixel points in the panoramic image are traversed, and an asteroid view can be calculated and generated.
An asteroid view is generated from the panoramic image obtained in the step S101.
An asteroid depth map is generated from the panoramic depth map calculated in the step S103.
S105: an asteroid view under a virtual viewpoint is generated according to the asteroid image and the asteroid depth map.
Referring to
S1051: a coordinate of a virtual viewpoint is set.
A real viewpoint of the asteroid image is directly above the asteroid image. A virtual viewpoint is set on a unit circular trajectory centered on the real viewpoint and parallel to the asteroid image. The coordinate of the virtual viewpoint is (x, y), with x=cos (θ), y=sin(θ), θ∈[0,2. π]; the number of virtual viewpoints is n, and n>1.
S1052: a translation matrix T from the real viewpoint to the virtual viewpoint is calculated.
T is a 3*3 matrix, and is calculated by following formula (9):
S1053: a rotation matrix R between the real viewpoint and the virtual viewpoint is calculated.
R is a 3*3 matrix, and is calculated by following formula (10):
S1054: the asteroid view under the virtual viewpoint is generated by using a 3D warping algorithm according to the asteroid image and the asteroid depth map.
The 3D warping algorithm includes the following steps.
A two-dimensional image coordinate in an RGB image of the asteroid image and a corresponding depth value in the asteroid depth map are read; and the two-dimensional coordinate point q is backprojected to the real three-dimensional coordinate point P.
The real three-dimensional coordinate point P is rotated or translated to generate P′.
The rotated or translated virtual three-dimensional coordinate point P′ is re-projected onto the two-dimensional image plane under the virtual viewpoint to generate a two-dimensional coordinate point q′; the depth value reflects a front and back occlusion relationship between the three-dimensional objects in the projection process.
The projection formula of the asteroid view under the virtual viewpoint is shown as a formula (11):
q′=K·R·K−1·q+K·T (11)
In the above formula (11), P is the real three-dimensional coordinate point, q is the two-dimensional coordinate point of P projected onto the two-dimensional image plane, q=K·P; P′ is the virtual three-dimensional coordinate point; and a relationship between the virtual three-dimensional coordinate point P′ and the real three-dimensional coordinate point P is P′=R·P+T. q′ is the two-dimensional coordinate point of P′ projected onto the two-dimensional image plane; q′=K·P′, and K is an internal parameter matrix of the camera; the virtual camera and the real camera are arranged to have the same internal parameters.
In the process of using the 3D warping algorithm to generate the asteroid view under the virtual viewpoint, a void area without pixel information generated by the object in the original asteroid image due to the front and back occlusion is filled with adjacent pixel points.
In the generation of the asteroid view under the virtual viewpoint, since there are n virtual viewpoints (x, y), n asteroid views under the n virtual viewpoints can be generated, n>1.
S106: the 3D asteroid dynamic graph is generated by rendering a plurality of asteroid views under a plurality of virtual viewpoints.
n virtual viewpoints on the unit circular trajectory are utilized to generate n asteroid views under the n virtual viewpoints; the n asteroid views are synthesized and rendered according to a sequence or a set order of the asteroid views generated under the virtual viewpoints, to generate the asteroid dynamic graph with a 3D effect. n is a positive integer.
The embodiment II of the present disclosure provides a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for generating a 3D asteroid dynamic graph provided in the embodiment I of the present disclosure are implemented.
The computer-readable storage medium can be a non-transitory computer-readable storage medium.
In the embodiments of the present disclosure, those of ordinary skill in the art can understand that all or part of the steps in the methods of the above-mentioned embodiments can be implemented by a program instructing relevant hardware, and the program can be stored in a computer-readable storage medium. The storage medium mentioned is, such as ROM/RAM, a magnetic disk, an optical disk, etc.
The above are merely the preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modification, equivalent replacement and improvement made within the spirit and principle of the present disclosure shall be regarded as the protection scope of the present disclosure.
In the present disclosure, by calculating the image depth map, automatically generating, synthesizing and rendering the asteroid views under the virtual viewpoints, the asteroid dynamic graph with the 3D effect is generated from one panoramic image, which not only enhances the visual effect, but also has advantages such as a fast processing speed.
Number | Date | Country | Kind |
---|---|---|---|
201910057169.3 | Jan 2019 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2019/112246 | 10/21/2019 | WO |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2020/151268 | 7/30/2020 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
11276226 | Lim | Mar 2022 | B2 |
20110069152 | Wang | Mar 2011 | A1 |
20120041722 | Quan et al. | Feb 2012 | A1 |
20130314402 | Furumura | Nov 2013 | A1 |
20140300566 | Lee | Oct 2014 | A1 |
20170294000 | Shen | Oct 2017 | A1 |
20190012804 | Wang | Jan 2019 | A1 |
20190012818 | Fine | Jan 2019 | A1 |
20190287223 | Chen | Sep 2019 | A1 |
20210264671 | Chen | Aug 2021 | A1 |
Number | Date | Country |
---|---|---|
103020900 | Apr 2013 | CN |
105793895 | Jul 2016 | CN |
105959665 | Sep 2016 | CN |
105959665 | Sep 2016 | CN |
106056139 | Oct 2016 | CN |
106162203 | Nov 2016 | CN |
107590850 | Jan 2018 | CN |
108377407 | Aug 2018 | CN |
109003237 | Dec 2018 | CN |
109003237 | Dec 2018 | CN |
109769110 | May 2019 | CN |
2568439 | Mar 2013 | EP |
2627072 | Aug 2013 | EP |
2006-053694 | Feb 2006 | JP |
2006053694 | Feb 2006 | JP |
2014-007715 | Jan 2014 | JP |
WO-2012046373 | Apr 2012 | WO |
WO-2016048020 | Mar 2016 | WO |
2018154589 | Aug 2018 | WO |
Entry |
---|
Map-Based Localization Using the Panoramic Horizon, Fridtjof Stein et al., IEEE, 1995, pp. 892-896 (Year: 1995). |
Preface: The Chang'e-3 lander and rover mission to the Moon, Wing-Huen et al., RAA, 2014, pp. 1511-1513 (Year: 2014). |
Perceptual Segmentation: Combining Image Segmentation With Object Tagging, Ruth Bergman et al., IEEE, Jun. 2011, pp. 1668-1681 (Year: 2011). |
European Search Report dated Aug. 29, 2022 issued in counterpart Patent Application No. 19912004.9 (17 pages). |
Japanese Office Action dated Oct. 4, 2022 issued in counterpart Patent Application No. 2021-542464 (5 pages). |
Search Report issued in corresponding Chinese Patent Application No. 2019100571693 (2 pages). |
International Search Report dated Jan. 21, 2020 issued in corresponding Patent Application No. PCT/CN2019/112246 (3 pages). |
Number | Date | Country | |
---|---|---|---|
20220092734 A1 | Mar 2022 | US |