CN113781628A - Three-dimensional scene building method and device - Google Patents

Three-dimensional scene building method and device Download PDF

Info

Publication number
CN113781628A
CN113781628A CN202011351115.7A CN202011351115A CN113781628A CN 113781628 A CN113781628 A CN 113781628A CN 202011351115 A CN202011351115 A CN 202011351115A CN 113781628 A CN113781628 A CN 113781628A
Authority
CN
China
Prior art keywords
camera
model
bounding box
coordinate system
world coordinate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011351115.7A
Other languages
Chinese (zh)
Inventor
贾建帮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011351115.7A priority Critical patent/CN113781628A/en
Publication of CN113781628A publication Critical patent/CN113781628A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/12Bounding box

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a three-dimensional scene building method and device, and relates to the technical field of computers. One embodiment of the method comprises: loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box; acquiring the position of a camera in a world coordinate system, and determining the position of a model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box; and removing the model bounding box to obtain the model information after the position is determined, and integrating the model information with the basic information of the three-dimensional scene to be used as an initialization parameter to build the three-dimensional scene. According to the embodiment, distance parameters and speed parameters do not need to be configured, the position of the model can be automatically calculated, the method is simple and easy to use for professional three-dimensional scene construction personnel and non-professionals, and the repeated workload is reduced.

Description

