Offline and current online physical education classes are characterized by low learning efficiency and poor teaching quality. To solve this problem, the study combines a dynamic time regularization algorithm and local image feature action recognition with virtual technology, which is applied to online teaching to improve teaching quality. Experimental results indicate that the overall model accuracy reaches more than 94%, and in the public dataset MSR, the model accuracy reaches 91.4%. In the UTK dataset, the accuracy reaches 85.8%. When the accuracy of pose recognition is compared, the research model is superior to the two traditional models. The validation results against KNN and SVM are 62% and 71% as well as 79% and 84%, respectively, and the experimental results of the research model have improved by 9% and 5%. The research technique achieves an overall fit of more than 90% for different parts in the analysis of motion capture, which is superior to the traditional online instruction. The overall teaching satisfaction reaches more than 93.5% in the comparison of online physical education courses with offline courses. In summary, the optimized and improved posture recognition system is better for human motion capture, and the applied virtual technology can effectively improve the learning effect and teaching quality of online physical education courses.