CN108765556B - Dynamic 3D real-time modeling method based on improved particle swarm optimization - Google Patents

Dynamic 3D real-time modeling method based on improved particle swarm optimization Download PDF

Info

Publication number
CN108765556B
CN108765556B CN201810489957.5A CN201810489957A CN108765556B CN 108765556 B CN108765556 B CN 108765556B CN 201810489957 A CN201810489957 A CN 201810489957A CN 108765556 B CN108765556 B CN 108765556B
Authority
CN
China
Prior art keywords
length
room
particle
module
vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810489957.5A
Other languages
Chinese (zh)
Other versions
CN108765556A (en
Inventor
郭文忠
陈景辉
贺国荣
董晨
郑朝鑫
陈荣忠
熊子奇
林诗洁
张凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou University
Original Assignee
Fuzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuzhou University filed Critical Fuzhou University
Priority to CN201810489957.5A priority Critical patent/CN108765556B/en
Publication of CN108765556A publication Critical patent/CN108765556A/en
Application granted granted Critical
Publication of CN108765556B publication Critical patent/CN108765556B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]

Abstract

The invention provides a dynamic 3D real-time modeling method based on an improved particle swarm algorithm, which comprises the following steps: step S0: providing a decoration preview system, which comprises a scanning module, a recording module, a calculating module, an importing model module, a mapping module and a display module; step S1: the scanning module and the recording module are cooperated to complete the calibration work of the space vector information of 8 corners of the room to be simulated, record the gyroscope parameters and solve the space vector data as the output parameters; step S2: calling an intelligent algorithm by the core of the calculation module, receiving the output parameters of the step S1, and calculating to obtain room and user height unit length data which are in equal proportion to the cubic room and serve as the output parameters; step S3: the 3D engine is called by the import model module, and the 3D model of the room is dynamically created by receiving the output parameters of step S2. The improved particle swarm algorithm of the invention increases the diversity of the particles to control the convergence rate and improve the search accuracy.

Description

