Two-dimensional data and three-dimensional model combined display method and device, equipment and medium
By acquiring and converting the parameters of the three-dimensional model and two-dimensional data, the automated and accurate alignment of the three-dimensional model and two-dimensional data is achieved, solving the problem of inefficient alignment between two-dimensional data and three-dimensional models in the existing technology, and improving processing efficiency.
Patent Information
- Application Number
- CN202411211237.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-08-30
AI Technical Summary
The prior art is difficult to achieve accurate alignment when adding two-dimensional data to the area of interest of a three-dimensional model, and is inefficient and requires manual drag and drop operation.
By obtaining the parameters of the 3D model and 2D data, create a 2D canvas that align with the center point of the 3D model, convert the position and shape parameters, so that the 2D data displays the position and shape on the new canvas and the position and position on the original image and Shape alignment enables automated and accurate alignment.
Improve the alignment efficiency of two-dimensional data and three-dimensional models, ensure accurate alignment, and reduce the time and effort of manual operation.
Smart Images

Figure CN119048721A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine vision technology, and in particular to a method, device, equipment and medium for combining two-dimensional data with a three-dimensional model. Background Art
[0002] With the development of 3D visualization technology, 3D models are increasingly used in various technical fields. When displaying the 3D model of an object, users often focus on certain areas of the 3D model and hope to add additional 2D data (such as 2D graphics, text, etc.) to these areas of interest, so as to facilitate further analysis of the 3D model or enhance understanding of the 3D model.
[0003] If you want to accurately add 2D data to the area of interest of a 3D model, the traditional solution is to directly display the 2D data first, and then rely on the user's manual operation to drag the 2D data to the area of interest of the 3D model to align the 2D data with the 3D model. However, this method is not only time-consuming and labor-intensive, but also inefficient, and it is difficult to ensure the accurate alignment of the 2D data with the 3D model. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, equipment and medium for displaying a combination of two-dimensional data and a three-dimensional model, so as to achieve automatic and accurate alignment of two-dimensional data and a three-dimensional model. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for displaying a combination of two-dimensional data and a three-dimensional model, the method comprising:
[0006] Acquire model parameters of the three-dimensional model and data parameters of the two-dimensional data, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data is data added on a first image, the first image is a projection image of the three-dimensional model at a target viewing angle, and the position parameters indicate the position of the two-dimensional data in a coordinate system of the first image;
[0007] Based on the model parameters, displaying the three-dimensional model on a first canvas;
[0008] Creating a second canvas on an upper layer of the first canvas, wherein a center point of the second canvas is aligned with a center point of the three-dimensional model displayed on the first canvas;
[0009] Converting the position parameters and the shape parameters into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before the conversion on the first image;
[0010] The two-dimensional data is displayed on the second canvas based on the converted position parameter and the converted shape parameter.
[0011] Optionally, the size of the first canvas is the same as the size of the second canvas;
[0012] The converting the position parameter and the shape parameter into parameters in the coordinate system of the second canvas includes:
[0013] scaling the position parameter and the shape parameter according to a stretch ratio between the second image and the first image;
[0014] Determine the distances between two adjacent sides of the circumscribed rectangle of the second image and two corresponding adjacent boundaries in the first canvas; the distances include a horizontal distance and a vertical distance, the horizontal distance is the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance is the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas;
[0015] adjusting a horizontal parameter of the scaled position parameter according to the horizontal distance;
[0016] The vertical parameter of the scaled position parameter is adjusted according to the vertical distance.
[0017] Optionally, the size of the second canvas is the same as the size of the circumscribed rectangle of the second image;
[0018] The converting the position parameter and the shape parameter into parameters in the coordinate system of the second canvas includes:
[0019] The position parameter and the shape parameter are scaled according to a stretch ratio between the second image and the first image.
[0020] Optionally, the method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data includes:
[0021] Displaying the three-dimensional model on a third canvas, adjusting the three-dimensional model to the target viewing angle, and recording the three-dimensional shape parameters and geometric transformation parameters of the adjusted three-dimensional model as model parameters of the three-dimensional model;
[0022] Acquire a projection image of the three-dimensional model displayed on the third canvas at the target viewing angle as the first image, and display the first image on a fourth canvas;
[0023] Obtaining two-dimensional data added by a user to the first image;
[0024] The type of the two-dimensional data is determined, and the shape parameters and position parameters of the two-dimensional data are recorded according to the shape parameter type and position parameter type corresponding to the type as data parameters of the two-dimensional data.
[0025] Optionally, the model parameters include three-dimensional shape parameters and geometric transformation parameters, the three-dimensional shape parameters include: size parameters and shape type, and the geometric transformation parameters include: rotation angle and scaling ratio of the three-dimensional model on each coordinate axis;
[0026] In the case where the two-dimensional data is a rectangle, the shape parameters include: size parameters of the rectangle and the rotation angle of the rectangle, and the position parameters include: coordinates of the vertices of the rectangle;
[0027] In the case where the two-dimensional data is a circle, the shape parameters include: the radius of the circle, and the position parameters include: the coordinates of the center of the circle;
[0028] In the case where the two-dimensional data is text, the shape parameters include: text content, and the position parameters include: the starting coordinates of the text.
[0029] Optionally, the data format of the data parameter is Base64, and the first canvas and the second canvas are canvases.
[0030] In a second aspect, an embodiment of the present application provides a device for displaying a combination of two-dimensional data and a three-dimensional model, the device comprising:
[0031] a parameter acquisition module, used to acquire model parameters of the three-dimensional model and data parameters of the two-dimensional data, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data is data added on a first image, the first image is a projection image of the three-dimensional model at a target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image;
[0032] A first display module, configured to display the three-dimensional model on a first canvas based on the model parameters;
[0033] A canvas creation module, configured to create a second canvas on an upper layer of the first canvas, wherein a center point of the second canvas is aligned with a center point of the three-dimensional model displayed on the first canvas;
[0034] a parameter conversion module, configured to convert the position parameters and the shape parameters into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before the conversion on the first image;
[0035] The second display module is used to display the two-dimensional data on the second canvas based on the converted position parameter and the converted shape parameter.
[0036] Optionally, the size of the first canvas is the same as that of the second canvas; the parameter conversion module is specifically used to scale the position parameter and the shape parameter according to the stretch ratio between the second image and the first image; determine the distance between two adjacent sides of the circumscribed rectangle of the second image and the corresponding two adjacent boundaries in the first canvas; the distance includes a horizontal distance and a vertical distance, the horizontal distance is the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance is the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas; adjust the horizontal parameter of the scaled position parameter according to the horizontal distance; adjust the vertical parameter of the scaled position parameter according to the vertical distance.
[0037] Optionally, the size of the second canvas is the same as the size of the circumscribed rectangle of the second image; the parameter conversion module is specifically used to scale the position parameter and the shape parameter according to a stretch ratio between the second image and the first image.
[0038] Optionally, the method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data includes: displaying the three-dimensional model on a third canvas, adjusting the three-dimensional model to the target viewing angle, and recording the three-dimensional shape parameters and geometric transformation parameters of the adjusted three-dimensional model as model parameters of the three-dimensional model; obtaining a projection image of the three-dimensional model displayed on the third canvas at the target viewing angle as the first image, and displaying the first image on a fourth canvas; obtaining the two-dimensional data added by the user to the first image; determining the type of the two-dimensional data, and recording the shape parameters and position parameters of the two-dimensional data as data parameters of the two-dimensional data according to the shape parameter type and position parameter type corresponding to the type.
[0039] Optionally, the model parameters include three-dimensional shape parameters and geometric transformation parameters, the three-dimensional shape parameters include: size parameters and shape type, the geometric transformation parameters include: rotation angle and scaling ratio of the three-dimensional model on each coordinate axis; when the two-dimensional data is a rectangle, the shape parameters include: size parameters of the rectangle and the rotation angle of the rectangle, the position parameters include: coordinates of the vertices of the rectangle; when the two-dimensional data is a circle, the shape parameters include: radius of the circle, and the position parameters include: coordinates of the center of the circle; when the two-dimensional data is text, the shape parameters include: text content, and the position parameters include: starting coordinates of the text.
[0040] Optionally, the data format of the data parameter is Base64, and the first canvas and the second canvas are canvases.
[0041] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0042] Memory, used to store computer programs;
[0043] The processor is used to implement any method described in the first aspect when executing a program stored in the memory.
[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method described in the first aspect is implemented.
[0045] Beneficial effects of the embodiments of the present application:
[0046] In the solution provided by the embodiment of the present application, model parameters of the three-dimensional model and data parameters of the two-dimensional data are obtained, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data are data added to the first image, the first image is the projection image of the three-dimensional model under the target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image; based on the model parameters, the three-dimensional model is displayed on the first canvas; a second canvas is created on the upper layer of the first canvas, wherein the center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas; the position parameters and shape parameters are converted into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the converted shape parameters before the conversion on the first image; the two-dimensional data is displayed on the second canvas based on the converted position parameters and the converted shape parameters. By converting the position parameters and shape parameters into parameters in the coordinate system of the second canvas, the display position and shape of the two-dimensional data on the second canvas can be aligned with the position and shape of the two-dimensional data on the projection image corresponding to the previously displayed three-dimensional model, and the center point of the second canvas is aligned with the center point of the currently displayed three-dimensional model, which can make the display position and shape of the two-dimensional data on the second canvas consistent with the display position and shape of the two-dimensional data on the image projected by the currently displayed three-dimensional model on the second canvas, so that the position and shape of the two-dimensional data defined by the converted data parameters on the projection image corresponding to the currently displayed three-dimensional model are aligned with the position and shape of the two-dimensional data defined by the data parameters before the conversion on the projection image corresponding to the previously displayed three-dimensional model, so as to realize the automatic and precise alignment of the two-dimensional data and the three-dimensional model. At the same time, compared with the manual alignment method, the processing efficiency is greatly improved because the automatic alignment is realized.
[0047] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0049] Figure 1 A flowchart of a method for combining two-dimensional data and a three-dimensional model for displaying provided in an embodiment of the present application;
[0050] Figure 2Based on Figure 1 A flow chart of a parameter conversion method of the illustrated embodiment;
[0051] Figure 3a Based on Figure 2 A schematic diagram of a circumscribed rectangle of a second image in the illustrated embodiment;
[0052] Figure 3b Based on Figure 2 A schematic diagram of a parameter conversion process of the illustrated embodiment;
[0053] Figure 3c Based on Figure 2 A schematic diagram of a display effect of combining two-dimensional data with a three-dimensional model in the illustrated embodiment;
[0054] Figure 4 Based on Figure 1 A flow chart of a method for creating a second canvas in the illustrated embodiment;
[0055] Figure 5a Based on Figure 4 A schematic diagram of an initial canvas of the illustrated embodiment;
[0056] Figure 5b Based on Figure 4 A schematic diagram of a second canvas of the illustrated embodiment;
[0057] Figure 6 A schematic diagram of the structure of a device for combining two-dimensional data and three-dimensional models provided in an embodiment of the present application;
[0058] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0060] In order to achieve automatic and precise alignment of two-dimensional data and three-dimensional models, an embodiment of the present application provides a method, device, electronic device, computer-readable storage medium and computer program product for combining and displaying two-dimensional data and three-dimensional models. The following first introduces a method for combining and displaying two-dimensional data and three-dimensional models provided in an embodiment of the present application.
[0061] The combined display method of two-dimensional data and three-dimensional model provided in the embodiment of the present application can be applied to any electronic device that needs to display two-dimensional data on a three-dimensional model to achieve automatic and precise alignment with the three-dimensional model, for example, it can be a terminal device such as a mobile phone, a computer, a smart screen, or a server. No specific limitation is made here, and for the sake of clarity, it is hereinafter referred to as an electronic device.
[0062] like Figure 1 As shown, a method for combining two-dimensional data with a three-dimensional model includes:
[0063] S101, obtaining model parameters of a three-dimensional model and data parameters of two-dimensional data.
[0064] The data parameters include shape parameters and position parameters. The two-dimensional data is the data added to the first image. The first image is the projection image of the three-dimensional model under the target viewing angle. The position parameters indicate the position of the two-dimensional data in the coordinate system of the first image.
[0065] S102: Displaying a three-dimensional model on a first canvas based on the model parameters.
[0066] S103: Create a second canvas on an upper layer of the first canvas.
[0067] The center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas.
[0068] S104: Convert the position parameters and shape parameters into parameters in the coordinate system of the second canvas.
[0069] Among them, the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before conversion on the first image.
[0070] S105 , displaying the two-dimensional data on a second canvas based on the converted position parameters and the converted shape parameters.
[0071] In the solution provided by the embodiment of the present application, model parameters of the three-dimensional model and data parameters of the two-dimensional data are obtained, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data are data added to the first image, the first image is the projection image of the three-dimensional model under the target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image; based on the model parameters, the three-dimensional model is displayed on the first canvas; a second canvas is created on the upper layer of the first canvas, wherein the center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas; the position parameters and shape parameters are converted into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the converted shape parameters before the conversion on the first image; the two-dimensional data is displayed on the second canvas based on the converted position parameters and the converted shape parameters. By converting the position parameters and shape parameters into parameters in the coordinate system of the second canvas, the display position and shape of the two-dimensional data on the second canvas can be aligned with the position and shape of the two-dimensional data on the projection image corresponding to the previously displayed three-dimensional model, and the center point of the second canvas is aligned with the center point of the currently displayed three-dimensional model, which can make the display position and shape of the two-dimensional data on the second canvas consistent with the display position and shape of the two-dimensional data on the image projected by the currently displayed three-dimensional model on the second canvas, so that the position and shape of the two-dimensional data defined by the converted data parameters on the projection image corresponding to the currently displayed three-dimensional model are aligned with the position and shape of the two-dimensional data defined by the data parameters before the conversion on the projection image corresponding to the previously displayed three-dimensional model, so as to realize the automatic and precise alignment of the two-dimensional data and the three-dimensional model. At the same time, compared with the manual alignment method, the processing efficiency is greatly improved because the automatic alignment is realized.
[0072] Before an electronic device executes the combined display method of two-dimensional data and three-dimensional model provided in the embodiment of the present application, it is necessary to display the three-dimensional model and determine the projection image of the three-dimensional model at the target viewing angle, and then obtain the two-dimensional data added by the user on the projection image. In this process, the device that displays the three-dimensional model and adds the two-dimensional data can be the electronic device or another device different from the electronic device.
[0073] For example, the electronic device can first display the three-dimensional model, then determine the projection image of the three-dimensional model at the target viewing angle, and further display the projection image. Then, the electronic device can obtain the two-dimensional data added by the user to the projection image. Finally, the electronic device executes the combined display method of the two-dimensional data and the three-dimensional model provided in the embodiment of the present application, redisplays the two-dimensional data and the three-dimensional model, and aligns the two.
[0074] For another example, the first device may first display the three-dimensional model, then determine the projection image of the three-dimensional model at the target viewing angle, and send it to the second device. The second device may then display the projection image and obtain the two-dimensional data added by the user to the projection image. Finally, the electronic device executes the combined display method of the two-dimensional data and the three-dimensional model provided in the embodiment of the present application, displays the above-mentioned two-dimensional data and the three-dimensional model, and aligns the two.
[0075] Here, taking the example of a first device being used to display a three-dimensional model and a second device being used to add two-dimensional data, the method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data in the embodiment of the present application is introduced.
[0076] When the 3D model needs to be displayed, the first device can create a canvas and display the 3D model on the canvas. The user can then rotate and scale the displayed 3D model through the first device according to actual needs to change the viewing angle of the 3D model, thereby viewing the structure and detail information of different parts of the 3D model.
[0077] When the user is viewing a three-dimensional model at a certain viewing angle, if the user wants to add additional two-dimensional data to certain areas of the three-dimensional model at the current viewing angle (i.e., the target viewing angle) in order to further analyze the three-dimensional model or enhance the understanding of the three-dimensional model. Then the user can trigger the first device to project the three-dimensional model onto the projection plane corresponding to the current viewing angle by clicking on the projection control displayed on the first device, and obtain a projection image (i.e., the first image). In addition, the first device can also record the three-dimensional shape parameters (size parameters and shape type, etc.) and geometric transformation parameters (rotation angle and scaling ratio of the three-dimensional model on each coordinate axis) of the three-dimensional model at the current viewing angle, that is, record the model parameters of the three-dimensional model.
[0078] The projection image corresponding to the 3D model is an image obtained by projecting the 3D model onto a projection plane corresponding to the current viewing angle to obtain an initial projection image, and then removing the background from the initial projection image. The size information of the projection image is the same as the size information of the minimum circumscribed rectangle of the 3D model.
[0079] After obtaining the projection image and the model parameters of the three-dimensional model, on the one hand, the first device can send the model parameters of the three-dimensional model to the electronic device so that the electronic device can subsequently reproduce the three-dimensional model according to the model parameters. On the other hand, the first device can also send the projection image to the second device so that the second device can display the projection image and obtain the two-dimensional data added by the user to the projection image.
[0080] After obtaining the projected image, the second device can create a canvas and display the projected image on the canvas. Then the user can add two-dimensional data such as two-dimensional graphics and text to the projected image according to actual needs. For example, the user can add various rectangular boxes to the projected image to partition the three-dimensional model, so that after the subsequent defect detection, the number of defects in different areas of the three-dimensional model can be counted according to the partition information.
[0081] After obtaining the two-dimensional data added by the user to the projected image, the second device can determine the type of the two-dimensional data, for example, whether the two-dimensional data is a rectangle, a circle, text or other types of two-dimensional data. Then, the second device can record the shape parameters and position parameters of the two-dimensional data according to the shape parameter type and position parameter type corresponding to the type, that is, record the data parameters of the two-dimensional data through data formats such as Base64, HTML (HyperText Markup Language) or XML (Extensible Markup Language), wherein the position parameters of the two-dimensional data indicate the position of the two-dimensional data in the coordinate system of the projected image.
[0082] For example, if the two-dimensional data is a rectangle, the shape parameters of the two-dimensional data may include: the size parameters of the rectangle and the rotation angle of the rectangle, and the position parameters of the two-dimensional data may include: the coordinates of the vertices of the rectangle; if the two-dimensional data is a circle, the shape parameters of the two-dimensional data may include: the radius of the circle, and the position parameters of the two-dimensional data may include: the coordinates of the center of the circle; if the two-dimensional data is text, the shape parameters of the two-dimensional data may include: the text content, and the position parameters of the two-dimensional data may include: the starting coordinates of the text.
[0083] After obtaining the data parameters of the two-dimensional data, the second device may send the data parameters of the two-dimensional data to the electronic device, so that the electronic device subsequently reproduces the two-dimensional data on the three-dimensional model according to the data parameters.
[0084] Through the above method, the electronic device can obtain the model parameters of the three-dimensional model and the data parameters of the two-dimensional data.
[0085] It should be noted that the user may add additional two-dimensional data to multiple three-dimensional models, or add additional two-dimensional data to multiple perspectives of the same three-dimensional model. In this case, the electronic device will obtain model parameters of multiple three-dimensional models and data parameters of multiple two-dimensional data. In order to establish an association relationship between the model parameters of the three-dimensional model and the data parameters of the two-dimensional data, the first device may carry identification information for identifying the model itself and the model perspective when sending the projection image to the second device and the model parameters of the three-dimensional model to the electronic device. When the second device sends the data parameters of the two-dimensional data added to the projection image to the electronic device, it may also carry the identification information for identifying the model itself and the model perspective carried by the first device when sending the projection image to the electronic device. In this way, when the electronic device obtains the model parameters of multiple three-dimensional models and the data parameters of multiple two-dimensional data, it can determine the corresponding model parameters of the three-dimensional model and the data parameters of the two-dimensional data based on the identification information.
[0086] When it is necessary to display the two-dimensional data on the three-dimensional model to achieve automatic and precise alignment of the two-dimensional data with the three-dimensional model, the electronic device can determine the initial three-dimensional form of the three-dimensional model based on shape parameters such as the size parameters and shape type of the three-dimensional model, and then determine the transformed three-dimensional form of the three-dimensional model based on geometric change parameters such as the rotation angle and scaling ratio on each coordinate axis of the three-dimensional model. Then, the electronic device displays the three-dimensional model on the created first canvas based on the determined three-dimensional form of the transformed three-dimensional model.
[0087] After the electronic device creates the first canvas, it can also create a second canvas for displaying two-dimensional data on the upper layer of the first canvas. The center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas. The second canvas can be a fully transparent canvas or a semi-transparent canvas. The transparency of the semi-transparent canvas only needs to satisfy the user's ability to view the three-dimensional model displayed on the first canvas through the second canvas, and is not specifically limited here.
[0088] The electronic device can also convert the position parameters and shape parameters into parameters in the coordinate system of the second canvas, and then determine the position of the two-dimensional data on the second canvas based on the converted position parameters, and display the two-dimensional data at the determined position of the two-dimensional data on the second canvas according to the converted shape parameters.
[0089] In this process, on the one hand, the position parameters and shape parameters are converted into parameters in the coordinate system of the second canvas, so that the display position and shape of the two-dimensional data on the second canvas can be aligned with the position and shape of the two-dimensional data on the projection image corresponding to the previously displayed three-dimensional model. The second image is the image projected by the three-dimensional model on the second canvas. On this basis, the alignment of the center point of the second canvas with the center point of the current three-dimensional model can ensure that the display position and shape of the two-dimensional data on the second canvas are consistent with the display position and shape of the two-dimensional data on the image projected by the currently displayed three-dimensional model on the second canvas.
[0090] Therefore, through the above-mentioned parameter conversion and center point alignment, the position and shape of the two-dimensional data defined by the converted data parameters on the projection image corresponding to the currently displayed three-dimensional model can be aligned with the position and shape of the two-dimensional data defined by the data parameters before the conversion on the projection image corresponding to the previously displayed three-dimensional model, thereby realizing automatic and precise alignment of the two-dimensional data and the three-dimensional model.
[0091] In one implementation, when the electronic device creates the second canvas and converts the position parameters and shape parameters into parameters in the coordinate system where the second canvas is located, it can be implemented in the following manner:
[0092] When the coordinate system of the first image is a coordinate system established with the center point of the first image as the coordinate origin, when the electronic device creates the second canvas, the second canvas can be of any size. For example, the size of the second canvas can be the same as the size of the first canvas, the same as the size of the first image, or the same as the size of the second image.
[0093] In a preferred manner, in order to ensure that the two-dimensional data can be displayed completely as much as possible, the size information of the second canvas can be any size between the size of the second image and the size of the first canvas.
[0094] Furthermore, the electronic device may scale the position parameters and the shape parameters according to the stretching ratio between the second image and the first image, thereby converting the position parameters and the shape parameters into parameters in the coordinate system where the second canvas is located.
[0095] Regarding the effect of aligning the center point of the second canvas with the center point of the three-dimensional model displayed on the first canvas, the electronic device may achieve this in the following two ways:
[0096] In the first mode, when the electronic device creates the first canvas, the first canvas can be displayed in the center, and when the 3D model is displayed on the first canvas, the 3D model is also displayed in the center. Then, when the electronic device creates the second canvas on the first canvas, the second canvas can also be displayed in the center, so that the center point of the second canvas is aligned with the center point of the 3D model.
[0097] In the second method, after the electronic device displays the three-dimensional model on the first canvas, it can record the position information of the center point of the three-dimensional model. Then, when the electronic device creates a second canvas on the first canvas, it can use the pre-recorded position information of the center point of the three-dimensional model as the position information of the center point of the second canvas, and then create the second canvas based on the position information of the center point of the second canvas, so that the center point of the second canvas is aligned with the center point of the three-dimensional model.
[0098] In one implementation, the first canvas and the second canvas may be canvases.
[0099] In the solution provided by the embodiment of the present application, the electronic device can make the display position of the two-dimensional data on the second canvas consistent with the position of the two-dimensional data on the original three-dimensional model by converting the position parameters and shape parameters into parameters in the coordinate system of the second canvas, and the center point of the second canvas is aligned with the center point of the current three-dimensional model, so that the display position of the two-dimensional data on the second canvas is consistent with the position of the two-dimensional data on the current three-dimensional model, so that the position of the two-dimensional data on the three-dimensional model defined by the converted parameters is the same as the position of the two-dimensional data on the three-dimensional model defined by the original parameters, and the automatic and precise alignment of the two-dimensional data and the three-dimensional model is realized. At the same time, compared with the manual alignment method, the processing efficiency is greatly improved because the automatic alignment is realized.
[0100] In addition to the above implementation, the present application also provides two implementations for creating a second canvas for an electronic device and converting position parameters and shape parameters into parameters in the coordinate system of the second canvas. Figure 2 -3 and Figure 4 -5 introduces these two implementation methods respectively.
[0101] In a first implementation manner, when creating the second canvas, the electronic device may set the size of the second canvas to be the same as the size of the first canvas.
[0102] In this case, when the electronic device converts the position parameter and the shape parameter into the parameter in the coordinate system of the second canvas, Figure 2 Execute as shown:
[0103] S201, scaling position parameters and shape parameters according to a stretching ratio between the second image and the first image.
[0104] There may also be a problem that the size of the three-dimensional model displayed on the first device is inconsistent with that of the three-dimensional model displayed by the electronic device. In this case, in order to adapt the two-dimensional data to the three-dimensional model after the size change, the electronic device needs to scale the data parameters of the two-dimensional data. Specifically,
[0105] In addition to obtaining model parameters of the three-dimensional model and data parameters of the two-dimensional data, the electronic device can also obtain size information of the first image to which the above-mentioned two-dimensional data is added. In addition, the electronic device can also determine the size of the projected image of the three-dimensional model displayed by itself on the second canvas, that is, determine the size of the second image.
[0106] The electronic device may then determine a stretch ratio between the first image and the second image according to the size of the first image and the size of the second image, and scale the position parameters and the shape parameters according to the stretch ratio.
[0107] For example, the size information of the first image is: length 10, width 4, and the size information of the second image is: length 15, width 6, then the stretch ratio between the first image and the second image includes: horizontal stretch ratio (10:15) and vertical stretch ratio (4:6). Assuming that the position parameter of the two-dimensional data (circle) is the center coordinate (3, 3), and the shape parameter is the radius 0.5, then because the values of the horizontal stretch ratio and the vertical stretch ratio between the first image and the second image are the same, the electronic device can directly scale the center coordinate and radius of the circle according to the horizontal stretch ratio or the vertical stretch ratio between the first image and the second image, and the scaled position parameter is the center coordinate (4.5, 4.5), and the scaled shape parameter is the radius 0.75.
[0108] For a clearer description, here is another example. Assuming that the size information of the first image is: length 4, width 2, and the size information of the second image is: length 8, width 6, then the stretching ratio between the first image and the second image includes: horizontal stretching ratio (4:8) and vertical stretching ratio (2:6). Assuming that the position parameter of the two-dimensional data (rectangle) is the coordinate of the upper left vertex (3, 3), and the shape parameter is: length 1, width 1, then the electronic device can scale the horizontal coordinate of the upper left vertex of the rectangle and the length of the rectangle according to the horizontal stretching ratio (4:8) between the first image and the second image, and obtain the scaled horizontal coordinate of 6 and the scaled length of 2, and scale the vertical coordinate of the upper left vertex of the rectangle and the width of the rectangle according to the vertical stretching ratio (2:6) between the first image and the second image, and obtain the scaled vertical coordinate of 9 and the scaled width of 3. That is, the scaled position parameter is the upper left vertex (6, 9), and the scaled shape parameter is length 2 and width 3.
[0109] S202: Determine the distances between two adjacent sides of the circumscribed rectangle of the second image and two corresponding adjacent boundaries in the first canvas.
[0110] After the electronic device completes the step of displaying the three-dimensional model on the first canvas, it needs to further determine the distances between the three-dimensional model displayed on the first canvas and two adjacent borders of the first canvas, wherein the distance between the three-dimensional model and the border of the first canvas is measured by the distance between the circumscribed rectangle of the projection image of the three-dimensional model on the second canvas and the border of the first canvas.
[0111] When determining the distances between two adjacent sides of the circumscribed rectangle of the second image and two corresponding adjacent boundaries in the first canvas, the electronic device may first determine which two adjacent sides of the circumscribed rectangle of the second image need to be used in the following manner:
[0112] When the three-dimensional model is displayed in the center of the first canvas, the distances between the circumscribed rectangle of the second image and the upper and lower boundaries of the first canvas are equal, and similarly, the distances between the circumscribed rectangle of the second image and the left and right boundaries of the first canvas are also equal. Therefore, in this case, the electronic device can use any two adjacent sides of the circumscribed rectangle of the second image when determining the distance. That is, the upper side and left side of the circumscribed rectangle of the second image can be used, the upper side and right side of the circumscribed rectangle of the second image can be used, the lower side and left side of the circumscribed rectangle of the second image can be used, or the lower side and right side of the circumscribed rectangle of the second image can be used.
[0113] When the three-dimensional model is not displayed in the center of the first canvas, when the electronic device determines the distance, the orientation of the intersection of two adjacent sides of the circumscribed rectangle of the second image used needs to be consistent with the orientation of the coordinate origin in the coordinate system of the first image.
[0114] For example, if the coordinate origin of the coordinate system of the first image is the upper left corner, then the left and top sides of the circumscribed rectangle of the second image need to be used; if the coordinate origin of the coordinate system of the first image is the lower left corner, then the left and bottom sides of the circumscribed rectangle of the second image need to be used; if the coordinate origin of the coordinate system of the first image is the lower right corner, then the right and bottom sides of the circumscribed rectangle of the second image need to be used; if the coordinate origin of the coordinate system of the first image is the upper right corner, then the right and top sides of the circumscribed rectangle of the second image need to be used.
[0115] After determining which two adjacent sides of the circumscribed rectangle of the second image need to be used, the electronic device can determine two adjacent boundaries corresponding to the two adjacent sides from the boundary of the first canvas, wherein the two adjacent sides and the two adjacent boundaries are located in the same direction.
[0116] For example, if the top and left sides of the circumscribed rectangle of the second image are used, then the two adjacent boundaries are the top and left boundaries of the first canvas; if the top and right sides of the circumscribed rectangle of the second image are used, then the two adjacent boundaries are the top and right boundaries of the first canvas; if the bottom and left sides of the circumscribed rectangle of the second image are used, then the two adjacent boundaries are the bottom and left boundaries of the first canvas; if the bottom and right sides of the circumscribed rectangle of the second image are used, then the two adjacent boundaries are the bottom and right boundaries of the first canvas.
[0117] Correspondingly, the distances between two adjacent sides of the determined circumscribed rectangle of the second image and the corresponding two adjacent boundaries in the first canvas may include: a horizontal distance and a vertical distance, the horizontal distance being the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance being the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas.
[0118] by Figure 3a For example, the three-dimensional model displayed on the first canvas is 301, and the corresponding bounding rectangle of the second image is 302. Because the three-dimensional model is displayed in the center of the first canvas, any two adjacent sides of the bounding rectangle 302 can be used to determine the distance. Assuming that the upper side and the left side of the bounding rectangle 302 are used, the corresponding adjacent boundaries in the first canvas are the upper boundary and the left boundary, and the distances between the adjacent sides of the bounding rectangle of the second image and the corresponding adjacent boundaries in the first canvas include: a horizontal distance of 3 and a vertical distance of 5.
[0119] S203, adjusting the horizontal parameter of the scaled position parameter according to the horizontal distance.
[0120] S204: Adjust the vertical parameter of the scaled position parameter according to the vertical distance.
[0121] Because the position parameter of the two-dimensional data includes two sub-parameters, namely the horizontal parameter and the vertical parameter, at the same time, the distance between the two adjacent sides of the circumscribed rectangle of the second image determined by the electronic device and the two corresponding adjacent boundaries in the first canvas also includes two distances, namely the horizontal distance and the vertical distance. Therefore, the electronic device can adjust the horizontal parameter according to the horizontal distance and adjust the vertical parameter according to the vertical distance, specifically, increase the horizontal distance based on the horizontal parameter of the scaled position parameter, and increase the vertical distance based on the vertical parameter of the scaled position parameter.
[0122] Following the above example of the two-dimensional data being a circle and the above example of the distance, Figure 3b, the circle defined by the center coordinates (3, 3) and the radius 0.5 is 303. After scaling the center coordinates and the radius according to the stretch ratio between the second image and the first image, the scaled center coordinates and the scaled radius, i.e., the center coordinates (4.5, 4.5) and the radius 0.75, define a circle 304. After the electronic device adds a horizontal distance 3 to the abscissa of the center coordinates and a vertical distance 5 to the ordinate of the center coordinates, the obtained adjusted center coordinates are (7.5, 9.5) and the radius 0.75. At this time, the circle defined by the adjusted center coordinates and the scaled radius is 305. Finally, the combined display effect of the two-dimensional data and the three-dimensional model can be as follows: Figure 3c shown.
[0123] It should be noted that since the first canvas and the second canvas have the same size, in order to distinguish between the two, Figure 3a-3c In the figure, straight lines and wavy lines are used to represent the boundaries of the two. In order to facilitate the understanding of position parameters and shape parameters, Figure 3a-Figure 3b The grid in the figure represents the unit distance. Figure 3a-3c The three-dimensional model of the vehicle shown in is the three-dimensional model displayed on the first canvas. Figure 3b The circle indicated by the dotted line is only a schematic representation of the position of the two-dimensional data on the second canvas, and is not a real display effect.
[0124] in, Figure 2 The order of executing step S203 first and then executing step S204 is only a schematic illustration. When the electronic device executes step S203 and step S204, it may execute step S204 first and then step S203, or may execute step S203 and step S204 simultaneously, which is not specifically limited here.
[0125] In the solution provided by the embodiment of the present application, the electronic device can first create a second canvas of the same size as the first canvas, and then scale the position parameters and shape parameters by the stretching ratio between the second image and the first image, so that the two-dimensional data adapts to the three-dimensional model after the size change, and finally adjust the position parameters of the scaled two-dimensional data by the distance between the three-dimensional model and the boundary of the first canvas, so as to determine the accurate position of the two-dimensional data, and then achieve accurate alignment of the two-dimensional data with the three-dimensional model. And because the electronic device displays the two-dimensional data on a second canvas that is relatively large compared to the projection image of the currently displayed three-dimensional model, even if the two-dimensional data exceeds the size of the projection image in the projection image, the two-dimensional data can be fully displayed when displayed on the second canvas, and there will be no display missing problem.
[0126] In a second implementation manner, when creating the second canvas, the electronic device may set the size of the second canvas to be the same as the size of the second image.
[0127] In one embodiment, the electronic device can Figure 4 Steps S401-S402 shown are used to create a second canvas with the same size as the second image. Specifically:
[0128] S401, creating an initial canvas on an upper layer of a first canvas.
[0129] In addition to obtaining model parameters of the three-dimensional model and data parameters of the two-dimensional data, the electronic device can also obtain size information of the first image to which the above two-dimensional data is added. In this way, when creating the initial canvas, the electronic device can create an initial canvas with the same size as the first image on the upper layer of the first canvas.
[0130] For example, if the length and width of the first image are 9 and 3 respectively, then after the electronic device displays the 3D model on the first canvas, it can create an initial canvas with a length and width of 9 and 3 respectively on the upper layer of the first canvas. Figure 5a shown.
[0131] S402, taking the center point of the initial canvas as a base point, stretching the initial canvas to obtain a second canvas.
[0132] After the electronic device displays the 3D model on the first canvas, it can determine the projection image of the 3D model on the second canvas, that is, determine the second image, and record the size information of the circumscribed rectangle of the second image. After creating the initial canvas, the electronic device can use the center point of the initial canvas as a base point to stretch the initial canvas to the same size as the circumscribed rectangle of the second image to obtain the second canvas.
[0133] Continuing with the above example, Figure 5a In the example, the size information of the circumscribed rectangle of the projection image of the three-dimensional model displayed on the first canvas at the target viewing angle is: length 15, width 5. After the electronic device creates the above initial canvas, it can stretch it to the same size of the minimum circumscribed rectangle with the center point of the initial canvas as the base point, and obtain the following: Figure 5b The second canvas is shown.
[0134] In this case, when the electronic device converts the position parameter and the shape parameter into parameters in the coordinate system where the second canvas is located, it can be performed in the following manner:
[0135] The position parameters and the shape parameters are scaled according to the stretch ratio between the second image and the first image.
[0136] Among them, “scaling the position parameters and the shape parameters according to the stretching ratio between the second image and the first image” has been discussed in detail in the above step S201, and will not be repeated here.
[0137] In the solution provided in the embodiment of the present application, the electronic device can create a second canvas with the same size as the circumscribed rectangle of the projection image of the three-dimensional model displayed on the first canvas at the target viewing angle, and then scale the position parameters and shape parameters of the two-dimensional data according to the stretch ratio between the first image and the second image, so that the two-dimensional data adapts to the three-dimensional model after the size change, thereby achieving precise alignment of the two-dimensional data and the three-dimensional model.
[0138] Corresponding to the above-mentioned method for combining and displaying two-dimensional data and three-dimensional models, an embodiment of the present application also provides a device for combining and displaying two-dimensional data and three-dimensional models. The following introduces a device for combining and displaying two-dimensional data and three-dimensional models provided in an embodiment of the present application.
[0139] like Figure 6 As shown, a combined display device of two-dimensional data and three-dimensional model includes:
[0140] A parameter acquisition module 610 is used to acquire model parameters of the three-dimensional model and data parameters of the two-dimensional data, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data is data added on the first image, the first image is a projection image of the three-dimensional model under the target viewing angle, and the position parameter indicates the position of the two-dimensional data in the coordinate system of the first image;
[0141] A first display module 620, configured to display the three-dimensional model on a first canvas based on the model parameters;
[0142] A canvas creation module 630, configured to create a second canvas on an upper layer of the first canvas, wherein a center point of the second canvas is aligned with a center point of the three-dimensional model displayed on the first canvas;
[0143] a parameter conversion module 640, configured to convert the position parameters and the shape parameters into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before the conversion on the first image;
[0144] The second display module 650 is used to display the two-dimensional data on the second canvas based on the converted position parameters and the converted shape parameters.
[0145] In the solution provided by the embodiment of the present application, model parameters of the three-dimensional model and data parameters of the two-dimensional data are obtained, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data are data added to the first image, the first image is the projection image of the three-dimensional model under the target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image; based on the model parameters, the three-dimensional model is displayed on the first canvas; a second canvas is created on the upper layer of the first canvas, wherein the center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas; the position parameters and shape parameters are converted into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the converted shape parameters before the conversion on the first image; the two-dimensional data is displayed on the second canvas based on the converted position parameters and the converted shape parameters. By converting the position parameters and shape parameters into parameters in the coordinate system of the second canvas, the display position and shape of the two-dimensional data on the second canvas can be aligned with the position and shape of the two-dimensional data on the projection image corresponding to the previously displayed three-dimensional model, and the center point of the second canvas is aligned with the center point of the currently displayed three-dimensional model, which can make the display position and shape of the two-dimensional data on the second canvas consistent with the display position and shape of the two-dimensional data on the image projected by the currently displayed three-dimensional model on the second canvas, so that the position and shape of the two-dimensional data defined by the converted data parameters on the projection image corresponding to the currently displayed three-dimensional model are aligned with the position and shape of the two-dimensional data defined by the data parameters before the conversion on the projection image corresponding to the previously displayed three-dimensional model, so as to realize the automatic and precise alignment of the two-dimensional data and the three-dimensional model. At the same time, compared with the manual alignment method, the processing efficiency is greatly improved because the automatic alignment is realized.
[0146] As an implementation method of the embodiment of the present application, the size of the first canvas may be the same as the size of the second canvas;
[0147] The parameter conversion module 640 can be specifically used to scale the position parameters and shape parameters according to the stretching ratio between the second image and the first image; determine the distances between two adjacent sides of the circumscribed rectangle of the second image and the corresponding two adjacent boundaries in the first canvas; the distances include horizontal distances and vertical distances, the horizontal distance is the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance is the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas; adjust the horizontal parameters of the scaled position parameters according to the horizontal distance; and adjust the vertical parameters of the scaled position parameters according to the vertical distance.
[0148] As an implementation of the embodiment of the present application, the size of the second canvas may be the same as the size of the circumscribed rectangle of the second image;
[0149] The parameter conversion module 640 may be specifically used to scale the position parameters and the shape parameters according to the stretch ratio between the second image and the first image.
[0150] As an implementation of the embodiment of the present application, the method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data may include:
[0151] Displaying the three-dimensional model on the third canvas, adjusting the three-dimensional model to a target viewing angle, and recording three-dimensional shape parameters and geometric transformation parameters of the adjusted three-dimensional model as model parameters of the three-dimensional model;
[0152] Acquire a projection image of the three-dimensional model displayed on the third canvas at a target viewing angle as a first image, and display the first image on a fourth canvas;
[0153] Obtaining two-dimensional data added by a user on the first image;
[0154] The type of the two-dimensional data is determined, and the shape parameters and position parameters of the two-dimensional data are recorded according to the shape parameter type and position parameter type corresponding to the type as data parameters of the two-dimensional data.
[0155] As an implementation method of an embodiment of the present application, the above-mentioned model parameters may include three-dimensional shape parameters and geometric transformation parameters. The three-dimensional shape parameters may include: size parameters and shape types, and the geometric transformation parameters may include: rotation angles and scaling ratios of the three-dimensional model on each coordinate axis;
[0156] When the two-dimensional data is a rectangle, the shape parameters may include: the size parameters of the rectangle and the rotation angle of the rectangle, and the position parameters may include: the coordinates of the vertices of the rectangle;
[0157] When the two-dimensional data is a circle, the shape parameters may include: the radius of the circle, and the position parameters may include: the coordinates of the center of the circle;
[0158] When the two-dimensional data is text, the shape parameters may include: text content, and the position parameters may include: the starting coordinates of the text.
[0159] As an implementation of the embodiment of the present application, the data format of the above data parameters may be Base64, and the above first canvas and the second canvas may be canvases.
[0160] Corresponding to the above-mentioned method for combining two-dimensional data with three-dimensional models, the embodiment of the present application further provides an electronic device, such as Figure 7 As shown, including:
[0161] Memory 701, used for storing computer programs;
[0162] The processor 702 is used to implement the method for combining and displaying two-dimensional data and three-dimensional models described in any of the above embodiments when executing the program stored in the memory 701.
[0163] In the solution provided by the embodiment of the present application, model parameters of the three-dimensional model and data parameters of the two-dimensional data are obtained, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data are data added to the first image, the first image is the projection image of the three-dimensional model under the target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image; based on the model parameters, the three-dimensional model is displayed on the first canvas; a second canvas is created on the upper layer of the first canvas, wherein the center point of the second canvas is aligned with the center point of the three-dimensional model displayed on the first canvas; the position parameters and shape parameters are converted into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the converted shape parameters before the conversion on the first image; the two-dimensional data is displayed on the second canvas based on the converted position parameters and the converted shape parameters. By converting the position parameters and shape parameters into parameters in the coordinate system of the second canvas, the display position and shape of the two-dimensional data on the second canvas can be aligned with the position and shape of the two-dimensional data on the projection image corresponding to the previously displayed three-dimensional model, and the center point of the second canvas is aligned with the center point of the currently displayed three-dimensional model, which can make the display position and shape of the two-dimensional data on the second canvas consistent with the display position and shape of the two-dimensional data on the image projected by the currently displayed three-dimensional model on the second canvas, so that the position and shape of the two-dimensional data defined by the converted data parameters on the projection image corresponding to the currently displayed three-dimensional model are aligned with the position and shape of the two-dimensional data defined by the data parameters before the conversion on the projection image corresponding to the previously displayed three-dimensional model, so as to realize the automatic and precise alignment of the two-dimensional data and the three-dimensional model. At the same time, compared with the manual alignment method, the processing efficiency is greatly improved because the automatic alignment is realized.
[0164] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 702, the communication interface, and the memory 701 communicate with each other via the communication bus.
[0165] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0166] The communication interface is used for communication between the above electronic device and other devices.
[0167] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0168] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0169] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the method for combining and displaying two-dimensional data and three-dimensional models described in any of the above embodiments is implemented.
[0170] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for displaying a combination of two-dimensional data and a three-dimensional model as described in any of the above embodiments.
[0171] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0172] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0173] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0174] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for combining two-dimensional data with three-dimensional models. It is characterized in that The method comprises: Acquire model parameters of the three-dimensional model and data parameters of the two-dimensional data, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data is data added on a first image, the first image is a projection image of the three-dimensional model at a target viewing angle, and the position parameters indicate the position of the two-dimensional data in a coordinate system of the first image; Based on the model parameters, displaying the three-dimensional model on a first canvas; Creating a second canvas on an upper layer of the first canvas, wherein a center point of the second canvas is aligned with a center point of the three-dimensional model displayed on the first canvas; Converting the position parameters and the shape parameters into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before the conversion on the first image; The two-dimensional data is displayed on the second canvas based on the converted position parameter and the converted shape parameter.
2. The method according to claim 1, It is characterized in that The size of the first canvas is the same as the size of the second canvas; The converting the position parameter and the shape parameter into parameters in the coordinate system of the second canvas includes: scaling the position parameter and the shape parameter according to a stretch ratio between the second image and the first image; Determine the distances between two adjacent sides of the circumscribed rectangle of the second image and two corresponding adjacent boundaries in the first canvas; the distances include a horizontal distance and a vertical distance, the horizontal distance is the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance is the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas; adjusting a horizontal parameter of the scaled position parameter according to the horizontal distance; The vertical parameter of the scaled position parameter is adjusted according to the vertical distance.
3. The method according to claim 1, It is characterized in that The size of the second canvas is the same as the size of the circumscribed rectangle of the second image; The converting the position parameter and the shape parameter into parameters in the coordinate system of the second canvas includes: The position parameter and the shape parameter are scaled according to a stretch ratio between the second image and the first image.
4. The method according to claim 1, It is characterized in that The method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data includes: Displaying the three-dimensional model on a third canvas, adjusting the three-dimensional model to the target viewing angle, and recording the three-dimensional shape parameters and geometric transformation parameters of the adjusted three-dimensional model as model parameters of the three-dimensional model; Acquire a projection image of the three-dimensional model displayed on the third canvas at the target viewing angle as the first image, and display the first image on a fourth canvas; Obtaining two-dimensional data added by a user to the first image; The type of the two-dimensional data is determined, and the shape parameters and position parameters of the two-dimensional data are recorded according to the shape parameter type and position parameter type corresponding to the type as data parameters of the two-dimensional data.
5. The method according to any one of claims 1 to 4, It is characterized in that The model parameters include three-dimensional shape parameters and geometric transformation parameters, the three-dimensional shape parameters include: size parameters and shape type, the geometric transformation parameters include: rotation angle and scaling ratio of the three-dimensional model on each coordinate axis; In the case where the two-dimensional data is a rectangle, the shape parameters include: size parameters of the rectangle and the rotation angle of the rectangle, and the position parameters include: coordinates of the vertices of the rectangle; In the case where the two-dimensional data is a circle, the shape parameters include: the radius of the circle, and the position parameters include: the coordinates of the center of the circle; In the case where the two-dimensional data is text, the shape parameters include: text content, and the position parameters include: the starting coordinates of the text.
6. The method according to any one of claims 1 to 4, It is characterized in that The data format of the data parameter is Base64, and the first canvas and the second canvas are canvases.
7. A combined display device of two-dimensional data and three-dimensional model, It is characterized in that The device comprises: a parameter acquisition module, used to acquire model parameters of the three-dimensional model and data parameters of the two-dimensional data, wherein the data parameters include: shape parameters and position parameters, the two-dimensional data is data added on a first image, the first image is a projection image of the three-dimensional model at a target viewing angle, and the position parameters indicate the position of the two-dimensional data in the coordinate system of the first image; A first display module, configured to display the three-dimensional model on a first canvas based on the model parameters; A canvas creation module, configured to create a second canvas on an upper layer of the first canvas, wherein a center point of the second canvas is aligned with a center point of the three-dimensional model displayed on the first canvas; a parameter conversion module, configured to convert the position parameters and the shape parameters into parameters in the coordinate system of the second canvas, wherein the image projected by the three-dimensional model on the second canvas is the second image, and the position and shape of the two-dimensional data defined by the converted position parameters and the converted shape parameters on the second image are aligned with the position and shape of the two-dimensional data defined by the position parameters and the shape parameters before the conversion on the first image; The second display module is used to display the two-dimensional data on the second canvas based on the converted position parameter and the converted shape parameter.
8. The device according to claim 7, It is characterized in that The size of the first canvas is the same as that of the second canvas; the parameter conversion module is specifically used to scale the position parameter and the shape parameter according to the stretch ratio between the second image and the first image; determine the distance between two adjacent sides of the circumscribed rectangle of the second image and the corresponding two adjacent boundaries in the first canvas; the distance includes a horizontal distance and a vertical distance, the horizontal distance is the distance between the vertical side of the circumscribed rectangle and the corresponding vertical boundary in the first canvas, and the vertical distance is the distance between the horizontal side of the circumscribed rectangle and the corresponding horizontal boundary in the first canvas; adjust the horizontal parameter of the scaled position parameter according to the horizontal distance; adjust the vertical parameter of the scaled position parameter according to the vertical distance; or, The size of the second canvas is the same as the size of the circumscribed rectangle of the second image; the parameter conversion module is specifically used to scale the position parameter and the shape parameter according to the stretch ratio between the second image and the first image; or, The method for determining the model parameters of the three-dimensional model and the data parameters of the two-dimensional data includes: displaying the three-dimensional model on a third canvas, adjusting the three-dimensional model to the target viewing angle, and recording the three-dimensional shape parameters and geometric transformation parameters of the adjusted three-dimensional model as the model parameters of the three-dimensional model; obtaining a projection image of the three-dimensional model displayed on the third canvas at the target viewing angle as the first image, and displaying the first image on a fourth canvas; obtaining the two-dimensional data added by the user on the first image; determining the type of the two-dimensional data, and recording the shape parameters and position parameters of the two-dimensional data as the data parameters of the two-dimensional data according to the shape parameter type and position parameter type corresponding to the type; or, The model parameters include three-dimensional shape parameters and geometric transformation parameters, the three-dimensional shape parameters include: size parameters and shape type, the geometric transformation parameters include: rotation angle and scaling ratio of the three-dimensional model on each coordinate axis; when the two-dimensional data is a rectangle, the shape parameters include: size parameters and rotation angle of the rectangle, and the position parameters include: coordinates of the vertices of the rectangle; when the two-dimensional data is a circle, the shape parameters include: radius of the circle, and the position parameters include: coordinates of the center of the circle; when the two-dimensional data is text, the shape parameters include: text content, and the position parameters include: starting coordinates of the text; or, The data format of the data parameter is Base64, and the first canvas and the second canvas are canvases.
9. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-6 when executing a program stored in a memory.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Drawing feature and number matching method, system, equipment and medium
CN116206320A
Data processing method and device, equipment and medium
CN116758205A
Two-dimensional image acquisition method and device of three-dimensional model, equipment and storage medium
CN118229517A
Image processing method, display device, and inspection system
WO2017155005A1
Model processing method and apparatus, device, and medium
WO2023056879A1
