A three-dimensional scene construction method and device
By automatically determining the model position and camera angle, combined with the basic information of the 3D scene, it solves the problem of 3D scene construction in the existing technology that requires known parameters, realizes automatic 3D scene construction without configuring parameters, and reduces the difficulty and cost of construction.
Patent Information
- Application Number
- CN202011351115.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-11-26
AI Technical Summary
The existing technology requires all parameters to be known when building a three-dimensional scene, and lacks an automated and simple method to handle scene building with locally unknown parameters.
By loading model information, the coordinate values of the model in the world coordinate system are obtained, the model bounding box is constructed, and the model position is automatically determined based on the camera perspective and the width and height of the model bounding box, and the basic information of the 3D scene is integrated to initialize parameters to build the 3D scene.
There is no need to configure distance parameters and speed parameters, it can automatically calculate the model position, providing a simple and easy-to-use three-dimensional scene construction method, suitable for professionals and non-professionals.
Smart Images

Figure CN113781628B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a three-dimensional scene building method and device. Background Art
[0002] In the ARVR field, if you want to obtain better visual effects, only program rendering is not only computationally intensive, but also requires a huge workload for the position and corresponding matching relationship of the rendering model. Therefore, in most cases, you need to load an external model to achieve the corresponding effect. However, when loading the model, you need to fix the camera position, camera parameters, model position, model parameters, lighting and other information in advance, otherwise the model cannot be displayed in the visual scene according to the designed effect.
[0003] Currently, models are mainly calibrated and moved initialized through OpenGL or WebGL, but both methods have the following problems: in the process of building a 3D scene, all parameters such as the camera, model, displacement, etc. must be known. There are currently no specific cases and usage methods for building a 3D scene with locally unknown parameters. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a three-dimensional scene construction method and device, which can at least solve the problem in the prior art that all parameters must be known before a three-dimensional scene can be constructed.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a three-dimensional scene construction method is provided, comprising:
[0006] Load the model information, obtain the coordinate values of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box;
[0007] Obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box;
[0008] The model bounding box is removed to obtain the model information after the position is determined, and the model information is integrated with the basic information of the three-dimensional scene to be used as initialization parameters to build the three-dimensional scene.
[0009] Optionally, before loading the model information, the method further includes:
[0010] Based on the camera viewing angle and the preset camera orientation, a coordinate system is constructed; wherein the coordinate system is used to build a three-dimensional scene, including a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
[0011] Optionally, before constructing the coordinate system based on the camera viewing angle and the preset camera orientation, the method further includes:
[0012] Get a preset camera view angle; or
[0013] Initialize the basic information of the three-dimensional scene, determine the viewport size of the basic information of the three-dimensional scene, process the maximum value of the viewport width and height by using the inverse tangent method, and obtain the maximum viewing angle of the camera on the height side as the camera viewing angle.
[0014] Optionally, 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 in combination with the camera viewing angle and the width and height of the model bounding box includes:
[0015] Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area;
[0016] Determine whether the camera is facing forward. If it is facing forward, use the sum of the camera position in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
[0017] If it is negative, the difference between 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.
[0018] Optionally, calculating the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box includes:
[0019] Determine the maximum width value of the model bounding box, and calculate the minimum distance to display the maximum width value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0020] Determine the maximum height value of the model bounding box, and calculate the minimum distance to display the maximum height value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0021] The smallest distance with the larger value is used as the distance between the camera and the bounding box of the model.
[0022] Optionally, after removing the model bounding box, the method further includes:
[0023] Obtaining the moving speed of the camera, and calculating the ratio of the moving speed to the distance;
[0024] The measured actual distance between the camera and the model bounding box is determined, and the product of the ratio and the actual distance is used as the moving speed of each point in the model information.
[0025] To achieve the above object, according to another aspect of an embodiment of the present invention, a three-dimensional scene construction device is provided, comprising:
[0026] The bounding box construction module is used to load the model information, obtain the coordinate values of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box;
[0027] A position determination module, used to obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box;
[0028] The scene building module is used to remove the model bounding box, obtain the model information after the position is determined, and integrate it with the basic information of the three-dimensional scene to build the three-dimensional scene as an initialization parameter.
[0029] Optionally, a coordinate system construction module is also included, which is used to: construct a coordinate system based on the camera viewing angle and a preset camera orientation; wherein the coordinate system is used to build a three-dimensional scene, including a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
[0030] Optionally, a camera viewing angle acquisition module is also included, which is used to:
[0031] Get a preset camera view angle; or
[0032] Initialize the basic information of the three-dimensional scene, determine the viewport size of the basic information of the three-dimensional scene, process the maximum value of the viewport width and height by using the inverse tangent method, and obtain the maximum viewing angle of the camera on the height side as the camera viewing angle.
[0033] Optionally, the location determination module is used to:
[0034] Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area;
[0035] Determine whether the camera is facing forward. If it is facing forward, use the sum of the camera position in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
[0036] If it is negative, the difference between 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.
[0037] Optionally, the location determination module is used to:
[0038] Determine the maximum width value of the model bounding box, and calculate the minimum distance to display the maximum width value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0039] Determine the maximum height value of the model bounding box, and calculate the minimum distance to display the maximum height value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0040] The smallest distance with the larger value is used as the distance between the camera and the bounding box of the model.
[0041] Optionally, a moving speed calculation module is also included, which is used to:
[0042] Obtaining the moving speed of the camera, and calculating the ratio of the moving speed to the distance;
[0043] The measured actual distance between the camera and the model bounding box is determined, and the product of the ratio and the actual distance is used as the moving speed of each point in the model information.
[0044] To achieve the above objective, according to another aspect of an embodiment of the present invention, a three-dimensional scene building electronic device is provided.
[0045] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device 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 implement any of the above-mentioned three-dimensional scene building methods.
[0046] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned three-dimensional scene building methods is implemented.
[0047] According to the solution provided by the present invention, an embodiment of the above invention has the following advantages or beneficial effects: there is no need to configure distance parameters and speed parameters during the model loading process, and the model position can be automatically calculated, providing a simple and easy-to-use three-dimensional scene construction method for professional three-dimensional scene builders and non-professionals.
[0048] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0050] Figure 1 This is a schematic diagram of the main process of a three-dimensional scene building method according to an embodiment of the present invention;
[0051] Figure 2 It is a schematic diagram of four coordinate systems constructed based on camera parameters;
[0052] Figure 3(a) is a schematic diagram of the style of the model bounding box;
[0053] FIG3( b ) is a schematic diagram of a specific application;
[0054] Figure 4 is a flow chart of an optional three-dimensional scene construction method according to an embodiment of the present invention;
[0055] Figure 5 It is a two-dimensional schematic diagram for calculating the camera's viewing angle;
[0056] Figure 6 is a flow chart of another optional three-dimensional scene construction method according to an embodiment of the present invention;
[0057] Figure 7 is a schematic diagram for calculating the distance between the camera and the bounding box of the model;
[0058] Figure 8 It is a schematic diagram of the overlap between the model section and the camera viewport;
[0059] Fig. 9 Schematic diagram of another optional three-dimensional scene construction method according to an embodiment of the present invention
[0060] Fig.10 2 is a schematic diagram of main modules of a three-dimensional scene building device according to an embodiment of the present invention;
[0061] Fig.11 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0062] Fig.12 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0064] The following is a detailed description of the problems existing in the prior art:
[0065] 1. The main problems of model calibration
[0066] 1) The 3D models created by model creation tools such as 3D max, maya, and Blender only contain the basic information of the model itself, and do not contain information such as camera position and camera parameters. Data import requires the model designer to provide parameter information, otherwise the camera position needs to be calibrated through testing.
[0067] 2) In a single-camera, multi-model 3D scene, even if the camera is fixed, the model position calibration is more complicated due to the parameters of different models. Each model is a separate individual, so there will be a certain error in the calibration of each model position. Multiple calibration errors may make the entire 3D scene chaotic.
[0068] 3) When calibrating the position of a 3D scene model, since the 3D imaging must be displayed in the camera viewport, the 3D data that is not in the viewport cannot be displayed in the scene. Therefore, the 3D model needs to be calibrated in the scene where the model is displayed.
[0069] 2. The main problems with mobile speed initialization
[0070] 1) There is no quantitative indicator for the model's movement speed, which is a fixed value set through human senses;
[0071] 2) The different sizes of models lead to a large difference between the speed of model movement or camera movement and the speed of visual understanding;
[0072] 3) When the vibration speed of the light is the same as the moving speed of the object, a continuous vision phenomenon will occur. In this scenario, the naked eye cannot capture the movement of the object or model. Therefore, if the distance is far and the model moves slowly, the microscopic deviation of the model cannot be captured by the naked eye.
[0073] 3. The main problems with camera parameter settings
[0074] 1) The camera’s viewing angle is usually fixed by professionals, and the image can only be taken within a specific viewing angle area. It is difficult for non-professionals to understand the concept of viewing angle;
[0075] 2) In addition to the camera viewing angle, the camera orientation also needs to be considered. Different camera orientations produce completely different visual images, which is not considered in the prior art.
[0076] See also Figure 1 , which shows a main flow chart of a three-dimensional scene construction method provided by an embodiment of the present invention, comprising the following steps:
[0077] S101: Loading model information, obtaining coordinate values of each point in the model information in the world coordinate system, determining the maximum and minimum values on the three coordinate axes, and constructing a model bounding box;
[0078] S102: 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 viewing angle and the width and height of the model bounding box;
[0079] S103: removing the model bounding box, obtaining the model information after the position is determined, and integrating it with the basic information of the three-dimensional scene to use it as initialization parameters to build the three-dimensional scene.
[0080] In the above implementation, this solution is applicable to a variety of scenarios, such as AR shoe fitting and AR makeup fitting projects, and can obtain relatively accurately labeled 3D samples. It is necessary to use 3D models (Note: 3D models include ply, stl, obj, vtk, etc.) to label the labeled area of 2D images. However, the 3D model only saves the 3D data information of the model itself, and does not save the scene information and camera parameter information. Therefore, in order to improve the versatility of labeling, this solution proposes a 3D scene model calibration method.
[0081] For step S101, the basic information of the 3D scene is first initialized, that is, the length, width, lighting, renderer and other information of the scene need to be specified first. The basic information of the 3D scene can determine the camera angle, see the following Figure 4 Description shown.
[0082] Dynamically load custom or predefined camera parameters. Camera parameters mainly define the camera's illumination direction and camera viewing angle. Create a coordinate system based on camera parameters. For details, see Figure 2 As shown, there are four coordinate systems in the camera, namely the world coordinate system, the camera coordinate system, the image coordinate system, and the pixel coordinate system:
[0083] 1) The world coordinate system can arbitrarily specify the horizontal and vertical axes, Figure 2 The coordinate system where point P is located can also be understood as the xyz coordinate system corresponding to the model parameters;
[0084] 2) The origin of the camera coordinate system is located at the pinhole, the z-axis coincides with the optical axis, and the x-axis and y-axis are parallel to the projection plane, which is the coordinate system X in the figure above. c Y c Z c ;
[0085] 3) The origin of the image coordinate system is located at the intersection of the optical axis and the projection plane. The axis is parallel to the projection plane, which is the coordinate system of the above figure. p y p z;
[0086] 4) The pixel coordinate system looks from the small hole to the projection surface, with the upper left corner of the projection surface as the origin, and the UV axis coincides with both sides of the projection surface. This coordinate system is in the same plane as the image coordinate system, but has a different origin.
[0087] Load the model information and obtain the coordinate values of each point in the model in the world coordinate system to determine the maximum and minimum values of the three coordinate axes X, Y, and Z. Construct the model bounding box based on the maximum and minimum values. The specific box style parameters are shown in Figure 3(a).
[0088] For step S102, the obj model is loaded. The obj model used in this solution is drawn using the 3Dmax tool. When drawing, the camera is usually placed at the (0,0,0) point in the three-dimensional world coordinate system (it can actually be other points), facing the negative or positive direction of the z-axis.
[0089] Draw the 3D model that needs to be annotated according to the visual distance. To make the model image in the 3D scene, it is necessary to calculate the distance from the camera to the model bounding box, and determine the position of the model bounding box in the world coordinate system according to the camera viewing angle (or elevation angle). For the specific calculation method, see the following Figure 6 The description shown is not repeated here.
[0090] For step S103, after the position of the model bounding box in the world coordinate system is calculated, the model has been constructed. At this time, the model bounding box can be removed and only the information of each point in the model is considered.
[0091] Building a 3D scene depends on model information and 3D scene basic information, so these two can be used as initialization parameters to build the 3D scene. The built scene can be further used later, and can be applied to application scenarios such as 3D annotation, game scene initialization, and 3D product initialization, as shown in Figure 3(b). The specific use is a common method in this field, and this solution will not be repeated here.
[0092] The method provided in the above embodiment does not need to configure distance parameters during the model loading process and can automatically calculate the model position, providing a simple and easy-to-use 3D scene construction method for professional 3D scene builders and non-professionals.
[0093] See also Figure 4 , shows a schematic flow chart of an optional three-dimensional scene construction method according to an embodiment of the present invention, comprising the following steps:
[0094] S401: Initializing basic information of a three-dimensional scene, determining a viewport size of the three-dimensional scene basic information, processing the maximum value of the viewport width and height by an inverse tangent method, and obtaining a maximum viewing angle of the camera on the height side as the camera viewing angle;
[0095] S402: constructing a coordinate system based on the camera viewing angle and a preset camera orientation; wherein the coordinate system is used to build a three-dimensional scene, including a world coordinate system, a camera coordinate system, an image coordinate system, and a pixel coordinate system;
[0096] S403: Loading model information, obtaining coordinate values of each point in the model information in the world coordinate system, determining the maximum and minimum values on the three coordinate axes, and constructing a model bounding box;
[0097] S404: Obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box;
[0098] S405: removing the model bounding box, obtaining the model information after the position is determined, and integrating it with the basic information of the three-dimensional scene to use it as an initialization parameter to build a three-dimensional scene.
[0099] In the above implementation, for steps S402 to S405, see Figure 1 The description of steps S101 to S103 is not repeated here.
[0100] In the above implementation, for step S401, this implementation is used to determine the camera viewing angle. There are currently two ways to determine the camera viewing angle. One is artificially preset, such as 45° and 60° commonly used in the industry. The other is determined based on the basic information of the three-dimensional scene. The specific calculation method is:
[0101] To ensure that the 2D scene can be fully imaged in the camera viewport (the camera usually sees 2D when viewing), you can define that the size of the camera's viewing angle is calculated based on the height and width of the 3D base scene. Figure 5 As shown, the calculation formula of the viewing angle is:
[0102]
[0103] It should be noted that the height and width here are the maximum values of the height and width in the three-dimensional scene (the same applies when the image is used as the background of the scene). It is just a default camera perspective calculated based on the height and width.
[0104] Since the camera perspective in three.js is in degrees, we only care about the elevation angle of the height, so we need to convert radians into degrees and set the elevation angle of the camera width according to the elevation angle of the height and the ratio of the width to the height. Therefore, the complete calculation formula is:
[0105]
[0106] Among them, PI is pi, Math.PI represents the ratio of the circumference of a circle to its diameter, which is approximately 3.14159.
[0107] The method provided in the above embodiment is applicable to multi-model scenes, and can unify the calculation method of camera perspective based on the basic information of the three-dimensional scene, thereby minimizing the error perspective. The camera perspective is preset or automatically created to achieve the purpose of automatic calibration and reduce the difficulty of scene construction.
[0108] See also Figure 6 , shows a schematic flow chart of another optional three-dimensional scene construction method according to an embodiment of the present invention, comprising the following steps:
[0109] S601: Loading model information, obtaining coordinate values of each point in the model information in the world coordinate system, determining the maximum and minimum values on the three coordinate axes, and constructing a model bounding box;
[0110] S602: Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area;
[0111] S603: Determine whether the camera is facing forward;
[0112] S604: If it is positive, 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;
[0113] S605: If it is negative, taking the difference 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;
[0114] S606: removing the model bounding box, obtaining the model information after the position is determined, and integrating it with the basic information of the three-dimensional scene to use it as an initialization parameter to build a three-dimensional scene.
[0115] In the above implementation, for steps S601 and S606, see Figure 1 The description of steps S101 and S103 is not repeated here.
[0116] In the above implementation, for step S602, the camera viewing angle is known to be fov, so the imaging of the model in the three-dimensional scene needs to determine the maximum and minimum values of the model bounding box on the X and Y axes according to the previous step, and determine the value with the maximum absolute value max=Max(width,height).
[0117] Specifically:
[0118] Determine the maximum width of the model bounding box, combine the camera perspective, and use the inverse tangent method to calculate the distance of the maximum width value displayed in the camera visible area max width / [2*arctan(fov)]
[0119] Determine the maximum height of the model bounding box, and use the inverse tangent method to calculate the distance of the maximum height value displayed in the camera's visible area, max height / [2*arctan(fov)];
[0120] The larger distance is used as the distance between the camera and the model bounding box, see Figure 7 shown.
[0121] For steps S603 to S605, after calculating the distance between the camera and the model bounding box, the position of the model bounding box in the world coordinate system needs to be determined according to the camera orientation and camera position. For example, if the camera is facing the negative direction of the z-axis, the calculated z value needs to be negative, and then the z-axis needs to be initialized to the model.
[0122] At the same time, you also need to calculate the maximum and minimum z-axis coordinates of the model, because when the model is enlarged to a certain extent, the model section will coincide with the camera viewport. In this case, the model will disappear from the viewport. See the disappearance scene. Figure 8 shown.
[0123] Therefore, the position of the model bounding box needs to be determined according to the camera orientation. Assume that the calculated value of z is 100m, and the camera is reversed and in the world coordinate system z position The position of z is -50, then the position of the model bounding box is 100+50=150m; if z position If the minimum value of is greater than 0, the position of the model bounding box is 100m.
[0124] In addition, the camera orientation can also be dynamically planned, supporting default and custom camera orientations, making 3D construction and model calibration simpler and easier to use.
[0125] The method provided in the above embodiment calculates the relative distance between the model bounding box and the camera based on the model's own information, thereby determining the position of the model bounding box in the world coordinate system. No professional operation is required, and anyone can edit the three-dimensional scene.
[0126] See also Fig. 9 , shows a schematic flow chart of another optional three-dimensional scene construction method according to an embodiment of the present invention, comprising the following steps:
[0127] S901: Obtain the moving speed of the camera, and calculate the ratio of the moving speed to the distance; wherein the distance is the distance between the camera and the bounding box of the model;
[0128] S902: Determine the measured actual distance between the camera and the model bounding box, and use the product of the ratio and the actual distance as the moving speed of each point in the model information.
[0129] In the above implementation, for steps S901 and S902, this implementation is used to initialize the model movement speed. The movement of the model or the camera is directly related to the distance between the camera and the model: when the distance is far, an absolute displacement of 1m may only move 1cm in visual effect.
[0130] 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 camera moving speed. 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 moves at a speed of v1 (such as 2m / s), the moving speed v2 of the model bounding box can be obtained as:
[0131]
[0132] The method provided in the above embodiment can effectively avoid the visual error problem of the moving effect of imaging in the three-dimensional scene due to different model sizes and different distances. The speed here is fixed without external force intervention and will not change until the end of the scene.
[0133] The method provided by the embodiment of the present invention can assist beginners or non-professionals in setting reasonable basic information of the three-dimensional scene, and will not cause the problem of the model not being displayed in the three-dimensional scene due to misoperation; initialize the model according to the basic information of the three-dimensional scene, give a moving speed that can be captured by the naked eye, and increase the three-dimensional scene calibration and moving speed. Overall, the subjective initiative is improved, and a three-dimensional model construction method can replace dozens or even hundreds of repeated workloads, greatly reducing the labeling cost.
[0134] See also Fig.10 , showing a schematic diagram of main modules of a three-dimensional scene building device 1000 provided in an embodiment of the present invention, including:
[0135] The bounding box construction module 1001 is used to load the model information, obtain the coordinate value of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box;
[0136] The position determination module 1002 is used to obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box;
[0137] The scene building module 1003 is used to remove the model bounding box, obtain the model information after the position is determined, and integrate it with the basic information of the three-dimensional scene to use it as an initialization parameter to build a three-dimensional scene.
[0138] The implementation device of the present invention further includes a coordinate system construction module 1004 (not shown in the figure), which is used to:
[0139] Based on the camera viewing angle and the preset camera orientation, a coordinate system is constructed; wherein the coordinate system is used to build a three-dimensional scene, including a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
[0140] The implementation device of the present invention further includes a camera viewing angle acquisition module 1005 (not shown in the figure), which is used to:
[0141] Get a preset camera view angle; or
[0142] Initialize the basic information of the three-dimensional scene, determine the viewport size of the basic information of the three-dimensional scene, process the maximum value of the viewport width and height by using the inverse tangent method, and obtain the maximum viewing angle of the camera on the height side as the camera viewing angle.
[0143] In the implementation device of the present invention, the location determination module 1002 is used to:
[0144] Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area;
[0145] Determine whether the camera is facing forward. If it is facing forward, use the sum of the camera position in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system; or
[0146] If it is negative, the difference between 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.
[0147] In the implementation device of the present invention, the location determination module 1002 is used to:
[0148] Determine the maximum width value of the model bounding box, and calculate the minimum distance to display the maximum width value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0149] Determine the maximum height value of the model bounding box, and calculate the minimum distance to display the maximum height value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle;
[0150] The smallest distance with the larger value is used as the distance between the camera and the bounding box of the model.
[0151] The implementation device of the present invention further includes a moving speed calculation module 1004 (not shown in the figure), which is used to:
[0152] Obtaining the moving speed of the camera, and calculating the ratio of the moving speed to the distance;
[0153] The measured actual distance between the camera and the model bounding box is determined, and the product of the ratio and the actual distance is used as the moving speed of each point in the model information.
[0154] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.
[0155] Fig.11 An exemplary system architecture 1100 is shown in which embodiments of the present invention may be applied.
[0156] like Fig.11 As shown, system architecture 1100 may include terminal devices 1101, 1102, 1103, network 1104 and server 1105 (just an example). Network 1104 is used to provide a medium for communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0157] The user can use the terminal devices 1101, 1102, 1103 to interact with the server 1105 through the network 1104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 1101, 1102, 1103.
[0158] The terminal devices 1101 , 1102 , and 1103 may be various electronic devices having display screens and supporting web browsing, and the server 1105 may be a server providing various services.
[0159] It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 1105 , and accordingly, the device is generally set in the server 1105 .
[0160] It should be understood that Fig.11 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0161] Reference below Fig.12 , which shows a schematic diagram of the structure of a computer system 1200 of a terminal device suitable for implementing an embodiment of the present invention. Fig.12 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0162] like Fig.12As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the system 1200 are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0163] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 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, etc., is installed on the drive 1210 as needed, so that a computer program read therefrom is installed into the storage section 1208 as needed.
[0164] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the system of the present invention are executed.
[0165] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0166] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0167] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a bounding box construction module, a position determination module, and a scene construction module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the scene construction module may also be described as a "three-dimensional scene construction module".
[0168] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0169] Load the model information, obtain the coordinate values of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box;
[0170] Obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box;
[0171] The model bounding box is removed to obtain the model information after the position is determined, and the model information is integrated with the basic information of the three-dimensional scene to be used as initialization parameters to build the three-dimensional scene.
[0172] According to the technical solution of the embodiment of the present invention, beginners or non-professionals can be assisted to set reasonable basic information of the 3D scene, and the problem of the model not being displayed in the 3D scene due to misoperation will not occur; the model is initialized according to the basic information of the 3D scene, and a moving speed that can be captured by the naked eye is given, so as to increase the 3D scene calibration and moving speed. The overall subjective initiative is improved, and a 3D model construction method can replace dozens or even hundreds of repeated workloads, greatly reducing the labeling cost.
[0173] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A three-dimensional scene construction method, characterized in that: include: Load the model information, obtain the coordinate values of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box; 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 viewing angle and the width and height of the model bounding box, including: Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area; Determine whether the camera is facing forward. If so, take the sum of the camera position in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system. If it is negative, the difference between 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; The model bounding box is removed to obtain the model information after the position is determined, and the model information is integrated with the basic information of the three-dimensional scene to be used as initialization parameters to build the three-dimensional scene.
2. The method according to claim 1, characterized in that: Before loading the model information, the method further includes: Based on the camera viewing angle and the preset camera orientation, a coordinate system is constructed; wherein the coordinate system is used to build a three-dimensional scene, including a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system.
3. The method according to claim 2, characterized in that Before constructing the coordinate system based on the camera viewing angle and the preset camera orientation, the method further includes: Get a preset camera view angle; or Initialize the basic information of the three-dimensional scene, determine the viewport size of the basic information of the three-dimensional scene, process the maximum value of the viewport width and height by using the inverse tangent method, and obtain the maximum viewing angle of the camera on the height side as the camera viewing angle.
4. The method according to claim 1, characterized in that: The calculating the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box includes: Determine the maximum width value of the model bounding box, and calculate the minimum distance to display the maximum width value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle; Determine the maximum height value of the model bounding box, and calculate the minimum distance to display the maximum height value in the camera visible area by using the inverse tangent method in combination with the camera viewing angle; The smallest distance with the larger value is used as the distance between the camera and the bounding box of the model.
5. The method according to claim 1 or 4, characterized in that: After removing the model bounding box, the method further includes: Obtaining the moving speed of the camera, and calculating the ratio of the moving speed to the distance; The measured actual distance between the camera and the model bounding box is determined, and the product of the ratio and the actual distance is used as the moving speed of each point in the model information.
6. A three-dimensional scene construction device, characterized in that: include: The bounding box construction module is used to load the model information, obtain the coordinate values of each point in the model information in the world coordinate system, determine the maximum and minimum values on the three coordinate axes, and construct the model bounding box; The position determination module is used to obtain the position of the camera in the world coordinate system, and determine the position of the model bounding box in the world coordinate system by combining the camera viewing angle and the width and height of the model bounding box, including: Calculate the distance between the camera and the model bounding box according to the camera viewing angle and the width and height of the model bounding box; wherein the distance indicates that the model bounding box can be fully displayed within the camera visible area; Determine whether the camera is facing forward. If so, take the sum of the camera position in the world coordinate system and the distance as the position of the model bounding box in the world coordinate system. If it is negative, the difference between 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; The scene building module is used to remove the model bounding box, obtain the model information after the position is determined, and integrate it with the basic information of the three-dimensional scene to build the three-dimensional scene as an initialization parameter.
7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Three-dimensional model shielding body selecting method and system, computer equipment and readable medium
CN108629106A
A game detail level processing method and system
CN109887093A
Object-oriented three-dimensional scene view cone removing method
CN110796742A
Image annotation method and device
CN111783820A
Device and method for generating and displaying 3D map
WO2017007254A1