Dynamic 3D real-time modeling method based on improved particle swarm optimization
Technical Field
The invention relates to a dynamic 3D real-time modeling method based on an improved particle swarm algorithm.
Background
At present, the following research results are obtained in a 3D modeling mode: the relatively popular 3D modeling mode abroad is a three-dimensional laser scanning point cloud modeling mode, and Bahman Jafari et al show that the modeling mode can achieve extremely high model precision, and the showing force of model details is very strong, but the method has very high requirements on hardware, and only a high-performance computer can process and complete a 3D modeling task. Reem S et al propose a 3D modeling approach to matting from 2D pictures, which belongs to a three-dimensional reconstruction technique, with fast modeling speed and high efficiency, but with low accuracy. Zhang Wei et al proposed a 3D modeling method called surface modeling, but the method has a small application range and can only exert technical advantages in the modeling requirements of surface objects.
Disclosure of Invention
In order to solve the defect that the measurement of the traditional domestic 3D modeling technology is inaccurate, the invention provides the 3D modeling method which can realize real-time equal-proportion room modeling, and a user can preview the decoration effect of all directions of the whole room, so that the user has visual impression on the whole decoration effect of the room, and the method is convenient to operate and strong in real-time performance.
In order to achieve the purpose, the invention adopts the following technical scheme: a dynamic 3D real-time modeling method based on an improved particle swarm optimization algorithm comprises the following steps: step S0: providing a decoration preview system, which comprises a scanning module, a recording module, a calculating module, an importing model module, a mapping module and a display module; step S1: the scanning module and the recording module are cooperated to complete the calibration work of the space vector information of 8 corners of the room to be simulated, record the gyroscope parameters and solve the space vector data as the output parameters; step S2: calling an intelligent algorithm by the core of the calculation module, receiving the output parameters of the step S1, and calculating to obtain room and user height unit length data which are in equal proportion to the cubic room and serve as the output parameters; step S3: the 3D engine is called by the import model module, and the 3D model of the room is dynamically created by receiving the output parameters of step S2.
In an embodiment of the present invention, the manual calibration method of the scan module in step S1 is as follows: standing at the center of the room, aligning a camera of the mobile equipment to the vertex position of a corner of each wall, and then clicking a manual touch screen to calibrate and record the spatial attitude information of the mobile equipment at the calibration moment; because the local coordinate system corresponding to the mobile phone posture changes at any time, the world coordinate system required by the 3D engine is defined as the local coordinate system q (t) of the instant posture of the mobile phone equipment when the system initializes the gyroscope;
the mathematical expression for the world coordinate system q (t) is as follows:
Figure BDA0001667390530000021
where α is a mathematical sign that the gyroscope represents an angle roll of rotation about the x-axis, β is a mathematical sign that the gyroscope represents an angle yaw of rotation about the y-axis, γ is a mathematical sign that the gyroscope represents an angle pitch of rotation about the z-axis, and w is an inertial weight, the mathematical expression of the rotation matrix r (t) at any time t based on the world coordinate system is as follows:
Figure BDA0001667390530000022
when a rotation matrix at the moment of initializing the gyroscope is defined as R (t is 0), and the values of α, β, and γ of the gyroscope are recorded at the time when t is 0, and the value of the rotation matrix R (0) can be obtained, the mathematical expression of the world coordinate system is as follows:
Figure BDA0001667390530000023
further, the method for the recording module to solve the wall angle vector is as follows: if the center position of the mass point in the cubic room is taken as the origin position of the three-dimensional coordinate system, the origin position is the position of the eyes of the user in the room; the three-dimensional coordinate values of the wall corners of the eight vertexes are that the vector length of the eight wall corners is 1A unit value; the eight vertices are defined as: v1、V2、V3、V4、V5、V6、V7、V8Each vertex vector is formed by V(x,y,z)Determining the form of the target; definition of
Length(V1)=Length(V2)=Length(V5)=Length(V6) After defining the Length of unit 1, a variable lambda is introduced to make Length (V)3)=λLength(V1) λ, leading to a conclusion of Length (V)3)=Length(V4)=Length(V7)=Length(V8) λ; the vector length is represented by the unit 1 or variable λ; suppose V1-V8The measurement is objectively accurate, and the real value of the variable lambda is obtained, so that the vertex coordinate information of the cubic room is obtained; wherein V1-V8The real values of the components x and y of each dimension in the vector and the actual length and width of the room are in an equal proportional numerical relationship, the proportional real values are set as a scaling coefficient k, and the calculation method of the scaling coefficient k is as follows:
Figure BDA0001667390530000024
Figure BDA0001667390530000025
wherein Width, Length and Height respectively represent the Width of the room, and Bodyheight is the Height of the user.
In an embodiment of the present invention, the intelligent algorithm called in step S2 is an improved particle swarm optimization algorithm, and the specific steps are as follows: step 1: determining the solution space dimension, the population scale and the iteration number of algorithm control of an optimization target, initializing various parameters of the algorithm, and initializing the initial position and the initial speed of each particle in the particle swarm by using random numbers; step 2: calculating the current position X of each particle in the populationiAn adaptation value of; and step 3: comparing the individual adaptive value with all other individual adaptive values in the population, and preferentially obtainingThe optimal adaptive value P of the population in the iterative calculation; and 4, step 4: comparing the optimal adaptive value P obtained by the iterative calculation of the population with the global optimal adaptive value obtained by the history experience of the population to obtain an updated global optimal adaptive value G; and 5: calculating the speed and position of each particle in the population by utilizing the particle position in the standard particle swarm algorithm and an updating formula of iterative calculation thereof, and updating the data information of the position and the speed of the particle; step 6: judging whether the particles have finished searching and reach the global optimal position; if the condition is not met, returning to the step 2 to perform a new round of iterative calculation; and 7: setting a mark, carrying out random initialization on the particle position, and canceling a cognitive item parameter and a flight speed vector parameter; and 8: utilizing an initialization formula of an initial position and an initial speed of each particle to preprocess all directions of a four-dimensional vector representing the positions of the particles, and calculating optimal adaptive values of all directions, wherein the direction corresponding to the optimal adaptive value is taken as the flight direction of the particles; and step 9: judging whether the optimal positions of the particles break through the global optimal adaptive value, if so, canceling the marks set in the step 7, recovering the cognitive item parameters and flight speed vector parameters of all the particles, and jumping to the step 2 to perform a new round of iterative calculation; step 10: judging whether an end condition is met or not, judging whether the iterative computation reaches a preset maximum iterative frequency or not, and returning to the step 8 to perform a new iterative computation if the end condition is not met; step 11: and finishing the algorithm.
In an embodiment of the present invention, the method for initializing the initial position and the initial velocity of each particle is as follows:
α=c×rand(0,1)
X3′={w×X3+α,w×X3-α,w×X3+α,w×X3+α}
X4′={w×X4-α,w×X4-α,w×X4+α,w×X4+α}
X5′={w×X5+α,w×X5+α,w×X5-α,w×X5+α}
X6′={w×X6-α,w×X6+α,w×X6-α,w×X6+α}
X7′={w×X7+α,w×X7-α,w×X7-α,w×X7+α}
X8′={w×X8-α,w×X8-α,w×X8-α,w×X8+α}
X9′={w×X9+α,w×X9+α,w×X9+α,w×X9-α}
X10′={w×X10-α,w×X10+α,w×X10+α,w×X10-α}
X11′={w×X11+α,w×X11-α,w×X11+α,w×X11-α}
X12′={w×X12-α,w×X12-α,w×X12+α,w×X12-α}
X13′={w×X13+α,w×X13+α,w×X13-α,w×X13-α}
X14′={w×X14-α,w×X14+α,w×X14-α,w×X14-α}
X15′={w×X15-α,w×X15-α,w×X15-α,w×X15-α}
wherein c is a cognitive term learning factor of the particle; w is the inertial weight; xi' is the initial position of each particle; alpha is a random interference factor; the criteria for determining whether a particle has completed a search to reach the global optimal location are as follows:
|V1|<0.000001AND|V2|<0.000001 AND|V3|<0.000001AND|V4|<0.00000001
the fitness calculation method comprises the following steps:
Figure BDA0001667390530000041
wherein, DetaOffsetiRepresenting a vectorA length value of the difference;
length value of vector difference DetaOffsetiThe calculation method is as follows:
Figure BDA0001667390530000045
wherein, Vi8 vectors, V, representing the scalingxi8 vectors, V, representing possible solutionsiAnd VxiThe corresponding values are all values obtained through vector unitization; the mathematical expressions for x, y, z are as follows:
x=Width÷2
y=Length÷2
zup=Height-BodyHeight
zdown=BodyHeight
wherein Width is the Width of the room, Length is the Length of the room, Height is the Height of the room, and BodyHeight is the Height of the user;
scaled 8 vectors ViThe mathematical expression of (a) is as follows:
V1={-x,y,zup},V2={x,y,zup}
V3={-x,y,-zdown},V4={x,y,-zdown}
V5={x,-y,zup},V6={-x,-y,zup}
V7={x,-y,-zdown},V8={-x,-y,-zdown}
wherein z isupRepresenting the difference in height between the room height and the height of the user, zdownRepresenting the height of the user.
The calculation method of vector unitization is as follows:
Figure BDA0001667390530000042
Figure BDA0001667390530000043
Figure BDA0001667390530000044
unitVectori={Vi.x÷Length,Vi.y÷Length,Vi.z÷Length}
wherein unit vector represents a unitized vector, and Vi represents coordinate information of the ith vertex of the cubic room;
the updating formula of the particle position and the iterative calculation in the standard particle swarm optimization is as follows:
Vi′=w×Vi+c1×r1×(P-Xi)+c2×r2×(G-Xi)
X′=X+V′
where Vi represents the velocity of the particle flight; vi' represents the update speed of the particle; x represents the original position of the particle; x' represents the updated position of the particle; w is the inertial weight; random number r1、r2∈(0,1);c1、c2Is a learning factor.
Furthermore, the vectors at different positions have different formula of unit selection, and the lambda coefficient exists and is determined by the height difference of the user; λ is equal to 1 when the user height is exactly equal to half the room height.
Preferably, the value of the cognitive term learning factor c of the particle is 3; the inertial weight w takes the value 0.8.
Compared with the prior art, the invention provides an improved particle swarm algorithm, which increases the diversity of particles to control the convergence speed and improve the search precision; the method comprises the steps of taking the length, width and height of a room to be solved and the position data of a virtual 3D camera represented by the height of a user as one possible solution in a multi-dimensional space, performing search calculation in the multi-dimensional space by utilizing a particle swarm algorithm, finally obtaining a feasible solution with the minimum calibration vector error, setting optimal parameters required by dynamic 3D modeling, and greatly improving the sense of reality of the experience of the on-site user after 3D modeling is performed according to the system.
Drawings
FIG. 1 is a modular division of the finishing system;
FIG. 2 is a flow diagram of a dynamic 3D real-time modeling technique based on an improved particle swarm algorithm;
fig. 3 is a diagram showing a positional relationship between a cubic room and a coordinate system.
Detailed Description
The invention is further explained below with reference to the figures and the specific embodiments.
The method adopts a dynamic 3D modeling technology, virtual 3D camera position data represented by the length, width and height of a room to be solved and the height of a user are taken as one possible solution in a multi-dimensional space, a particle swarm algorithm is utilized to search and calculate in the multi-dimensional space, finally, a feasible solution with the minimum calibration vector error is obtained, optimal parameters required by dynamic 3D modeling are set, and after 3D modeling is carried out according to the system, the reality of field user experience is greatly improved.
The invention mainly comprises the following steps: step S0: providing a decoration preview system, which comprises a scanning module, a recording module, a calculating module, an importing model module, a mapping module and a display module; step S1: the scanning module and the recording module are cooperated to complete the calibration work of the space vector information of 8 corners of the room to be simulated, record the gyroscope parameters and solve the space vector data as the output parameters; step S2: calling an intelligent algorithm by the core of the calculation module, receiving the output parameters of the step S1, and calculating to obtain room and user height unit length data which are in equal proportion to the cubic room and serve as the output parameters; step S3: the 3D engine is called by the import model module, and the 3D model of the room is dynamically created by receiving the output parameters of step S2.
Fig. 1 shows a decoration preview system according to the present invention, which is composed of six modules, namely, a scanning module, a recording module, a calculating module, an importing model module, a mapping module, and a display module.
Referring to fig. 2, the present invention provides a dynamic 3D real-time modeling technique based on an improved particle swarm optimization, which is characterized by comprising the following steps:
step S1: the scanning module cooperates with the recording module to finish the calibration work of the space vector information of 8 corners of the room, record the gyroscope parameter and solve the space vector data as the output parameter;
in an embodiment of the present invention, a manual calibration method for a scan module includes the following steps:
standing at the center of a room, aligning the camera of the mobile device with the vertex position of a corner of each wall, and then manually clicking a touch screen to calibrate and record the spatial attitude information of the mobile device at the calibration time. Since the local coordinate system corresponding to the pose of the mobile phone changes at any time, the world coordinate system required by the 3D engine is defined as the local coordinate system q (t) of the instantaneous pose of the mobile phone device when the system initializes the gyroscope.
The mathematical expression for the world coordinate system q (t) is as follows:
Figure BDA0001667390530000061
where α is a mathematical symbol indicating an angle roll of rotation around the x-axis by the gyroscope, β is a mathematical symbol indicating an angle yaw of rotation around the y-axis by the gyroscope, and γ is a mathematical symbol indicating an angle pitch of rotation around the z-axis by the gyroscope, the mathematical expression of the rotation matrix r (t) based on the world coordinate system at an arbitrary time t is as follows:
Figure BDA0001667390530000062
when a rotation matrix at the moment of initializing the gyroscope is defined as R (t is 0), and the values of α, β, and γ of the gyroscope are recorded at the time when t is 0, and the value of the rotation matrix R (0) can be obtained, the mathematical expression of the world coordinate system is as follows:
Figure BDA0001667390530000063
in an embodiment of the invention, the method for calculating the corner vector by the recording module comprises the following steps:
as shown in fig. 3, the solid geometric meaning represented by the direction of the wall corner vector is described as follows: if the center position of the mass point of the cubic room is taken as the origin position of the three-dimensional coordinate system, the origin position is the position of the eyes of the person in the room. The three-dimensional coordinate values of the corners of the eight vertexes are unit values with the vector length of 1 of the eight corners. The eight vertices are defined as: the eight vertices are defined as: v1、V2、V3、V4、V5、V6、V7、V8Each vertex vector is formed by V(x,y,z)Is determined. The characteristic in the coordinate system of the cubic room is V1、V2、V5、V6Are of equal length, V3、V4、V7、V8Are also equal in length. If the origin O is at the very center of the cubic room, then V1-V8All vectors of (a) are equal in length.
Define Length (V)1)=Length(V2)=Length(V5)=Length(V6) After defining the Length of unit 1, a variable lambda is introduced to make Length (V)3)=λLength(V1) λ, the conclusion of Length (V) can be reached3)=Length(V4)=Length(V7)=Length(V8) λ. The vector length may be represented by the unit 1 or the variable λ. Suppose V1-V8The measurement of (2) is objectively accurate, and the vertex coordinate information of the cubic room can be obtained only by obtaining the real value of the variable lambda.
Wherein V1-V8The real values of the components x and y of each dimension in the vector and the actual length and width of the room are in an equal proportional numerical relationship, the proportional real values are set as a scaling coefficient k, and the calculation method of the scaling coefficient k is as follows:
Figure BDA0001667390530000071
Figure BDA0001667390530000072
wherein Width is the Width of the room, Length is the Length of the room, Height is the Height of the room, and BodyHeight is the Height of the user;
step S2: the core of the calculation module calls an intelligent algorithm, receives the output parameters of the first part, and calculates to obtain room and user height unit length data which are in equal proportion to the cubic room and serve as the output parameters;
in an embodiment of the present invention, the called intelligent algorithm is an improved particle swarm optimization algorithm, and the specific steps are as follows:
step 1: determining the solution space dimension of an optimization target, the population scale, the iteration number of algorithm control, initializing various parameters of the algorithm, and initializing the initial position and the initial speed of each particle in the particle swarm by using random numbers.
Step 2: calculating the current position X of each particle in the populationiThe adaptive value of (a).
And step 3: and comparing the individual adaptive value with all other individual adaptive values in the population, and preferentially obtaining the optimal adaptive value P of the population in the iterative calculation.
And 4, step 4: and comparing the optimal adaptive value P obtained by the iterative calculation of the population with the global optimal adaptive value obtained by the history experience of the population to obtain an updated global optimal adaptive value G.
And 5: and calculating the speed and the position of each particle in the population by using the particle position in the standard particle swarm algorithm and an updating formula of iterative calculation thereof, and updating the data information of the position and the speed of the particle.
Step 6: it is determined whether the particle has completed the search to reach the global optimum. And if the condition is not met, returning to the step 2 to perform a new round of iterative calculation.
And 7: and setting a mark, carrying out random initialization on the particle position, and canceling the recognition item parameter and the flight speed vector parameter.
And 8: and utilizing an initialization formula of the initial position and the initial speed of each particle to preprocess all directions of the four-dimensional vector representing the positions of the particles, and calculating the optimal adaptive values of all the directions, wherein the direction corresponding to the optimal adaptive value is taken as the flight direction of the particles.
And step 9: and (3) judging whether the optimal position of the particle breaks through the global optimal adaptive value, if so, canceling the mark set in the step (7), recovering the cognitive item parameters and the flight speed vector parameters of all the particles, and jumping to the step (2) to perform a new round of iterative calculation.
Step 10: and judging whether the end condition is met or not, judging whether the iterative computation reaches the preset maximum iterative times or not, and returning to the step 8 to perform a new iterative computation if the end condition is not met.
Step 11: and finishing the algorithm.
The iterative process data analysis of the global optimum value of the improved particle swarm optimization algorithm according to the embodiment of the invention is shown in table 1.
TABLE 1
Figure BDA0001667390530000081
In table 1, the data indicates that the algorithm obviously falls into a local optimum search state after 78 iterations, the update of the global optimum adaptive value converges at the position of 96 iterations, and the comparison of the target solution can find that the second dimension data falls into local optimum when the global search is performed. From the data of the 97 th iteration, it can be seen that a breakthrough occurs in the improved algorithm in the current iteration, wherein the position of one particle obtains a new optimal adaptive value 0.830331 in the global traversal search due to the improved algorithm, the breakthrough of the adaptive value is very obvious compared with the previous search, and the particle position X is {0.516164,0.483016,0.724685,0.262956}, and compared with the target solution, it can be found that although the data of the first dimension, the third dimension, and the fourth dimension are more dispersed and farther than the previous one, the breakthrough search of the data of the second dimension approaches the target solution in the global scope, so the adaptive value of the particle becomes the global optimal adaptive value and becomes a new core particle of the improved algorithm.
The method for initializing the initial position and initial velocity of each particle is as follows:
α=c×rand(0,1)
X3′={w×X3+α,w×X3-α,w×X3+α,w×X3+α}
X4′={w×X4-α,w×X4-α,w×X4+α,w×X4+α}
X5′={w×X5+α,w×X5+α,w×X5-α,w×X5+α}
X6′={w×X6-α,w×X6+α,w×X6-α,w×X6+α}
X7′={w×X7+α,w×X7-α,w×X7-α,w×X7+α}
X8′={w×X8-α,w×X8-α,w×X8-α,w×X8+α}
X9′={w×X9+α,w×X9+α,w×X9+α,w×X9-α}
X10′={w×X10-α,w×X10+α,w×X10+α,w×X10-α}
X11′={w×X11+α,w×X11-α,w×X11+α,w×X11-α}
X12′={w×X12-α,w×X12-α,w×X12+α,w×X12-α}
X13′={w×X13+α,w×X13+α,w×X13-α,w×X13-α}
X14′={w×X14-α,w×X14+α,w×X14-α,w×X14-α}
X15′={w×X15-α,w×X15-α,w×X15-α,w×X15-α}
Xi' is the initial position of each particle. Alpha is a random interference factor.
Preferably, c is a cognitive item learning factor of the particle, and the value is 3; w is the inertial weight, and the value is 0.8.
The criteria for determining whether a particle has completed a search to reach the global optimal location are as follows:
|V1|<0.000001AND|V2|<0.000001 AND|V3|<0.000001AND|V4|<0.00000001
the fitness calculation method comprises the following steps:
Figure BDA0001667390530000091
wherein, DetaOffsetiA length value representing the vector difference.
Length value of vector difference DetaOffsetiThe calculation method is as follows:
Figure BDA0001667390530000092
wherein, Vi8 vectors, V, representing the scalingxi8 vectors, V, representing possible solutionsiAnd VxiThe corresponding values are all values obtained by vector unitization. The mathematical expressions for x, y, z are as follows:
x=Width÷2
y=Length÷2
zup=Height-BodyHeight
zdown=BodyHeight
wherein Width is the Width of the room, Length is the Length of the room, Height is the Height of the room, and BodyHeight is the Height of the user;
scaled 8 vectors ViThe mathematical expression of (a) is as follows:
V1={-x,y,zup},V2={x,y,zup}
V3={-x,y,-zdown},V4={x,y,-zdown}
V5={x,-y,zup},V6={-x,-y,zup}
V7={x,-y,-zdown},V8={-x,-y,-zdown}
wherein z isupRepresenting the difference in height between the room height and the height of the user, zdownRepresenting the height of the user.
The calculation method of vector unitization is as follows:
Figure BDA0001667390530000101
Figure BDA0001667390530000102
Figure BDA0001667390530000103
unitVectori={Vi.x÷Length,Vi.y÷Length,Vi.z÷Length}
wherein, unit vectoriThe vector after unitization is expressed, and Vi represents coordinate information of the ith vertex of the cubic room.
The vectors at different positions have different formula of unit selection, and the lambda coefficient exists and is determined by the height difference of the user. λ is equal to 1 when the user height is exactly equal to half the room height.
The updating formula of the particle position and the iterative calculation thereof in the standard particle swarm algorithm is as follows:
Vi′=w×Vi+c1×r1×(P-Xi)+c2×r2×(G-Xi)
X′=X+V′
where Vi represents the velocity of the particle flight; vi' represents the update speed of the particle; x represents a particleThe original position of the child; x' represents the updated position of the particle; w is the inertial weight; random number r1、r2∈(0,1);c1、c2Is a learning factor.
The inertia weight w is used to balance the global search capability and the local search capability of the algorithm, and preferably, the present invention is set to 0.8 according to the empirical data of the inertia weight.
Step S3: and calling the 3D engine by the import model module, receiving the output parameters of the second part, and dynamically creating a 3D model of the room.
The present invention is not limited to the specific embodiments, but rather, all embodiments may be utilized without departing from the scope of the present invention.

