The continuous development of virtual reality animation has brought people a new viewing experience. However, there is still a large research space for the construction of virtual scenes. Underwater scenes are complex and diverse, and to obtain more realistic virtual scenes, it is necessary to use video panoramic images as reference modeling in advance. To this end, the study uses the [Formula: see text]-means clustering method to extract key frames from underwater video, and adaptively adjusts the number of clusters to improve the extraction algorithm according to the differences in features. To address the problems of low contrast and severe blurring in underwater images, the study uses an improved non-local a priori recovery method to achieve the recovery process of underwater images. Finally, the final underwater panoramic image is obtained by fading-out image fusion and frame to stitching image synthesis strategy. The experimental analysis shows that the runtime of Model 1 is 21.46[Formula: see text]s, the root mean square error value is 1.89, the structural similarity value is 0.9678, and the average gradient value is 12.59. It can achieve efficient and high-quality panoramic image generation.