Methods for Correcting and Encrypting Space Coordinates of Three-Dimensional Model
20220414982 · 2022-12-29
Assignee
Inventors
- Zejun Xiang (Chongqing, CN)
- Zhiyong Zhou (Chongqing, CN)
- Yan Zhang (Chongqing, CN)
- Liangchao Chen (Chongqing, CN)
- Kaiquan Hu (Chongqing, CN)
- Hong MA (Chongqing, CN)
- Junqian Zhang (Chongqing, CN)
Cpc classification
G06T19/20
PHYSICS
G06F17/16
PHYSICS
International classification
G06F17/16
PHYSICS
Abstract
The present disclosure provides a method for correcting and encrypting space coordinates of a three-dimensional model. The method for correcting space coordinates of a three-dimensional model includes: step S1, reading information of an original coordinate frame of a three-dimensional model in a first format and the origin of coordinates of the model; reading information of nodes from three-dimensional model data in the first format, and calculating original coordinates of the nodes; step S2, calculating parameters of correction between the original coordinate frame and a target coordinate frame based on space coordinates of four or more control points in the original coordinate frame in the first format and corresponding space coordinates of the control points in the target coordinate frame in a second format, and constructing a space coordinate correction matrix; step S3, transforming and correcting the coordinates of the origin and nodes of the three-dimensional model in the first format one by one by using the space coordinate correction matrix to obtain information of coordinate points of the three-dimensional model in the second format; and step S4, storing a file of the three-dimensional model in the second format with corrected space coordinates. Thus, the production efficiency is improved.
Claims
1. A method for correcting space coordinates of a three-dimensional model, comprising: step S1, reading information of an original coordinate frame of a three-dimensional model in a first format produced based on a reality modeling system and the origin of coordinates of the model; reading information of nodes from three-dimensional model data in the first format, and calculating original coordinates of the nodes; step S2, calculating parameters of correction between the original coordinate frame and a target coordinate frame based on space coordinates of four or more control points in the original coordinate frame in the first format and corresponding space coordinates of the four or more control points in the target coordinate frame in a second format, and constructing a space coordinate correction matrix, wherein the control points are noncoplanar arbitrary points in regions of the three-dimensional model; step S3, transforming and correcting the coordinates of the origin and nodes of the three-dimensional model in the first format one by one by using the space coordinate correction matrix to obtain information of coordinate points of the three-dimensional model in the second format; and step S4, storing a file of the three-dimensional model in the second format with corrected space coordinates.
2. The method for correcting space coordinates of a three-dimensional model according to claim 1, wherein step S2 further comprises the following steps to calculate the parameters of correction between the original coordinate frame in the first format and the target coordinate frame and construct the space coordinate correction matrix: step S21, obtaining the space coordinates of the four or more control points in the regions of the three-dimensional model in the original coordinate frame in the first format and the space coordinates of the control points in the target coordinate frame in the second format, and establishing a mathematical model for correction between the original coordinate frame and the target coordinate frame; step S22, inputting the obtained space coordinates of the control points in the original coordinate frame and in the target coordinate frame into the mathematical model for correction to calculate the parameters of correction; and step S23, constructing the space coordinate correction matrix with the parameters of correction calculated in step S22.
3. The method for correcting space coordinates of a three-dimensional model according to claim 2, wherein the mathematical model for correction established in step S21 is shown below: the mathematical model for correction between the original coordinate frame and the target coordinate frame is established in the form of a seven-parameter model shown in formula (1); a general form of the mathematical model for correction is as shown in formula (2); seven parameters are introduced into the model, including three translation parameters X.sub.0, Y.sub.0 and Z.sub.0 that denote coordinate differences between the origins of coordinates of two space coordinate frames, three rotation parameters Ε.sub.x, Ε.sub.y and Ε.sub.z that are used for orderly rotating three coordinate axes such that X-, Y- and Z-axes of two space rectangular coordinate frames coincide, and one scale parameter m that denotes a ratio of lengths of a same straight line segment in two space coordinate frames to allow scale transformation;
4. The method for correcting space coordinates of a three-dimensional model according to claim 2, wherein orthographic projection or back projection is performed based on corresponding reference frames for the coordinate frame in the first format and the coordinate frame in the second format before and after transformation, respectively.
5. The method for correcting space coordinates of a three-dimensional model according to claim 2, wherein in step S22, the parameters of correction are calculated by using a least square method.
6. The method for correcting space coordinates of a three-dimensional model according to claim 1, wherein in step S1, the three-dimensional model in the first format is a three-dimensional model in OpenSceneGraph Binary Scene Data (OSGB) format produced based on ContextCapture reality modeling system; and step S1 specifically comprises: reading the information of the original coordinate frame of the three-dimensional model in OSGB format and the origin of coordinates of the model; reading information of nodes from three-dimensional model data in the first format, and calculating original coordinates of the nodes; reading data of tiles of the three-dimensional model in OSGB format one by one, obtaining information of pagelod nodes in the tiles, and calculating original coordinates of the pagelod nodes.
7. The method for correcting space coordinates of a three-dimensional model according to claim 6, wherein in step S1, the original coordinates of each of the pagelod nodes in the tiles of the three-dimensional model in OSGB format are calculated according to the following formula: original coordinates of a pagelod node=coordinates of the origin of the model+coordinates of a geometric coordinate point.
8. The method for correcting space coordinates of a three-dimensional model according to claim 7, wherein in step S3, the coordinates of the origin of the three-dimensional model and the pagelod nodes of the tiles are transformed and corrected one by one by using the space coordinate correction matrix.
9. The method for correcting space coordinates of a three-dimensional model according to claim 8, wherein step S3 specifically comprises the following steps: step S31, performing space coordinate correction on pagelod original coordinates based on the space coordinate correction matrix to obtain corrected pagelod space coordinates and corrected space coordinates of the origin of the three-dimensional model; and step S32, after the pagelod space coordinate correction is completed, calculating the coordinates of a geometric coordinate point with the corrected pagelod space coordinates and the corrected space coordinates of the origin of the three-dimensional model obtained in step S31 according to the following formula: coordinates of a geometric coordinate point=corrected pagelod space coordinates−corrected space coordinates of the origin of the three-dimensional model.
10. A method for encrypting space coordinates of a three-dimensional model, wherein original space coordinates are encrypted by coordinate transformation using the method for correcting space coordinates of a three-dimensional model according to any one of claims 1 to 9.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0033] To describe the technical solutions in embodiments of the present disclosure or in the prior art more clearly, the accompanying drawings needed in the embodiments will be introduced below briefly. Apparently, the accompanying drawings in the following description show merely some embodiments of the present disclosure, and other drawings can be derived from these accompanying drawings by those of ordinary skill in the art without creative efforts.
[0034]
DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] The embodiments of the present disclosure will be described below in detail. Examples of the embodiments are shown in the accompanying drawings. The same or similar reference numerals represent the same or similar elements or elements having the same or similar function throughout the description. The examples described below with reference to the accompanying drawings are exemplary, and are only used to explain the present disclosure but should not be construed as a limitation to the present disclosure.
[0036] It should be understood that in the description of the present disclosure, orientations or positional relationships indicated by terms such as “longitudinal”, “transverse”, “upper”, “lower”, “front”, “rear”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside” and “outside” are all based on what are illustrated in the drawings, and such terms are used herein for ease and simplification of description of the present disclosure rather than indicating or implying that the stated device or element must have a specific orientation or must be constructed and operated in a specific orientation, and thus cannot be construed as limitations to the present disclosure.
[0037] In the description of the present disclosure, it should be noted that, unless otherwise clearly specified and defined, meanings of terms “install”, “interconnect”, and “connect” should be understood in a board sense. For example, the connection may be a mechanical connection or an electrical connection, intercommunication between two components, a direct connection, or an indirect connection by using an intermediate medium. A person of ordinary skill in the art will understand specific meanings of such terms based on a specific situation.
EXAMPLE 1
[0038] As shown in
[0039] step S1, read information of an original coordinate frame of a three-dimensional model in a first format produced based on a reality modeling system and the origin of coordinates of the three-dimensional model in the first format; read information of nodes from three-dimensional model data in the first format, and calculate original coordinates of the nodes;
[0040] step S2, calculate parameters of correction between the original coordinate frame and a target coordinate frame based on space coordinates of four or more control points in the original coordinate frame in the first format and corresponding space coordinates of the four or more control points in the target coordinate frame in a second format, and construct a space coordinate correction matrix, where the control points are noncoplanar arbitrary points in regions of the three-dimensional model;
[0041] step S3, transform and correct the coordinates of the origin and nodes of the three-dimensional model in the first format one by one by using the space coordinate correction matrix to obtain information of coordinate points of the three-dimensional model in the second format; and
[0042] step S4, store a file of the three-dimensional model in the second format with corrected space coordinates.
[0043] Step S2 further includes the following steps to calculate the parameters of correction between the original coordinate frame in the first format and the target coordinate frame and construct the space coordinate correction matrix:
[0044] step S21, obtain the space coordinates of the four or more control points in the regions of the three-dimensional model in the original coordinate frame in the first format and the space coordinates of the control points in the target coordinate frame in the second format, and establish a mathematical model for correction between the original coordinate frame and the target coordinate frame;
[0045] step S22, input the obtained space coordinates of the control points in the original coordinate frame and in the target coordinate frame into the mathematical model for correction to calculate the parameters of correction; and
[0046] step S23, construct the space coordinate correction matrix with the parameters of correction calculated in step S22. The parameters of correction include translation parameters (X.sub.0, Y.sub.0 and Z.sub.0), rotation parameters (Ε.sub.x, Ε.sub.y and Ε.sub.z) and scale parameter m. The space coordinate correction matrix contains the above-mentioned seven parameters of correction.
[0047] In a preferred embodiment of the present disclosure, in step S21, the four or more control points in the regions of the three-dimensional model can be collected from existing control point data or measured from the three-dimensional model. Higher space coordinate correction accuracy can be achieved with more control points that are distributed more uniformly.
[0048] The mathematical model for correction established in step S21 is shown below:
[0049] The original coordinate frame in the first format and the target coordinate frame in the second format have the problems of inconsistent origins, unparallel coordinate axes and/or inconsistent scales. The mathematical model for correction between the original coordinate frame and the target coordinate frame is typically established in the form of a seven-parameter model shown in formula (1); and a general form of the mathematical model for correction is as shown in formula (2). Seven parameters are introduced into the mathematical model for correction, including: three translation parameters X.sub.0, Y.sub.0 and Z.sub.0, X.sub.0, Y.sub.0 and Z.sub.0denoting coordinate differences between the origins of coordinates of two space coordinate frames, Xo denoting a difference between X-axes of two space coordinate frames, Yo denoting a difference between Y-axes of two space coordinate frames and Zo denoting a difference between Z-axes of two space coordinate frames; three rotation parameters Ε.sub.x, Ε.sub.y and Ε.sub.z that are used for orderly rotating three coordinate axes such that X-, Y- and Z-axes of two space rectangular coordinate frames coincide; and one scale parameter m that denotes a ratio of lengths of a same straight line segment in two space coordinate frames to allow scale transformation.
[0050] where X.sub.1, Y.sub.1 and Z.sub.1 denote the space coordinates in the original coordinate frame in the first format, and X.sub.2, Y.sub.2 and Z.sub.2 denote the space coordinates in the target coordinate frame in the second format; and the general form is as follows:
[0051] Preferably, orthographic projection and back projection are performed based on corresponding reference frames for the coordinate frame in the first format and the coordinate frame in the second format before and after transformation, respectively. If the original coordinate frame in the first format in step Si is a geographic coordinate frame, namely a coordinate frame in latitude and longitude format, orthographic projection is performed on original coordinates in the first format to obtain a projected coordinate frame in the first format before transformation (i.e., before step S2). Coordinate correction is then performed on projected coordinates in the first format by using the coordinate correction matrix according to step S2 and step S3 to obtain a projected coordinate frame in the second format. If the target coordinate frame in the second format is the geographic coordinate frame, back projection is performed after the coordinate correction (after step S2 and step S3) to obtain the geographic coordinate frame in the second format, namely a coordinate frame in latitude and longitude format, based on the projected coordinates in the second format.
[0052] In step S22, the parameters of correction are calculated by using a least square method with four or more pairs of known points. Each of the four or more pairs of known points includes a coordinate point in the original coordinate frame (X.sub.1, Y.sub.1, Z.sub.1) and a coordinate point in the target coordinate frame (X.sub.2, Y.sub.2, Z.sub.2). The results of the calculation are determined translation parameters (X.sub.0, Y.sub.0 and Z.sub.0), rotation parameters (Ε.sub.x, Ε.sub.y and Ε.sub.z) and scale parameter m. The least square method optimizes the function matching of data by minimizing the sum of square errors. Unknown data can be obtained easily by using a least square method, and the sum of square errors between the obtained data and real data is minimized. In this example, the parameters of correction are calculated by using a least square method.
EXAMPLE 2
[0053] In this example, the method for correcting space coordinates of a three-dimensional model of Example 1 is described in detail by taking a three-dimensional model in OSGB format (i.e., the first format) produced based on ContextCapture reality modeling system for example. ContextCapture reality modeling system is currently mainstream three-dimensional reality model production software that is characterized by simple operation, no need for human intervention, good modeling effect, etc. OSGB format is binary version of OpenSceneGraph Scene Data (OSG) format, which is a general three-dimensional model format. In this embodiment, the space coordinate correction of the three-dimensional model in OSGB format mainly includes space coordinate correction of tiles and space coordinate correction of the origin of the model. The specific steps are as follows:
[0054] step S1, read the information of the original coordinate frame of the three-dimensional model in OSGB format produced based on ContextCapture reality modeling system and the origin of coordinates of the model; read data of tiles of the three-dimensional model in OSGB format one by one, obtain information of pagelod nodes in the tiles, and calculate original coordinates of the pagelod nodes;
[0055] step S2, calculate the parameters of correction between the original coordinate frame and the target coordinate frame, and construct the space coordinate correction matrix;
[0056] step S3, transform and correct the coordinates of the origin of the three-dimensional model and the pagelod nodes of the tiles one by one by using the space coordinate correction matrix; and
[0057] step S4, store a file of OSGB tiles with corrected space coordinates, and modify a metadata file of the model in OSGB format.
[0058] In this embodiment, preferably, the three-dimensional model in OSGB format is produced by ContextCapture reality modeling system.
[0059] In this embodiment, the three-dimensional model in OSGB format produced based on ContextCapture reality modeling system is stored in the form of tiles and mainly composed of data of model tiles and a metadata file. The three-dimensional model is divided into a number of tiles, each tile containing data of several levels of detail (LODs), i.e., node data. Pagelod nodes in the tiles of the three-dimensional model in OSGB format mainly store the information of geometric coordinate points of the tiles of the three-dimensional model.
[0060] In a preferred embodiment of the present disclosure, in step S1, the original coordinates of each of the pagelod nodes in the tiles of the three-dimensional model in OSGB format are obtained from the coordinates of the origin of the model plus the coordinates of a pagelod geometric coordinate point. Specifically, the original coordinates of each of the pagelod nodes in the tiles of the three-dimensional model in OSGB format are calculated according to the following formula:
[0061] original coordinates of a pagelod node=coordinates of the origin of the three-dimensional model in OSGB format+coordinates of a geometric coordinate point.
[0062] Step S3 further includes the following steps to transform and correct the coordinates of the pagelod nodes in the tiles of the three-dimensional model one by one:
[0063] step S31, perform space coordinate correction on pagelod original coordinates based on the space coordinate correction matrix to obtain corrected pagelod space coordinates and corrected space coordinates of the origin of the three-dimensional model; and
[0064] step S32, after the pagelod space coordinate correction is completed, calculate the coordinates of a geometric coordinate point with the corrected pagelod space coordinates and the corrected space coordinates of the origin of the three-dimensional model obtained in step S31 according to the following formula:
coordinates of a geometric coordinate point =corrected pagelod space coordinates−corrected space coordinates of the origin of the three-dimensional model.
[0065] The original coordinate frame of the three-dimensional model in OSGB format produced based on ContextCapture reality modeling system and the coordinates of the origin of the model are saved in the metadata file having a name of metadata.xml. Therefore, in step S4, the metadata file of the model in OSGB format is modified after the file of OSGB tiles with corrected space coordinates is obtained. The method for correcting space coordinates of a three-dimensional model described in this example would not cause changes in format and pyramid structure of the three-dimensional model in the first format during space coordinate correction.
EXAMPLE 3
[0066] This example provides a method for encrypting space coordinates of a three-dimensional model, where original space coordinates are encrypted by coordinate transformation using the method for correcting space coordinates of a three-dimensional model as described in Example 1 or Example 2.
[0067] A three-dimensional reality model is a novel mapping product with real space coordinates, i.e., secret-involved data, and thus needs to be processed before release to the Internet. In this example, encryption of the space coordinates of a three-dimensional model can be realized by performing coordinate correction on secret-involved three-dimensional model, thereby facilitating the release and browsing of the three-dimensional reality model on Internet and being conducive to extension of three-dimensional reality model applications.
[0068] In the specification, the description of“one embodiment”, “some embodiments”,“an example”,“a specific example” and“some examples” means that a specific feature, structure, material or characteristic described in combination with the embodiment(s) or example(s) are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Various replacements, variations and improvements made without departing from the principle and scope of the present disclosure by a person skilled in the art shall fall within the protection scope of the present disclosure.