Claims (6)

1. A dynamic 3D real-time modeling method based on an improved particle swarm optimization algorithm is characterized in that: the method comprises the following steps:
step S0: providing a decoration preview system, which comprises a scanning module, a recording module, a calculating module, an importing model module, a mapping module and a display module;
step S1: the scanning module and the recording module are cooperated to complete the calibration work of the space vector information of 8 corners of the room to be simulated, record the gyroscope parameters and solve the space vector data as the output parameters;
step S2: calling a particle swarm algorithm by the core of the computing module, receiving the output parameters of the step S1, and computing to obtain room and user height unit length data which are in equal proportion to the cubic room and serve as output parameters;
step S3: calling a 3D engine by the import model module, receiving the output parameters of the step S2, and dynamically creating a 3D model of the room;
the manual calibration method of the scanning module in the step S1 is as follows:
standing at the center of the room, aligning the camera of the mobile equipment to the vertex position of the corner of each wall, and then clicking a calibration screen to calibrate and record the spatial attitude information of the mobile equipment at the calibration moment; because the local coordinate system corresponding to the mobile phone posture changes at any time, the world coordinate system required by the 3D engine is defined as the local coordinate system q (t) of the instant posture of the mobile phone equipment when the system initializes the gyroscope;
the mathematical expression for the world coordinate system q (t) is as follows:
Figure FDA0003521137820000011
where α is a mathematical symbol indicating an angle roll of rotation around the x-axis by the gyroscope, β is a mathematical symbol indicating an angle yaw of rotation around the y-axis by the gyroscope, γ is a mathematical symbol indicating an angle pitch of rotation around the z-axis by the gyroscope, and w is an inertial weight, the mathematical expression of the rotation matrix r (t) based on the world coordinate system at any time t is as follows:
Figure FDA0003521137820000012
when a rotation matrix at the moment of initializing the gyroscope is defined as R (t is 0), and the values of α, β, and γ of the gyroscope are recorded at the time when t is 0, and the value of the rotation matrix R (0) can be obtained, the mathematical expression of the world coordinate system is as follows:
Figure FDA0003521137820000021
2. the improved particle swarm algorithm-based dynamic 3D real-time modeling method according to claim 1, characterized in that: the method for calculating the wall corner vector by the recording module comprises the following steps: taking the center position of the mass point in the cubic room as the origin position of the three-dimensional coordinate system, wherein the origin position is the position of the eyes of the user in the room; the three-dimensional coordinate values of the wall corners of the eight vertexes are unit values with vector lengths of 1 of the eight wall corners; the eight vertices are defined as: v1、V2、V3、V4、V5、V6、V7、V8Each vertex vector is formed by V(x,y,z)Determining the form of the target;
define Length (V)1)=Length(V2)=Length(V5)=Length(V6) After defining the Length of unit 1, a variable lambda is introduced to make Length (V)3)=λLength(V1) λ, leading to a conclusion of Length (V)3)=Length(V4)=Length(V7)=Length(V8) λ; the vector length is represented by unit 1, variable λ; if V1To V8The measurement is accurate, and the real value of the variable lambda is obtained, so that the vertex coordinate information of the cubic room is obtained;
wherein V1-V8The real values of the components x and y of each dimension in the vector and the actual length and width of the room are in an equal proportional numerical relationship, the proportional real values are set as a scaling coefficient k, and the calculation method of the scaling coefficient k is as follows:
Figure FDA0003521137820000022
wherein, Width, Length and Height respectively represent the Width of the room, and body Height is the Height of the user.
3. The improved particle swarm algorithm-based dynamic 3D real-time modeling method according to claim 1, characterized in that: the intelligent algorithm called in the step S2 is an improved particle swarm optimization algorithm, and specifically includes the following steps:
step 1: determining the solution space dimension, the population scale and the iterative times controlled by the algorithm of an optimization target, initializing all parameters of the algorithm, and initializing the initial position and the initial speed of each particle in the particle swarm by using random numbers;
step 2: calculating the current position X of each particle in the populationiThe adaptive value of (a);
and step 3: comparing the individual adaptive value with all other individual adaptive values in the population, and preferentially selecting to obtain the optimal adaptive value P of the population in the iterative calculation;
and 4, step 4: comparing the optimal adaptive value P obtained by the iterative calculation of the population with the global optimal adaptive value obtained by the history experience of the population to obtain an updated global optimal adaptive value G;
and 5: calculating the speed and position of each particle in the population by using the particle position in the standard particle swarm algorithm and an updating formula of iterative calculation thereof, and updating the data information of the position and the speed of the particle;
step 6: judging whether the particles have finished searching and reach the global optimal position; if the condition is not met, returning to the step 2 to perform a new round of iterative calculation;
and 7: setting a mark, carrying out random initialization on the particle position, and canceling a cognitive item parameter and a flight speed vector parameter;
and 8: utilizing an initialization formula of an initial position and an initial speed of each particle to preprocess all directions of a four-dimensional vector representing the positions of the particles, and calculating optimal adaptive values of all directions, wherein the direction corresponding to the optimal adaptive value is taken as the flight direction of the particles;
and step 9: judging whether the optimal positions of the particles break through the global optimal adaptive value, if so, canceling the marks set in the step 7, recovering the cognitive item parameters and flight speed vector parameters of all the particles, and jumping to the step 2 to perform a new round of iterative calculation;
step 10: judging whether an end condition is met or not, judging whether the iterative computation reaches a preset maximum iterative frequency or not, and returning to the step 8 to perform a new iterative computation if the end condition is not met;
step 11: and finishing the algorithm.
4. The improved particle swarm algorithm-based dynamic 3D real-time modeling method according to claim 3, characterized in that: the method for initializing the initial position and initial velocity of each particle is as follows:
α=c×rand(0,1)
X3′={w×X3+α,w×X3-α,w×X3+α,w×X3+α}
X4′={w×X4-α,w×X4-α,w×X4+α,w×X4+α}
X5′={w×X5+α,w×X5+α,w×X5-α,w×X5+α}
X6′={w×X6-α,w×X6+α,w×X6-α,w×X6+α}
X7′={w×X7+α,w×X7-α,w×X7-α,w×X7+α}
X8′={w×X8-α,w×X8-α,w×X8-α,w×X8+α}
X9′={w×X9+α,w×X9+α,w×X9+α,w×X9-α}
X10′={w×X10-α,w×X10+α,w×X10+α,w×X10-α}
X11′={w×X11+α,w×X11-α,w×X11+α,w×X11-α}
X12′={w×X12-α,w×X12-α,w×X12+α,w×X12-α}
X13′={w×X13+α,w×X13+α,w×X13-α,w×X13-α}
X14′={w×X14-α,w×X14+α,w×X14-α,w×X14-α}
X15′={w×X15-α,w×X15-α,w×X15-α,w×X15-α}
wherein c is a cognitive term learning factor of the particle; w is the inertial weight; xi' is the initial position of each particle; alpha is a random interference factor;
the criteria for determining whether a particle has completed a search to reach the global optimal location are as follows:
|V1|<0.000001 AND |V2|<0.000001 AND |V3|<0.000001 AND |V4|<0.00000001
the fitness calculation method comprises the following steps:
Figure FDA0003521137820000031
wherein, DetaOffsetiA length value representing the vector difference;
length value of vector difference DetaoffsetiThe calculation method is as follows:
Figure FDA0003521137820000041
wherein, Vi8 vectors, V, representing the scalingxi8 vectors, V, representing possible solutionsiAnd VxiThe corresponding values are all values obtained through vector unitization; the mathematical expressions for x, y, z are as follows:
x=Width÷2
y=Length÷2
zup=Height-BodyHeight
zdown=BodyHeight
wherein Width is the Width of the room, Length is the Length of the room, Height is the Height of the room, and BodyHeight is the Height of the user;
scaled 8 vectors ViThe mathematical expression of (a) is as follows:
V1={-x,y,zup},V2={x,y,zup}
V3={-x,y,-zdown},V4={x,y,-zdown}
V5={x,-y,zup},V6={-x,-y,zup}
V7={x,-y,-zdown},V8={-x,-y,-zdown}
wherein z isupIndicating height of roomHeight difference between the body height of the user and the height of the user, zdownRepresenting a user's height;
the calculation method of vector unitization is as follows:
Figure FDA0003521137820000042
Figure FDA0003521137820000043
Figure FDA0003521137820000044
unitVectori={Vi.x÷Length,Vi.y÷Length,Vi.z÷Length}
where unit vector represents the unitized vector, ViCoordinate information representing the ith vertex of the cubic room;
the updating formula of the particle position and the iterative calculation in the standard particle swarm optimization is as follows:
V′i=w×Vi+c1×r1×(P-Xi)+c2×r2×(G-Xi)
X′=X+V′
wherein, ViRepresenting the velocity of flight of the particles; v'iRepresenting the update speed of the particles; x represents the original position of the particle; x' represents the updated position of the particle; w is the inertial weight; random number r1、r2∈(0,1);c1、c2Learning factors for cognitive terms.
5. The improved particle swarm algorithm-based dynamic 3D real-time modeling method according to claim 4, wherein: the vectors at different positions have different formulas selected in a unitization way, and have lambda coefficients which are determined by the height difference of the user; λ is equal to 1 when the user height is exactly equal to half the room height.
6. The improved particle swarm algorithm-based dynamic 3D real-time modeling method according to claim 5, characterized in that: the value of the cognitive term learning factor c of the particle is 3; the inertial weight w takes the value 0.8.
CN201810489957.5A 2018-05-21 2018-05-21 Dynamic 3D real-time modeling method based on improved particle swarm optimization Active CN108765556B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810489957.5A CN108765556B (en) 2018-05-21 2018-05-21 Dynamic 3D real-time modeling method based on improved particle swarm optimization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810489957.5A CN108765556B (en) 2018-05-21 2018-05-21 Dynamic 3D real-time modeling method based on improved particle swarm optimization