Three-dimensional scene building method and device
Technical Field
The invention relates to the technical field of computers, in particular to a three-dimensional scene building method and device.
Background
The method aims to obtain a good visual effect in the ARVR field, only the program rendering is not only large in calculation amount, but also the position of the rendering model and the workload of the corresponding matching relation are huge, so that the corresponding effect can be completed by loading an external model under most conditions. However, when the model is loaded, the camera position, the camera parameters, the model position, the model parameters, the light and other information need to be fixed in advance, otherwise, the model cannot be displayed in the visual scene according to the design effect.
At present, the model is mainly calibrated and initialized in a moving mode through openGL or WebGL, but the two modes have the following problems: in the process of building the three-dimensional scene, all parameters such as a camera, a model, displacement and the like must be known, and no specific case and use method exist for building the three-dimensional scene with locally unknown parameters.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for building a three-dimensional scene, which can at least solve a phenomenon that a three-dimensional scene can be built only if all parameters are known in the prior art.
In order to achieve the above object, according to an aspect of the embodiments of the present invention, there is provided a three-dimensional scene construction method, including:
loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
acquiring the position of a camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box;
and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
Optionally, before the loading the model information, the method further includes:
constructing a coordinate system based on the camera view angle and a preset camera orientation; the coordinate system is used for building a three-dimensional scene and comprises a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
Optionally, before the constructing the coordinate system based on the camera view angle and the preset camera orientation, the method further includes:
acquiring a preset camera view angle; or
Initializing the three-dimensional scene basic information, determining the size of a viewport of the three-dimensional scene basic information, and processing the maximum value of the width and the height of the viewport in an arctangent mode to obtain the maximum visual angle of the camera on the height side as the visual angle of the camera.
Optionally, the obtaining the position of the camera in the world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the camera view angle and the width and height of the model bounding box, includes:
calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
judging whether the orientation of the camera is in the forward direction, if so, taking the sum of the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
And if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system.
Optionally, the calculating a distance between the camera and the model bounding box according to the camera view angle and the width and height of the model bounding box includes:
determining the maximum width value of the model bounding box, and calculating the minimum distance for displaying the maximum width value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
determining the maximum height value of the model bounding box, and calculating the minimum distance for displaying the maximum height value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
and taking the minimum distance with a larger value as the distance between the camera and the model bounding box.
Optionally, after the removing the model bounding box, the method further includes:
acquiring the moving speed of a camera, and calculating the ratio of the moving speed to the distance;
and determining the actual distance between the measured camera and the model bounding box, and taking the product of the ratio and the actual distance as the moving speed of each point in the model information.
In order to achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a three-dimensional scene constructing apparatus, including:
the bounding box construction module is used for loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
the position determining module is used for acquiring the position of the camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the camera view angle and the width and height of the model bounding box;
and the scene building module is used for removing the model bounding box, obtaining the model information after the position is determined, and integrating the model information by combining the three-dimensional scene basic information to build the three-dimensional scene as an initialization parameter.
Optionally, the system further includes a coordinate system building module, configured to: constructing a coordinate system based on the camera view angle and a preset camera orientation; the coordinate system is used for building a three-dimensional scene and comprises a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
Optionally, the system further comprises a camera view angle acquiring module, configured to:
acquiring a preset camera view angle; or
Initializing the three-dimensional scene basic information, determining the size of a viewport of the three-dimensional scene basic information, and processing the maximum value of the width and the height of the viewport in an arctangent mode to obtain the maximum visual angle of the camera on the height side as the visual angle of the camera.
Optionally, the position determining module is configured to:
calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
judging whether the orientation of the camera is in the forward direction, if so, taking the sum of the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
And if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system.
Optionally, the position determining module is configured to:
determining the maximum width value of the model bounding box, and calculating the minimum distance for displaying the maximum width value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
determining the maximum height value of the model bounding box, and calculating the minimum distance for displaying the maximum height value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
and taking the minimum distance with a larger value as the distance between the camera and the model bounding box.
Optionally, the mobile terminal further includes a moving speed calculation module, configured to:
acquiring the moving speed of a camera, and calculating the ratio of the moving speed to the distance;
and determining the actual distance between the measured camera and the model bounding box, and taking the product of the ratio and the actual distance as the moving speed of each point in the model information.
In order to achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device for three-dimensional scene construction.
The electronic device of the embodiment of the invention comprises: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize any one of the three-dimensional scene building methods.
To achieve the above object, according to a further aspect of the embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program, when executed by a processor, implementing any one of the three-dimensional scene construction methods described above.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: distance parameters and speed parameters do not need to be configured in the model loading process, the position of the model can be automatically calculated, and a simple and easy-to-use three-dimensional scene building mode is provided for professional three-dimensional scene building personnel and non-professional people.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic main flow diagram of a three-dimensional scene construction method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of four coordinate systems constructed based on camera parameters;
FIG. 3(a) is a stylistic representation of a model bounding box;
FIG. 3(b) is a schematic diagram of an embodiment;
FIG. 4 is a schematic flow chart of an alternative three-dimensional scene construction method according to an embodiment of the present invention;
FIG. 5 is a two-dimensional schematic of calculating a camera view;
FIG. 6 is a schematic flow chart of another alternative three-dimensional scene construction method according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of calculating the distance of a camera from the model bounding box;
FIG. 8 is a schematic diagram of a model slice coinciding with a camera viewport;
FIG. 9 is a schematic flow chart of yet another alternative three-dimensional scene construction method according to the embodiment of the invention
FIG. 10 is a schematic diagram of the main modules of a three-dimensional scene construction apparatus according to an embodiment of the present invention;
FIG. 11 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 12 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The following is a detailed description of the problems of the prior art:
1. problems mainly existing at present in model calibration
1) The three-dimensional model created by the model creation tools such as 3D max, maya, blend and the like only contains basic information of the model itself, and does not contain information such as camera position, camera parameters and the like. Data import requires a model designer to give parameter information, otherwise, the camera position needs to be calibrated in a test mode.
2) In a three-dimensional scene with a single camera and multiple models, even if the camera is fixed, due to the parameter problem of different models, the calibration of the model positions is more complicated, each model is an independent individual, so that certain errors can exist in the calibration of each model position, and the whole three-dimensional scene can be disordered due to multiple calibration errors.
3) When the three-dimensional scene model is calibrated, the three-dimensional imaging must be displayed in the viewport of the camera, and the three-dimensional data which is not in the viewport cannot be displayed in the scene, so that the three-dimensional model needs to be calibrated in the scene in which the model is displayed.
2. Initialization of moving speed is a major problem at present
1) The moving speed of the model has no quantitative index and is a fixed value set in a human body sense mode;
2) the models are different in size, so that the moving speed of the models or the moving speed of the camera is greatly different from the speed of visual understanding;
3) when the vibration speed of the light is the same as the moving speed of the object, a continuous visual phenomenon occurs, and the naked eyes cannot capture the movement of the object or the model in the scene. Therefore, if the distance is long, the moving speed of the model is low, and the microscopic displacement of the model cannot be captured by naked eyes.
3. The main problems existing at present in the parameter setting of the camera
1) The camera view angle is usually fixed by professionals, imaging can be only carried out in a specific view angle area, and the concept of the view angle is difficult to understand for non-professionals;
2) the camera orientation needs to be considered in addition to the camera view angle, and the visual imaging of different camera orientations is completely different, which the prior art does not consider.
Referring to fig. 1, shown is a main flowchart of a three-dimensional scene construction method provided by an embodiment of the present invention, including the following steps:
s101: loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
s102: acquiring the position of a camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box;
s103: and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
In the above embodiment, the scheme is suitable for various scenes, such as AR shoe trying and AR makeup trying projects, 3D samples with relatively accurate labels can be obtained, and the labeling area of the 2D picture needs to be labeled by using a 3D model (note: the 3D model includes ply, stl, obj, vtk, and the like). However, the three-dimensional model only stores the three-dimensional data information of the model itself, and does not store scene information and camera parameter information, so in order to improve the universality of the labeling, the scheme provides a three-dimensional scene model calibration method.
In step S101, three-dimensional scene basic information is initialized, that is, information such as the length, width, lighting, and renderer of a scene needs to be specified. The three-dimensional scene basis information may determine a camera view angle, as described with reference to fig. 4, which follows.
And dynamically loading self-defined or predefined camera parameters, wherein the camera parameters mainly define the illumination direction and the camera view angle of the camera. Creating a coordinate system according to the camera parameters, specifically referring to fig. 2, there are four coordinate systems in the camera, which are a world coordinate system, a camera coordinate system, an image coordinate system, and a pixel coordinate system:
1) the world coordinate system can arbitrarily designate a horizontal axis and a vertical axis, is a coordinate system where the point P in fig. 2 is located, and can also be understood as an xyz coordinate system corresponding to the model parameter;
2) the origin of the camera coordinate system is positioned in the small hole, the z-axis coincides with the optical axis, and the X-axis and the y-axis are parallel projection planes and are an X-axis of the coordinate system of the upper drawingcYcZc
3) The origin of the image coordinate system is located at the intersection point of the optical axis and the projection plane, the axis is parallel to the projection plane and is a coordinate system of the upper graph, and the coordinate system x of the upper graphpypz;
4) And when the pixel coordinate system is seen from the small hole to the projection plane, the upper left corner of the projection plane is taken as an origin, the uv axis is superposed with two sides of the projection plane, and the coordinate system and the image coordinate system are in the same plane but the origin is different.
And loading model information, and acquiring coordinate values of all points in the model in the world coordinate system to respectively determine the maximum value and the minimum value of X, Y, Z on three coordinate axes. Model bounding boxes were constructed based on the maximum and minimum values, with specific box style parameters as shown in fig. 3 (a).
For step S102, the obj model is loaded, the source of the obj model adopted in the present scheme is 3Dmax tool drawing, and during drawing, the camera position is usually placed at the (0,0,0) point (actually, other points may also be) in the three-dimensional world coordinate system, and is oriented to the negative direction or the positive direction of the z-axis.
Drawing a three-dimensional model to be labeled according to the visual distance, calculating the distance from the camera to the model bounding box in order to enable the model to be imaged in a three-dimensional scene, and determining the position of the model bounding box under a world coordinate system according to the camera view angle (or elevation angle).
In step S103, after the model bounding box is calculated to be located in the world coordinate system, and the model is constructed, the model bounding box may be removed, and only the information of each point in the model may be considered.
And building the three-dimensional scene by using the model information and the three-dimensional scene basic information as the basis, so that the three-dimensional scene can be built by using the model information and the three-dimensional scene basic information as initialization parameters. The built scene can be further used later, and can be applied to application scenes such as 3D labeling, game scene initialization, 3D commodity initialization and the like, as shown in fig. 3(b), how to use the scene is a conventional means in the field, and the scheme is not repeated herein.
According to the method provided by the embodiment, the distance parameter does not need to be configured in the model loading process, the model position can be automatically calculated, and a simple and easy-to-use three-dimensional scene building mode is provided for professional three-dimensional scene building personnel and non-professional personnel.
Referring to fig. 4, a flow diagram of an optional three-dimensional scene construction method according to an embodiment of the present invention is shown, including the following steps:
s401: initializing three-dimensional scene basic information, determining the size of a viewport of the three-dimensional scene basic information, and processing the maximum value of the width and the height of the viewport in an arc tangent mode to obtain the maximum visual angle of a camera on the height side as a camera visual angle;
s402: constructing a coordinate system based on the camera view angle and a preset camera orientation; the coordinate system is used for building a three-dimensional scene and comprises a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system;
s403: loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
s404: acquiring the position of a camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box;
s405: and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
In the above embodiment, for steps S402 to S405, refer to the description of steps S101 to S103 shown in fig. 1, and are not described herein again.
In the above embodiment, as for step S401, the present embodiment is used to determine the camera angle, and there are two methods for determining the camera angle at present, one is manually preset, such as 45 ° and 60 ° commonly used in the industry. The other is determined according to the three-dimensional scene basic information, and the specific calculation mode is as follows:
to ensure that a two-dimensional scene can be fully imaged into the camera in the camera viewport (which is typically two-dimensional when viewed by the camera), it can be defined that the size of the camera view angle is calculated from the height and width of the three-dimensional base scene. Referring to fig. 5, the formula for calculating the viewing angle is:
Figure BDA0002800966640000091
it should be noted that height and width are the maximum values of height and width in the three-dimensional scene (the same applies when the image is used as the background of the scene), and only a default camera view angle is calculated according to the height and width.
Since the camera view angle is an angle system and only the elevation angle of the height is concerned, it is necessary to convert the radian into an angle and set the elevation angle of the camera width according to the ratio of the elevation angle of the height to the width of the camera. The complete calculation formula is therefore:
Figure BDA0002800966640000101
where PI is the circumference ratio PI, and math. PI represents the ratio of the circumference to the diameter of a circle, which is about 3.14159.
The method provided by the embodiment is suitable for multi-model scenes, and can unify the calculation mode of the camera view angle based on the three-dimensional scene basic information, so that the error view angle is reduced to the greatest extent. The camera view angle is preset or automatically created, the purpose of automatic calibration is achieved, and the difficulty of scene construction is reduced.
Referring to fig. 6, a schematic flow chart of another optional three-dimensional scene construction method according to the embodiment of the present invention is shown, including the following steps:
s601: loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
s602: calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
s603: judging whether the orientation of the camera is forward or not;
s604: if the distance is positive, the sum of the position of the camera in the world coordinate system and the distance is used as the position of the model bounding box in the world coordinate system;
s605: if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system;
s606: and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
In the above embodiment, for steps S601 and S606, reference may be made to the description of steps S101 and S103 shown in fig. 1, and details are not repeated here.
In the above embodiment, as for step S602, if the camera angle is known to be fov, then the maximum value and the minimum value of the model bounding box on the X, Y axis are determined according to the previous step, and the maximum value Max (width, height) of the absolute value is determined.
Specifically, the method comprises the following steps:
determining the maximum width value of the model bounding box, and calculating the distance max width/[2 × arctan (fov) ] displaying the maximum width value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera
Determining the maximum height value of the model bounding box, and calculating the distance max height/[2 × arctan (fov) displaying the maximum height value in the visible area of the camera by an arc tangent mode in combination with the visual angle of the camera;
the distance with the larger value is taken as the distance between the camera and the model bounding box, which is shown in fig. 7.
In steps S603 to S605, after the distance between the camera and the model bounding box is calculated, the position of the model bounding box in the world coordinate system needs to be determined according to the camera orientation and the camera position. Such as the camera facing in the negative direction of the z-axis, it is necessary to take the negative of the calculated z-value and then initialize the z-axis to the model.
It is also necessary to calculate the maximum and minimum z-axis coordinates of the model because when the model is enlarged to a certain extent, the model slice will coincide with the view port of the camera, in which case the model will disappear from the view port, and the disappearing scene is shown in fig. 8.
Therefore, the position of the model bounding box is determined according to the orientation of the camera, and assuming that the calculated value of z is 100m, the camera is reversed and z is in the world coordinate systempositionIs-50, then the position of the model bounding box is 100+ 50-150 m; if z ispositionIs greater than 0, then the position of the model bounding box is 100 m.
In addition, the orientation of the camera can be dynamically planned, and default and custom camera orientations are supported, so that three-dimensional construction and model calibration are simpler and easier to use.
According to the method provided by the embodiment, the relative distance between the model bounding box and the camera is calculated according to the information of the model, so that the position of the model bounding box in a world coordinate system is determined, and no professional is required to operate, and anyone can edit the three-dimensional scene.
Referring to fig. 9, a schematic flow chart of still another optional three-dimensional scene construction method according to the embodiment of the present invention is shown, including the following steps:
s901: acquiring the moving speed of a camera, and calculating the ratio of the moving speed to the distance; wherein the distance is the distance between the camera and the model bounding box;
s902: and determining the actual distance between the measured camera and the model bounding box, and taking the product of the ratio and the actual distance as the moving speed of each point in the model information.
In the above embodiment, the present embodiment is used to initialize the model moving speed in steps S901 and S902. Model movement or camera movement, and the camera spacing from the model has a direct relationship: when the distance is long, the absolute displacement is 1m, and the displacement may only move 1cm in visual effect.
Therefore, in order to adapt to the visual effect, the moving speed of each point in the model needs to be adaptively adjusted according to the moving speed of the camera. Assuming that the distance between the camera and the model bounding box is z1, the actual measured distance between the camera and the model bounding box is z2, and the camera is referenced v1The moving speed v of the model bounding box can be obtained by moving with the speed (such as 2m/s)2Comprises the following steps:
Figure BDA0002800966640000121
the method provided by the embodiment can effectively avoid the problem of visual error of the imaging movement effect in the three-dimensional scene caused by different sizes and distances of the models. The speed of the model is fixed under the condition of no external force interference and cannot be changed until the scene is finished.
The method provided by the embodiment of the invention can assist beginners or non-professionals in setting reasonable three-dimensional scene basic information, and the problem that the model is not displayed in a three-dimensional scene due to misoperation is solved; initializing the model according to the basic information of the three-dimensional scene, giving a moving speed of the action captured by naked eyes, and increasing the calibration and the moving speed of the three-dimensional scene. The subjective initiative is integrally improved, tens of or even hundreds of repeated workloads can be replaced by a three-dimensional model building mode, and the marking cost is greatly reduced.
Referring to fig. 10, a schematic diagram of main modules of a three-dimensional scene building apparatus 1000 provided by an embodiment of the present invention is shown, including:
a bounding box construction module 1001, configured to load model information, obtain coordinate values of each point in the model information in a world coordinate system, and determine maximum values and minimum values on three coordinate axes to construct a model bounding box;
the position determining module 1002 is configured to acquire a position of the camera in a world coordinate system, and determine a position of the model bounding box in the world coordinate system by combining a camera view angle and a width and a height of the model bounding box;
and a scene building module 1003, configured to remove the model bounding box, obtain model information after the position is determined, integrate the model information with the three-dimensional scene basic information, and build a three-dimensional scene as an initialization parameter.
The apparatus further comprises a coordinate system constructing module 1004 (not shown) for:
constructing a coordinate system based on the camera view angle and a preset camera orientation; the coordinate system is used for building a three-dimensional scene and comprises a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
The device further includes a camera angle acquiring module 1005 (not shown) for:
acquiring a preset camera view angle; or
Initializing the three-dimensional scene basic information, determining the size of a viewport of the three-dimensional scene basic information, and processing the maximum value of the width and the height of the viewport in an arctangent mode to obtain the maximum visual angle of the camera on the height side as the visual angle of the camera.
In the device for implementing the present invention, the position determining module 1002 is configured to:
calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
judging whether the orientation of the camera is in the forward direction, if so, taking the sum of the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
And if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system.
In the device for implementing the present invention, the position determining module 1002 is configured to:
determining the maximum width value of the model bounding box, and calculating the minimum distance for displaying the maximum width value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
determining the maximum height value of the model bounding box, and calculating the minimum distance for displaying the maximum height value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
and taking the minimum distance with a larger value as the distance between the camera and the model bounding box.
The device for implementing the present invention further includes a moving speed calculating module 1004 (not shown in the figure) for:
acquiring the moving speed of a camera, and calculating the ratio of the moving speed to the distance;
and determining the actual distance between the measured camera and the model bounding box, and taking the product of the ratio and the actual distance as the moving speed of each point in the model information.
In addition, the detailed implementation of the device in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
FIG. 11 illustrates an exemplary system architecture 1100 to which embodiments of the invention may be applied.
As shown in fig. 11, the system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105 (merely an example). The network 1104 is a medium to provide communication links between the terminal devices 1101, 1102, 1103 and the server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 1101, 1102, 1103 to interact with a server 1105 over a network 1104 to receive or send messages or the like. Various communication client applications may be installed on the terminal devices 1101, 1102, 1103.
The terminal devices 1101, 1102, 1103 may be various electronic devices having a display screen and supporting web browsing, and the server 1105 may be a server providing various services.
It should be noted that the method provided by the embodiment of the present invention is generally executed by the server 1105, and accordingly, the apparatus is generally disposed in the server 1105.
It should be understood that the number of terminal devices, networks, and servers in fig. 11 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 12, shown is a block diagram of a computer system 1200 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit (CPU)1201, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. In the RAM 1203, various programs and data necessary for the operation of the system 1200 are also stored. The CPU 1201, ROM 1202, and RAM 1203 are connected to each other by a bus 1204. An input/output (I/O) interface 1205 is also connected to bus 1204.
The following components are connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 1201.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a bounding box construction module, a position determination module and a scene building module. The names of these modules do not in some cases form a limitation on the modules themselves, and for example, a scene building module may also be described as a "three-dimensional scene building module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
acquiring the position of a camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box;
and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
According to the technical scheme of the embodiment of the invention, a beginner or a non-professional can be assisted to set reasonable three-dimensional scene basic information, and the problem that a model is not displayed in a three-dimensional scene due to misoperation can be avoided; initializing the model according to the basic information of the three-dimensional scene, giving a moving speed of the action captured by naked eyes, and increasing the calibration and the moving speed of the three-dimensional scene. The subjective initiative is integrally improved, tens of or even hundreds of repeated workloads can be replaced by a three-dimensional model building mode, and the marking cost is greatly reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A three-dimensional scene building method is characterized by comprising the following steps:
loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
acquiring the position of a camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the visual angle of the camera and the width and height of the model bounding box;
and removing the model bounding box to obtain model information after the position is determined, and integrating the model information with the three-dimensional scene basic information to construct a three-dimensional scene as an initialization parameter.
2. The method of claim 1, prior to said loading model information, further comprising:
constructing a coordinate system based on the camera view angle and a preset camera orientation; the coordinate system is used for building a three-dimensional scene and comprises a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
3. The method of claim 2, further comprising, prior to said constructing a coordinate system based on said camera view angle and a preset camera orientation:
acquiring a preset camera view angle; or
Initializing the three-dimensional scene basic information, determining the size of a viewport of the three-dimensional scene basic information, and processing the maximum value of the width and the height of the viewport in an arctangent mode to obtain the maximum visual angle of the camera on the height side as the visual angle of the camera.
4. The method of claim 1, wherein the obtaining the position of the camera in the world coordinate system, and the determining the position of the model bounding box in the world coordinate system by combining the camera view angle and the width and height of the model bounding box comprises:
calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
judging whether the orientation of the camera is in the forward direction, if so, taking the sum of the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
And if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system.
5. The method of claim 4, wherein calculating a distance between a camera and the model bounding box according to the camera view angle and the width and height of the model bounding box comprises:
determining the maximum width value of the model bounding box, and calculating the minimum distance for displaying the maximum width value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
determining the maximum height value of the model bounding box, and calculating the minimum distance for displaying the maximum height value in the visible area of the camera by using an arc tangent mode in combination with the visual angle of the camera;
and taking the minimum distance with a larger value as the distance between the camera and the model bounding box.
6. The method of claim 4 or 5, further comprising, after said removing the model bounding box:
acquiring the moving speed of a camera, and calculating the ratio of the moving speed to the distance;
and determining the actual distance between the measured camera and the model bounding box, and taking the product of the ratio and the actual distance as the moving speed of each point in the model information.
7. A three-dimensional scene building device is characterized by comprising:
the bounding box construction module is used for loading model information, acquiring coordinate values of all points in the model information under a world coordinate system, and determining the maximum value and the minimum value on three coordinate axes to construct a model bounding box;
the position determining module is used for acquiring the position of the camera in a world coordinate system, and determining the position of the model bounding box in the world coordinate system by combining the camera view angle and the width and height of the model bounding box;
and the scene building module is used for removing the model bounding box, obtaining the model information after the position is determined, and integrating the model information by combining the three-dimensional scene basic information to build the three-dimensional scene as an initialization parameter.
8. The apparatus of claim 7, wherein the location determination module is configured to:
calculating the distance between the camera and the model bounding box according to the camera view angle and the width and the height of the model bounding box; wherein the distance representation enables a complete display of the model bounding box within a camera view area;
judging whether the orientation of the camera is in the forward direction, if so, taking the sum of the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
And if the direction is negative, taking the difference value between the position of the camera in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202011351115.7A 2020-11-26 2020-11-26 Three-dimensional scene building method and device Pending CN113781628A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011351115.7A CN113781628A (en) 2020-11-26 2020-11-26 Three-dimensional scene building method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011351115.7A CN113781628A (en) 2020-11-26 2020-11-26 Three-dimensional scene building method and device

Publications (1)

Publication Number Publication Date
CN113781628A true CN113781628A (en) 2021-12-10

Family

ID=78835235

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011351115.7A Pending CN113781628A (en) 2020-11-26 2020-11-26 Three-dimensional scene building method and device

Country Status (1)

Country Link
CN (1) CN113781628A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114842175A (en) * 2022-04-22 2022-08-02 如你所视(北京)科技有限公司 Interactive presentation method, device, equipment, medium and program product of three-dimensional label
CN116152444A (en) * 2023-04-04 2023-05-23 山东捷瑞信息技术产业研究院有限公司 Automatic adsorption method, device and medium for three-dimensional scene model based on digital twin
CN116740298A (en) * 2023-08-07 2023-09-12 山东捷瑞数字科技股份有限公司 Method for constructing scene real-time map based on three-dimensional engine

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017007254A1 (en) * 2015-07-08 2017-01-12 고려대학교 산학협력단 Device and method for generating and displaying 3d map
CN108629106A (en) * 2018-04-28 2018-10-09 北京仿真中心 Threedimensional model shield choosing method, system, computer equipment and readable medium
CN109887093A (en) * 2019-01-17 2019-06-14 珠海金山网络游戏科技有限公司 A kind of game level of detail processing method and system
WO2020006765A1 (en) * 2018-07-06 2020-01-09 深圳前海达闼云端智能科技有限公司 Ground detection method, related device, and computer readable storage medium
CN110796742A (en) * 2019-10-25 2020-02-14 西安建筑科技大学 Three-dimensional scene cone eliminating method based on object-oriented
CN111783820A (en) * 2020-05-08 2020-10-16 北京沃东天骏信息技术有限公司 Image annotation method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017007254A1 (en) * 2015-07-08 2017-01-12 고려대학교 산학협력단 Device and method for generating and displaying 3d map
CN108629106A (en) * 2018-04-28 2018-10-09 北京仿真中心 Threedimensional model shield choosing method, system, computer equipment and readable medium
WO2020006765A1 (en) * 2018-07-06 2020-01-09 深圳前海达闼云端智能科技有限公司 Ground detection method, related device, and computer readable storage medium
CN109887093A (en) * 2019-01-17 2019-06-14 珠海金山网络游戏科技有限公司 A kind of game level of detail processing method and system
CN110796742A (en) * 2019-10-25 2020-02-14 西安建筑科技大学 Three-dimensional scene cone eliminating method based on object-oriented
CN111783820A (en) * 2020-05-08 2020-10-16 北京沃东天骏信息技术有限公司 Image annotation method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
WANG, C等: "3D-like Bounding Box for Vehicle Detection", 2019 34RD YOUTH ACADEMIC ANNUAL CONFERENCE OF CHINESE ASSOCIATION OF AUTOMATION (YAC), 1 January 2019 (2019-01-01) *
武非凡;梁浩翔;宋焕生;贾金明;刘莅辰;: "基于相机标定的跨相机场景拼接方法", 计算机系统应用, no. 01, 15 January 2020 (2020-01-15) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114842175A (en) * 2022-04-22 2022-08-02 如你所视(北京)科技有限公司 Interactive presentation method, device, equipment, medium and program product of three-dimensional label
CN116152444A (en) * 2023-04-04 2023-05-23 山东捷瑞信息技术产业研究院有限公司 Automatic adsorption method, device and medium for three-dimensional scene model based on digital twin
CN116152444B (en) * 2023-04-04 2023-06-30 山东捷瑞信息技术产业研究院有限公司 Automatic adsorption method, device and medium for three-dimensional scene model based on digital twin
CN116740298A (en) * 2023-08-07 2023-09-12 山东捷瑞数字科技股份有限公司 Method for constructing scene real-time map based on three-dimensional engine
CN116740298B (en) * 2023-08-07 2024-04-26 山东捷瑞数字科技股份有限公司 Method for constructing scene real-time map based on three-dimensional engine

Similar Documents

Publication Publication Date Title
CN113781628A (en) Three-dimensional scene building method and device
CA3096601C (en) Presenting image transition sequences between viewing locations
El-Hakim et al. A multi-sensor approach to creating accurate virtual environments
US8115767B2 (en) Computer graphics shadow volumes using hierarchical occlusion culling
CN106846497B (en) Method and device for presenting three-dimensional map applied to terminal
US11557083B2 (en) Photography-based 3D modeling system and method, and automatic 3D modeling apparatus and method
US6741241B1 (en) Generating registration data for a virtual set
US20140192159A1 (en) Camera registration and video integration in 3d geometry model
Zollmann et al. Interactive 4D overview and detail visualization in augmented reality
CN108090952A (en) 3 d modeling of building method and apparatus
Kahn Reducing the gap between Augmented Reality and 3D modeling with real-time depth imaging
CN116310062A (en) Three-dimensional scene construction method and device, storage medium and electronic equipment
CN113870439A (en) Method, apparatus, device and storage medium for processing image
CN112734896A (en) Environment shielding rendering method and device, storage medium and electronic equipment
CN114187589A (en) Target detection method, device, equipment and storage medium
CN110930492B (en) Model rendering method, device, computer readable medium and electronic equipment
CN113129362B (en) Method and device for acquiring three-dimensional coordinate data
CN110378948B (en) 3D model reconstruction method and device and electronic equipment
CN113532266A (en) Box volume measuring method, system, equipment and storage medium based on three-dimensional vision
CN111915666A (en) Volume measurement method and device based on mobile terminal
CN115131507A (en) Image processing method, image processing apparatus, and three-dimensional reconstruction method of metauniverse
CN112150527B (en) Measurement method and device, electronic equipment and storage medium
KR20210149658A (en) Method for measuring Real length in 3D tour and 3D tour system therefor
CN114820968A (en) Three-dimensional visualization method and device, robot, electronic device and storage medium
CN114092645A (en) Visual building method and device of three-dimensional scene, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination