A method and device for simulating a scene based on a virtual reality engine, a storage medium and an equipment
Patent Information
- Application Number
- CN202310248964.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-15
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-03-15
AI Technical Summary
[0004]本发明的目的在于提供一种基于虚拟现实引擎实现二维指导三维的场景模拟方法、装置、存储介质及设备,解决现有技术中场景模拟精确度低、仿真效果差的问题
[0053]本发明提供的一种基于虚拟现实引擎实现二维指导三维的场景模拟方法、装置、存储介质及设备,通过虚拟现实引擎构建三维场景模型,并将二维图像导入三维场景模型的顶层实现二维指导三维,利用预设的路线调整算法优化出元素的最优路线,并据此对元素进行移动,有效地解决了现有技术中场景模拟精确度低、仿真效果差地缺陷,且整个模拟流程得到了合理简化,大大缩短了制造成本。
Smart Images

Figure CN116206062B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method, apparatus, storage medium, and device for simulating two-dimensional guided three-dimensional scenes based on a virtual reality engine, belonging to the field of scene simulation and simulation technology. Background Technology
[0002] With the continuous improvement of science and technology and the development of information technology, the terrain and structure of various elements in complex scenarios are becoming increasingly complex, and the various situations in complex scenarios are changing rapidly. Therefore, the simulation and modeling of complex scenarios and the optimization of routes for elements in the scenario have become increasingly important.
[0003] Virtual reality engines have very powerful simulation capabilities, but existing scene simulation systems are still unable to meet current needs. The cost of conducting drills in complex scenarios is getting higher and higher, but action planning in complex scenarios requires precise calculations. Existing scene simulation systems have low accuracy, resulting in poor simulation effects. Summary of the Invention
[0004] The purpose of this invention is to provide a method, device, storage medium, and equipment for simulating three-dimensional scenes guided by a virtual reality engine, thereby solving the problems of low scene simulation accuracy and poor simulation effect in the prior art.
[0005] To achieve the above objectives, the present invention employs the following technical solution:
[0006] In a first aspect, the present invention provides a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, comprising:
[0007] Acquire a two-dimensional image;
[0008] The two-dimensional image is preprocessed with isopleths to obtain a two-dimensional contour map;
[0009] The two-dimensional contour map is imported into the virtual reality engine to construct a three-dimensional scene model. The three-dimensional models of the pre-constructed elements are then imported into the virtual reality engine to add the elements to the three-dimensional scene model.
[0010] The state, attributes, and dynamics of the elements are set to enable the 3D scene model to achieve a first-level situational assessment effect, and all elements are merged to enable the 3D scene model to achieve a second-level situational assessment effect.
[0011] The two-dimensional image is imported into the top layer of the three-dimensional scene model, and each class in the three-dimensional scene model is processed into an icon, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, thereby realizing two-dimensional guidance of three-dimensional.
[0012] The preset start and end coordinates in the two-dimensional image are input into a preset route adjustment algorithm to obtain the optimal route of the element, and the element is moved according to the optimal route.
[0013] In conjunction with the first aspect, the equalization preprocessing further includes Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction;
[0014] The Gaussian filtering is performed using the following formula:
[0015]
[0016] Wherein, g(x) i ,y j () represents the value in the template, fcolor(x) i ,y j (i,j) represents a two-dimensional image, Gcolor(x,y) represents a smoothed two-dimensional image obtained by Gaussian filtering, and (i,j) represents the pixel coordinates of the two-dimensional image;
[0017] The thresholding segmentation is performed using the following method:
[0018] Calculate the minimum gray value Z1 and the maximum gray value Z of the image. k Let the initial threshold value be...
[0019] Repeat the following iterative steps until the new threshold after a certain iteration equals the old threshold after the previous iteration, to obtain the optimal threshold. Then, perform thresholding segmentation on the image based on the optimal threshold:
[0020] The image is segmented into a target region and a background region based on an initial threshold value. The average gray value Z0 of the target region and the average gray value Z of the background region are then calculated using the following formula. B :
[0021]
[0022]
[0023] Where Z(i,j) represents the gray value of the (i,j) coordinate point in the image, and N(i,j) represents the weight coefficient of the (i,j) coordinate point in the image;
[0024] Based on the average gray value Z0 of the target area and the average gray value Z of the background area B Calculate the new threshold:
[0025]
[0026] The image edge detection uses a gradient operator to detect image edges, thereby achieving contour line detection;
[0027] The feature contour extraction is performed by the following method: binarizing the image and setting each pigment in the image to black / white;
[0028] The two-dimensional image is sequentially subjected to Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction to obtain a two-dimensional contour map.
[0029] In conjunction with the first aspect, the three-dimensional model of the element is further constructed in advance using three-dimensional modeling software.
[0030] In conjunction with the first aspect, the state, attributes, and dynamics of the element are further configured through the programming capabilities of the virtual reality engine.
[0031] In conjunction with the first aspect, further, the fusion of all elements includes: enabling communication between all the dispersed elements through the programming capabilities of the virtual reality engine, thereby completing the fusion.
[0032] In conjunction with the first aspect, the optimal route is further calculated using the following method:
[0033] In a two-dimensional image, the preset starting point coordinates A are (x, y), the ending point coordinates B are (x1, y1), and the coordinates of the highest point P between the starting and ending points are (x1, y1). p ,y p If the distances between AP and PB are Q1 and Q2 respectively, then the distances between AP and PB are Q1 and Q2 respectively.
[0034]
[0035]
[0036] By supplementing the coordinates of each point in the 2D image into 3D coordinates, we obtain the distance F between the highest point of the element's starting point and the element's starting and ending points in the 3D scene model, and the distance G between the highest point of the element's ending point and the element's starting and ending points.
[0037]
[0038]
[0039] Where z is the z-axis coordinate of the element's starting point, z1 is the z-axis coordinate of the element's ending point, and z... p It is the z-axis coordinate of the highest point between the start and end points of the element;
[0040] By continuously reducing the values of Q1 and Q2, the route is optimized until the preset optimization goal is reached, thus obtaining the optimal route for the element.
[0041] Secondly, the present invention also provides a scene simulation device based on a virtual reality engine to implement two-dimensional guidance of three-dimensional simulation, comprising:
[0042] Image acquisition module: used to acquire two-dimensional images;
[0043] Iso-value preprocessing module: used to perform iso-value preprocessing on two-dimensional images to obtain two-dimensional contour maps;
[0044] Model building module: used to import the two-dimensional contour map into the virtual reality engine, build a three-dimensional scene model, and import the three-dimensional model of the pre-built elements into the virtual reality engine to add the elements to the three-dimensional scene model;
[0045] Situation assessment module: used to set the state, attributes and dynamics of the elements so that the 3D scene model can achieve a first-level situation assessment effect, and to merge all elements so that the 3D scene model can achieve a second-level situation assessment effect;
[0046] Class processing module: used to import the two-dimensional image into the top layer of the three-dimensional scene model, process each class in the three-dimensional scene model into icons, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, and realize two-dimensional guidance of three-dimensional.
[0047] Route optimization module: This module is used to input the preset start-point and end-point coordinates in the 2D image into a preset route adjustment algorithm to obtain the optimal route for the element, and then move the element according to the optimal route.
[0048] Thirdly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine as described in any of the first aspects.
[0049] Fourthly, the present invention also provides an apparatus comprising:
[0050] Memory, used to store instructions;
[0051] A processor is configured to execute the instructions, causing the device to perform a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, as described in any of the first aspects.
[0052] Compared with the prior art, the beneficial effects achieved by the present invention are:
[0053] This invention provides a method, apparatus, storage medium, and device for simulating three-dimensional scenes guided by two-dimensional virtual reality engines. It constructs a three-dimensional scene model using a virtual reality engine and imports two-dimensional images into the top layer of the three-dimensional scene model to achieve two-dimensional guidance for three-dimensional simulation. A preset route adjustment algorithm is used to optimize the optimal route for elements, and the elements are moved accordingly. This effectively solves the defects of low scene simulation accuracy and poor simulation effect in existing technologies, and the entire simulation process is reasonably simplified, greatly reducing manufacturing costs. Attached Figure Description
[0054] Figure 1 This is one of the flowcharts of a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, provided by an embodiment of the present invention;
[0055] Figure 2 This is a flowchart of the equivalent preprocessing provided in an embodiment of the present invention;
[0056] Figure 3 This is the second flowchart of a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, provided by an embodiment of the present invention. Detailed Implementation
[0057] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to illustrate the technical solution of the present invention more clearly, and should not be used to limit the scope of protection of the present invention.
[0058] Example 1
[0059] like Figure 1 As shown, this embodiment of the invention provides a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, including the following steps:
[0060] S1. Obtain a two-dimensional image.
[0061] In this embodiment, the two-dimensional image of the corresponding three-dimensional scene model to be constructed is captured and transmitted by a satellite.
[0062] S2. Perform isopleth preprocessing on the two-dimensional image to obtain a two-dimensional contour map.
[0063] like Figure 2As shown, based on the principles of digital image processing, the acquired two-dimensional image is filtered to remove noise and improve image recognition accuracy. Subsequently, image segmentation is performed using optimal thresholding. In this embodiment, the threshold is selected using an iterative algorithm to determine the optimal image segmentation threshold, dividing the image into target and background parts. Background image edge detection is then randomly performed on the segmented image to detect contour information. Next, feature contour extraction is performed on the edge-detected image to obtain a two-dimensional contour map containing contour lines, preparing for the next step of constructing a three-dimensional scene model using contour lines. Simultaneously, three-dimensional models of elements (vehicles, warships, tanks, missiles, fighter jets, etc.) are constructed using 3D modeling software, preparing for the next step of importing elements.
[0064] The aforementioned filtering, image segmentation, edge detection, and feature contour extraction specifically refer to Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction. The specific processes include:
[0065] (1) Gaussian filtering is performed using the following formula:
[0066]
[0067] Wherein, g(x) i ,y j () represents the value in the template, fcolor(x) i ,y j (i,j) represents a two-dimensional image, Gcolor(x,y) represents a smoothed two-dimensional image obtained by Gaussian filtering, and (i,j) represents the pixel coordinates of the two-dimensional image.
[0068] (2) Thresholding segmentation is performed using the following method:
[0069] Calculate the minimum gray value Z1 and the maximum gray value Z of the image. k Let the initial threshold value be...
[0070] Repeat the following iterative steps until the new threshold after a certain iteration equals the old threshold after the previous iteration, to obtain the optimal threshold. Then, perform thresholding segmentation on the image based on the optimal threshold:
[0071] The image is segmented into a target region and a background region based on an initial threshold value. The average gray value Z0 of the target region and the average gray value Z of the background region are then calculated using the following formula. B :
[0072]
[0073]
[0074] Where Z(i,j) represents the gray value of the (i,j) coordinate point in the image, and N(i,j) represents the weight coefficient of the (i,j) coordinate point in the image;
[0075] Based on the average gray value Z0 of the target area and the average gray value Z of the background area B Calculate the new threshold:
[0076] (3) Image edge detection uses gradient operators to detect image edges, thereby realizing contour line detection.
[0077] Image edges refer to the set of pixels around an image whose pixel values exhibit abrupt or tilting changes; that is, the parts of the image where local changes are most significant. Contour information, or contour lines, of various targets in the image is detected. Changes in image grayscale can be reflected by the gradient of the grayscale distribution. Given an image function f(x,y), its directional derivative reaches a local maximum along the edge normal direction.
[0078] Edge detection involves finding the local maximum and direction of the gradient of f(x,y). This method uses a gradient operator to detect edges. The gradients g1(x,y) and g2(x,y) on two positive directions h1 and h2 are as follows:
[0079] g1(x,y)=f(x,y)×H1(x,y)
[0080] g2(x,y)=f(x,y)×H2(x,y)
[0081] Here, H1(x,y) represents the gradient operator in the h1 direction, and H2(x,y) represents the gradient operator in the h2 direction. The two gradient operators are orthogonal to each other.
[0082] The strength and direction of the edge can be calculated using the following two formulas:
[0083]
[0084]
[0085] The above algorithm can be used to perform edge detection on images.
[0086] (4) Feature contour extraction is performed by binarizing the image and setting each pigment in the image to black / white.
[0087] Feature contour extraction: This involves extracting contour information obtained after edge detection. Image binarization is then performed, setting each pixel to either black or white. The key to binarization lies in the choice of threshold T. In dynamic thresholding algorithms, the threshold selection depends not only on the grayscale value of the pixel and its surrounding pixels but also on the pixel's coordinate position. Therefore, dynamic thresholding algorithms can handle low-quality images, even those with single-peak histograms. Dynamic thresholding is represented by a ternary function threshold operator.
[0088] T = T[g]<i,j> N<i,j> ,<i,j> ]
[0089] In the formula, (i,j) are the pixel coordinates of the image, N(i,j) is the gray-level feature distribution around (i,j), and the contour map is obtained after feature contour extraction.
[0090] Two-dimensional contour maps are obtained by sequentially performing Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction on a two-dimensional image.
[0091] Contour lines are the lines of intersection between an object and a specific plane. They not only largely reflect the shape characteristics of the object but also convey the overall changes in the object through the similarity in shape between adjacent contour lines. Contour lines are a type of contour line. Contour lines not only record and describe changes in terrain undulations through their own shape and form, but also utilize the similarity in shape between adjacent contour lines to achieve three-dimensional terrain reconstruction.
[0092] S3. Import the two-dimensional contour map into the virtual reality engine to construct a three-dimensional scene model. Import the pre-constructed three-dimensional model of the elements into the virtual reality engine to add the elements to the three-dimensional scene model.
[0093] like Figure 3 As shown, step S3 is executed using the following method: The virtual reality engine has fast and convenient functions, which can quickly create a rough 3D terrain and landform. Then, the terrain editing tools of the virtual reality engine can be used to fine-tune it, so as to realize the construction of a detailed 3D scene model. At the same time, the virtual reality engine also has the function of quickly importing 3D models of elements, providing skeletal or mesh models for subsequent compilation of blueprints. By using the material editing function of the virtual reality engine, the elements are given materials that approximate real elements in the real scene. Through the above methods, an extremely realistic simulation of a 3D scene model can be achieved.
[0094] S4. Set the state, attributes, and dynamics of the elements to achieve a first-level situational assessment effect for the three-dimensional scene model, and merge all elements to achieve a second-level situational assessment effect for the three-dimensional scene model.
[0095] like Figure 3 As shown, step S4 is executed using the following method:
[0096] By utilizing the object-oriented blueprint programming capabilities of the virtual reality engine, the blueprint compilation process assigns relationships and characteristics to elements, compiling individual weapon or equipment models into blueprints. At this point, the constructed 3D scene model achieves the effect of a first-level situational assessment.
[0097] By utilizing the programming capabilities of the virtual reality engine, the scattered elements of the primary situation are integrated, enabling communication between the elements and thus achieving fusion to form a unified system. In other words, programming is performed at the overall level to enable communication and connection between the elements. At this point, the constructed 3D scene model achieves the effect of secondary situation assessment.
[0098] S5. Import the two-dimensional image into the top layer of the three-dimensional scene model, process each class in the three-dimensional scene model into an icon, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, and realize two-dimensional guidance for three-dimensional.
[0099] like Figure 3 As shown, step S5 is executed using the following method:
[0100] The Gaussian-filtered and denoised 2D image is imported into the 3D scene model. The user interface of the virtual reality engine is designed so that the 2D image is displayed on the top layer of the 3D scene model. At the same time, the display of each class in the 3D scene model on the 2D image is processed and the classes are processed into icons so that each class can achieve the real-time display position of the 2D layer in the 3D scene model, thus preparing for 2D to guide 3D.
[0101] S6. Input the preset start point coordinates and end point coordinates in the two-dimensional image into the preset route adjustment algorithm to obtain the optimal route of the element, and move the element according to the optimal route.
[0102] The optimal route is calculated using the following method:
[0103] In a two-dimensional image, the preset starting point coordinates A are (x, y), the ending point coordinates B are (x1, y1), and the coordinates of the highest point P between the starting and ending points are (x1, y1). p ,y p If the distances between AP and PB are Q1 and Q2 respectively, then the distances between AP and PB are Q1 and Q2 respectively.
[0104]
[0105]
[0106] By supplementing the coordinates of each point in the 2D image into 3D coordinates, we obtain the distance F between the highest point of the element's starting point and the element's starting and ending points in the 3D scene model, and the distance G between the highest point of the element's ending point and the element's starting and ending points.
[0107]
[0108]
[0109] Where z is the z-axis coordinate of the element's starting point, z1 is the z-axis coordinate of the element's ending point, and z... p It is the z-axis coordinate of the highest point between the start and end points of the element;
[0110] By continuously reducing the values of Q1 and Q2, the route is optimized until the preset optimization goal is reached, thus obtaining the optimal route for the element.
[0111] The optimal route can also be calculated using the following method: In the process of establishing the optimal route trajectory, the weapon's direction of travel and the relationship between various objects in the environment are used to determine the constraints and relationships of the weapon's movement; the constraints include collisions between mountains, ground, and rivers.
[0112] The motion algorithm for the trajectory is as follows:
[0113] According to the formula for projectile motion:
[0114]
[0115] During the straight flight of an aircraft, the missile-type weapon launched can be adjusted according to this formula. The value of m is continuously changed to adjust the trajectory. v0 represents the initial velocity of the aircraft, g represents the gravitational acceleration, m represents the variable to be adjusted, and x(m) represents the trajectory of the projectile.
[0116] The formula for the length of projectile motion is as follows:
[0117]
[0118] Ultimately, the optimal route is determined by considering factors such as the minimum projectile motion length s when hitting the target, t (time), and the number of enemy troops.
[0119] Let the velocity of the projectile during its motion be v, and let the three directions in a three-dimensional Cartesian coordinate system be x, y, and z. Then the velocities in the x, y, and z directions are respectively:
[0120]
[0121]
[0122]
[0123] in, Represents the unit vector in the x-direction. Represents the unit vector in the y-direction. This represents the unit vector in the z-direction.
[0124] The total directional velocity of the object is:
[0125]
[0126] In real-world environments, the main resistance forces are gravity and air resistance. The resistance forces in the x, y, and z directions are as follows:
[0127]
[0128]
[0129]
[0130] The values of acceleration in the x, y, and z directions are:
[0131]
[0132] Among them, v x G represents the velocity in the x-direction. x v represents acceleration in the x-direction. y G represents the velocity in the y-direction. y v represents acceleration in the y-direction. z G represents the velocity in the z-direction. z This represents the acceleration in the z-direction.
[0133] During the process of establishing the optimal trajectory, the missile launched by the tank moves in a parabolic motion, as shown in the following equation:
[0134] y = ax 2 +bx+c
[0135] The curvature of the parabola is changed by continuously adjusting the values of constant coefficients a, b, and c at the frame rate. a, b, and c represent the quadratic coefficient, the linear coefficient, and the constant coefficient, respectively.
[0136] Example 2
[0137] This invention also provides a device for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, comprising:
[0138] Image acquisition module: used to acquire two-dimensional images;
[0139] Iso-value preprocessing module: used to perform iso-value preprocessing on two-dimensional images to obtain two-dimensional contour maps;
[0140] Model building module: used to import the two-dimensional contour map into the virtual reality engine, build a three-dimensional scene model, and import the three-dimensional model of the pre-built elements into the virtual reality engine to add the elements to the three-dimensional scene model;
[0141] Situation assessment module: used to set the state, attributes and dynamics of the elements so that the 3D scene model can achieve a first-level situation assessment effect, and to merge all elements so that the 3D scene model can achieve a second-level situation assessment effect;
[0142] Class processing module: used to import the two-dimensional image into the top layer of the three-dimensional scene model, process each class in the three-dimensional scene model into icons, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, and realize two-dimensional guidance of three-dimensional.
[0143] Route optimization module: This module is used to input the preset start-point and end-point coordinates in the 2D image into a preset route adjustment algorithm to obtain the optimal route for the element, and then move the element according to the optimal route.
[0144] Example 3
[0145] This invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the following method:
[0146] Acquire a two-dimensional image;
[0147] The two-dimensional image is preprocessed with isopleths to obtain a two-dimensional contour map;
[0148] The two-dimensional contour map is imported into the virtual reality engine to construct a three-dimensional scene model. The three-dimensional models of the pre-constructed elements are then imported into the virtual reality engine to add the elements to the three-dimensional scene model.
[0149] The state, attributes, and dynamics of the elements are set to enable the 3D scene model to achieve a first-level situational assessment effect, and all elements are merged to enable the 3D scene model to achieve a second-level situational assessment effect.
[0150] The two-dimensional image is imported into the top layer of the three-dimensional scene model, and each class in the three-dimensional scene model is processed into an icon, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, thereby realizing two-dimensional guidance of three-dimensional.
[0151] The preset start and end coordinates in the two-dimensional image are input into a preset route adjustment algorithm to obtain the optimal route of the element, and the element is moved according to the optimal route.
[0152] Example 4
[0153] This invention provides a device comprising:
[0154] Memory, used to store instructions;
[0155] A processor is configured to execute the instructions, causing the device to perform the steps of implementing the following method:
[0156] Acquire a two-dimensional image;
[0157] The two-dimensional image is preprocessed with isopleths to obtain a two-dimensional contour map;
[0158] The two-dimensional contour map is imported into the virtual reality engine to construct a three-dimensional scene model. The three-dimensional models of the pre-constructed elements are then imported into the virtual reality engine to add the elements to the three-dimensional scene model.
[0159] The state, attributes, and dynamics of the elements are set to enable the 3D scene model to achieve a first-level situational assessment effect, and all elements are merged to enable the 3D scene model to achieve a second-level situational assessment effect.
[0160] The two-dimensional image is imported into the top layer of the three-dimensional scene model, and each class in the three-dimensional scene model is processed into an icon, so that each class can achieve the real-time display position in the two-dimensional layer in the three-dimensional scene model, thereby realizing two-dimensional guidance of three-dimensional.
[0161] The preset start and end coordinates in the two-dimensional image are input into a preset route adjustment algorithm to obtain the optimal route of the element, and the element is moved according to the optimal route.
[0162] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0163] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0164] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0165] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0166] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine, characterized in that, include: Acquire a two-dimensional image; The two-dimensional image is preprocessed with isopleths to obtain a two-dimensional contour map; The two-dimensional contour map is imported into the virtual reality engine to construct a three-dimensional scene model. The three-dimensional models of the pre-constructed elements are then imported into the virtual reality engine to add the elements to the three-dimensional scene model. Set the state, attributes, and dynamics of the elements to make the 3D scene model reach a first-level situation, and merge all elements to make the 3D scene model reach a second-level situation. The two-dimensional image is imported into the top layer of the three-dimensional scene model, and each class in the three-dimensional scene model is processed into an icon, so that the position of each class in the three-dimensional scene model is mapped to the real-time display position in the two-dimensional layer; each class is the class to which the element belongs; The preset start and end coordinates in the two-dimensional image are input into a preset route adjustment algorithm to obtain the optimal route of the element, and the element is moved according to the optimal route. Setting the state, attributes, and dynamics of the elements includes: using the programming capabilities of the virtual reality engine's object-oriented blueprint to assign relationships and characteristics between the elements, so that the three-dimensional scene model reaches a first-level state. The process of integrating all elements includes: using the programming capabilities of the virtual reality engine to integrate the scattered elements in the first-level situation, enabling communication between the elements, thereby completing the integration and forming a unified system, so that the three-dimensional scene model reaches the second-level situation. The optimal route is calculated using the following method: The preset starting point coordinates A in the two-dimensional image are The endpoint coordinates B are The coordinates of the highest point P between the starting point and the ending point are: The distance between APs Distance between PB and They are respectively: ; ; Convert the coordinates of each point in the 2D image to 3D coordinates to obtain the distance between the highest point and the starting point of an element in the 3D scene model. And the distance between the highest point of the element's endpoint and the element's start and end points. : ; ; in, It is the starting point of the element axis coordinate values, It is the end point of the element. axis coordinate values, It is the highest point between the start and end points of the element. Axis coordinate values; By continuously reducing and The value is used to optimize the route until the preset optimization goal is achieved, thus obtaining the optimal route for the element.
2. The method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine according to claim 1, characterized in that, The equalization preprocessing includes Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction; The Gaussian filtering is performed using the following formula: ; in, This represents the value in the template. Representing a two-dimensional image, This represents a smoothed two-dimensional image obtained by Gaussian filtering. , () represents the pixel coordinates of a two-dimensional image; The thresholding segmentation is performed using the following method: Calculate the minimum gray value of the image. and maximum grayscale value Let the initial threshold value be... ; Repeat the following iterative steps until the new threshold after a certain iteration equals the old threshold after the previous iteration, to obtain the optimal threshold. Then, perform thresholding segmentation on the image based on the optimal threshold: The image is segmented into target and background parts based on the initial threshold value. The average gray value of the target part is then calculated using the following formula. and the average gray value of the background area : ; ; in, Indicates the image ( , The grayscale value of the coordinate point. Indicates the image ( , The weighting coefficients of the coordinate points; Based on the average gray value of the target part and the average gray value of the background area Calculate the new threshold: ; The image edge detection uses a gradient operator to detect image edges, thereby achieving contour line detection; The feature contour extraction is performed by the following method: binarizing the image and setting each pigment in the image to black / white; The two-dimensional image is sequentially subjected to Gaussian filtering, thresholding segmentation, image edge detection, and feature contour extraction to obtain a two-dimensional contour map.
3. The method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine according to claim 1, characterized in that, The three-dimensional model of the element is pre-built using three-dimensional modeling software.
4. A scene simulation device based on a virtual reality engine to achieve two-dimensional guidance in three-dimensional space, characterized in that, include: Image acquisition module: used to acquire two-dimensional images; Iso-value preprocessing module: used to perform iso-value preprocessing on two-dimensional images to obtain two-dimensional contour maps; Model building module: used to import the two-dimensional contour map into the virtual reality engine, build a three-dimensional scene model, and import the three-dimensional model of the pre-built elements into the virtual reality engine to add the elements to the three-dimensional scene model; Situation assessment module: used to set the state, attributes and dynamics of the elements, so that the 3D scene model reaches the first-level situation, and to merge all elements to make the 3D scene model reach the second-level situation; Class processing module: used to import the two-dimensional image into the top layer of the three-dimensional scene model, process each class in the three-dimensional scene model into an icon, and map the position of each class in the three-dimensional scene model to the real-time display position in the two-dimensional layer; each class is the class to which the element belongs; Route optimization module: This module is used to input the preset start-point and end-point coordinates in the 2D image into a preset route adjustment algorithm to obtain the optimal route for the element, and then move the element according to the optimal route. The setting of the state, attributes and dynamics of the elements includes: using the programming function of the virtual reality engine's object-oriented blueprint to assign relationships and characteristics to the elements, so that the three-dimensional scene model reaches a first-level state. The process of integrating all elements includes: using the programming capabilities of the virtual reality engine to integrate the scattered elements in the first-level situation, enabling communication between the elements, thereby completing the integration and forming a unified system, so that the three-dimensional scene model reaches the second-level situation. The optimal route is calculated using the following method: The preset starting point coordinates A in the two-dimensional image are The endpoint coordinates B are The coordinates of the highest point P between the starting point and the ending point are: The distance between APs Distance between PB and They are respectively: ; ; Convert the coordinates of each point in the 2D image to 3D coordinates to obtain the distance between the highest point and the starting point of an element in the 3D scene model. And the distance between the highest point of the element's endpoint and the element's start and end points. : ; ; in, It is the starting point of the element axis coordinate values, It is the end point of the element. axis coordinate values, It is the highest point between the start and end points of the element. Axis coordinate values; By continuously reducing and The value is used to optimize the route until the preset optimization goal is achieved, thus obtaining the optimal route for the element.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine as described in any one of claims 1-3.
6. A device, characterized in that, include: Memory, used to store instructions; A processor is configured to execute the instructions, causing the device to perform a method for simulating a two-dimensional guided three-dimensional scene based on a virtual reality engine as described in any one of claims 1-3.
Citation Information
Patent Citations
Interaction method and system for two-dimensional element and three-dimensional element in virtual reality environment
CN108564660A
Medical image three-dimensional reconstruction simulation method and system
CN113838557A
Multi-domain battlefield situation element simulation and path planning method
CN115392014A