Publications (2)

Publication Number Publication Date
CN108765556A CN108765556A (en) 2018-11-06
CN108765556B true CN108765556B (en) 2022-05-06

Family

ID=64007411

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810489957.5A Active CN108765556B (en) 2018-05-21 2018-05-21 Dynamic 3D real-time modeling method based on improved particle swarm optimization

Country Status (1)

Country Link
CN (1) CN108765556B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114491772B (en) * 2022-03-23 2022-09-13 清华大学 Household layout generation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495932A (en) * 2011-12-13 2012-06-13 哈尔滨工业大学 Finite element model updating method based on response surface modeling and improved particle swarm algorithm
CN105389854A (en) * 2015-11-06 2016-03-09 福建天晴数码有限公司 Decoration effect displaying method and system of cubic room
CN105787996A (en) * 2016-02-25 2016-07-20 上海斐讯数据通信技术有限公司 House stereogram generation method and system based on mobile terminal
CN107194984A (en) * 2016-03-14 2017-09-22 武汉小狮科技有限公司 Mobile terminal real-time high-precision three-dimensional modeling method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2943819B1 (en) * 2009-03-27 2015-03-13 Squareclock METHOD AND SYSTEM FOR ASSISTING THE DESIGN OF COMPUTER MODULAR ARRANGEMENTS
US9947134B2 (en) * 2012-07-30 2018-04-17 Zinemath Zrt. System and method for generating a dynamic three-dimensional model

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495932A (en) * 2011-12-13 2012-06-13 哈尔滨工业大学 Finite element model updating method based on response surface modeling and improved particle swarm algorithm
CN105389854A (en) * 2015-11-06 2016-03-09 福建天晴数码有限公司 Decoration effect displaying method and system of cubic room
CN105787996A (en) * 2016-02-25 2016-07-20 上海斐讯数据通信技术有限公司 House stereogram generation method and system based on mobile terminal
CN107194984A (en) * 2016-03-14 2017-09-22 武汉小狮科技有限公司 Mobile terminal real-time high-precision three-dimensional modeling method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Improved accelerated PSO algorithm for mechanical engineering optimization problems;Guedria N B et al.;《Applied Soft Computing》;20161230;第40卷(第40期);第455-467页 *
The particle swarm-explosion, stability, and convergence in a multidimensional complex space;Clerc M et al.;《IEEE》;20020115;第6卷(第1期);第58-73页 *
基于分组混沌PSO算法的模糊神经网络建模研究;张楠 等;《计算机工程与应用》;20170915;第53卷(第9期);第31-37页 *
最优粒子增强探索粒子群算法;唐祎玲 等;《计算机工程与应用》;20170415;第53卷(第4期);第25-32页 *

