A panoramic video anti-shake method, comprising: acquiring a world coordinate of a reference point in a world coordinate system in real time, and simultaneously acquiring a camera coordinate corresponding to the reference point in a portable terminal in a camera coordinate system and an angular velocity value of a gyroscope in the portable terminal in a current state; and smoothing a motion of the camera by using an extended Kalman filter; characterized by decomposing the smoothed motion, generating a motion of a virtual lens in a mode in which only motions in vertical and horizontal directions are retained, and calculating a rotation quantity of the virtual lens; and performing a reprojection on an original video according to the rotation quantity of the virtual lens and a rotation matrix by which the camera coordinate is transformed to the world coordinate, to generate a stable video; wherein the step of smoothing the motion of the camera by using the extended Kalman filter specifically comprises: using a state model q ̃ k = Φ w ̃ k − 1 · q ̃ k − 1 w ̃ k = w ̃ k − 1; and using an observation model q k = q ̃ k w k = w ̃ k. wherein k is time, w k is an obtained angular velocity q k is an obtained observation vector of the rotation quantity, w̃ k and q̃ k are state values of the angular velocity and the rotation quantity, w̃ k- 1 and q̃ k- 1 are state values of the angular velocity and the rotation quantity at time k - 1, q k is a quaternion representation of an inverse of the rotation matrix R w 2 c -1, w k is the angular velocity value of the gyroscope, w k = lg q k + 1 ⋅ q k − 1, Φ( w̃ k -1) is a state transition matrix at the time k-1, Φ( w̃ k- 1)=exp([ w̃ k- 1] ×), q̃ k is a quaternion representation of the estimated smoothed motion of the lens, q̃ k is a state value evaluated by a value of q̃ k- 1 at previous time; wherein the step of performing the reprojection on the original video to generate the stable video specifically comprises: calculating a corresponding relationship between a pixel in an original video frame and a pixel in an output video frame, performing interpolation sampling on the original video frame according to the corresponding relationship, generating the output video frame, and generating the stable video. acquiring a world coordinate of a reference point in a world coordinate system in real time, and simultaneously acquiring a camera coordinate corresponding to the reference point in a portable terminal in a camera coordinate system and an angular velocity value of a gyroscope in the portable terminal in a current state; and smoothing a motion of the camera by using an extended Kalman filter; characterized by decomposing the smoothed motion, generating a motion of a virtual lens in a mode in which only motions in vertical and horizontal directions are retained, and calculating a rotation quantity of the virtual lens; and performing a reprojection on an original video according to the rotation quantity of the virtual lens and a rotation matrix by which the camera coordinate is transformed to the world coordinate, to generate a stable video; wherein the step of smoothing the motion of the camera by using the extended Kalman filter specifically comprises: using a state model q ̃ k = Φ w ̃ k − 1 · q ̃ k − 1 w ̃ k = w ̃ k − 1; and using an observation model q k = q ̃ k w k = w ̃ k. wherein k is time, w k is an obtained angular velocity q k is an obtained observation vector of the rotation quantity, w̃ k and q̃ k are state values of the angular velocity and the rotation quantity, w̃ k- 1 and q̃ k- 1 are state values of the angular velocity and the rotation quantity at time k - 1, q k is a quaternion representation of an inverse of the rotation matrix R w 2 c -1, w k is the angular velocity value of the gyroscope, w k = lg q k + 1 ⋅ q k − 1, Φ( w̃ k -1) is a state transition matrix at the time k-1, Φ( w̃ k- 1)=exp([ w̃ k- 1] ×), q̃ k is a quaternion representation of the estimated smoothed motion of the lens, q̃ k is a state value evaluated by a value of q̃ k- 1 at previous time; wherein the step of performing the reprojection on the original video to generate the stable video specifically comprises: calculating a corresponding relationship between a pixel in an original video frame and a pixel in an output video frame, performing interpolation sampling on the original video frame according to the corresponding relationship, generating the output video frame, and generating the stable video.