Also Published As

Publication number Publication date
CN108765556A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
CN109307508B (en) Panoramic inertial navigation SLAM method based on multiple key frames
Barbič et al. Six-dof haptic rendering of contact between geometrically complex reduced deformable models
CN107680133A (en) A kind of mobile robot visual SLAM methods based on improvement closed loop detection algorithm
JP2006520054A (en) Image matching from invariant viewpoints and generation of 3D models from 2D images
Chao et al. Realistic data-driven traffic flow animation using texture synthesis
Chen et al. A real-time markerless augmented reality framework based on SLAM technique
CN107452056B (en) Augmented reality teaching system and control method thereof
CN112085835B (en) Three-dimensional cartoon face generation method and device, electronic equipment and storage medium
Le Cleac'h et al. Differentiable physics simulation of dynamics-augmented neural objects
CN110276768A (en) Image partition method, image segmentation device, image segmentation apparatus and medium
WO2023185703A1 (en) Motion control method, apparatus and device for virtual character, and storage medium
CN108765556B (en) Dynamic 3D real-time modeling method based on improved particle swarm optimization
CN109215128B (en) Object motion attitude image synthesis method and system
CN114255285A (en) Method, system and storage medium for fusing three-dimensional scenes of video and urban information models
CN112308952B (en) 3D character motion generation system and method for imitating human motion in given video
US9652879B2 (en) Animation of a virtual object
JP3822483B2 (en) Object orientation calculation apparatus and method
CN115861547A (en) Model surface sample line generation method based on projection
CN115578417A (en) Monocular vision inertial odometer method based on feature point depth
CN114912303A (en) Three-dimensional fluid display method and device, electronic equipment and storage medium
CN112560326B (en) Method and device for determining pressure field
JP6281938B2 (en) Data processing apparatus, data processing method, and data processing program
Chang et al. Using line consistency to estimate 3D indoor Manhattan scene layout from a single image
CN111932628A (en) Pose determination method and device, electronic equipment and storage medium
Xia et al. Recent advances on virtual human synthesis

Legal Events

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