You are on page 1of 12

A

Micro-Project
On

MOTION CAPTURE USING PYTHON


Submitted To
MSBTE
In Partial Fulfilment of Requirement of Diploma Of
Computer Engineering
Under I Scheme
Submitted By

Mr. Suyash Satish Kerkar


Mr. Manas Dattaram Desai

Ms. Manasvi Sanjay Parab

Ms. Shejal Angad Chandekar

Under the Guidance Of

Mr. S.M. Mayekar

FOR ACADEMIC YEAR 2023-2024

YASHWANTRAO BHONSALE INSTITUTE OF TECHNOLOGY,

SAWANTWADI
MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION
CERTIFICATE
This is to certify that,

Mr. Suyash Satish Kerkar Roll No.01

Mr. Manas Dattaram Desai Roll No.04

Ms. Manasvi Sanjay Parab Roll No.09

Ms. Shejal Angad Chandekar Roll No.12

Of Sixth semester of diploma in COMPUTER ENGINEERING of institute


Yashwantrao Bhonsale Institute of Technology (1742) has completed the Micro
Project satisfactorily in subject Programming With Python (22616) for the
academic year 2023 to 2024 as prescribed in the curriculum.

Subject Faculty HOD Principal

Seal of

Institution

INDEX
Sr. Topic Name Page
No. No.
1. Abstract 1

2. Introduction 1

3. Technology and Technology Used 2

4. Description of Project 3-4

5. Advantages 5

6. Disadvantages 6-7

7. Program Code 8

8. Output 9-10

9. Conclusiom 11-12

10. Reference 13

11. Reference 14
1.INTRODUCTION:-
Our "Motion Capture using Python" project is a real-time 2D motion capture system
developed with Python, OpenCV, and the `cvzone` library. It aims to detect and record
human poses from video sources like pre-recorded videos or live webcam streams. By
analyzing video frames, the system identifies key landmarks on the human body and
stores their positions. The project demonstrates the capabilities of Python in computer
vision and serves as an educational resource for students interested in motion tracking.
With its accurate and versatile motion capture capabilities, the project lays the
groundwork for potential future advancements in 3D motion capture and integration
with other technologies.

2.OBJECTIVE:-
The objective of the "Motion Capture using Python" project is to develop a real-time
2D motion capture system that can accurately detect and record the human pose from
a video source. Using Python programming language, OpenCV, and the `cvzone`
library, the project aims to achieve efficient pose detection by identifying key
landmarks on thehuman body, such as joints and limbs, in each frame of the video.
The extracted (x, y, z) coordinates of these landmarks will be stored in a list for
further analysis and use. The system's primary focus is to provide accurate and
reliable motion capture results, enabling smooth real-time processing of video frames
from various sources, including pre-recorded videos and live webcam feeds.
Additionally, the project aims to be educational, serving as a valuable learning
resource for students interested in computer vision and motion tracking. Ultimately,
the project will showcase the capabilities of Python and OpenCV in the realm of
motion capture and lay the groundwork for potentialfuture expansions into 3D motion
capture or integration with advanced machine learning models for enhanced pose
estimation and analysis.

1
3. TECHNOLOGY AND TOOLS USED:-
In our "Motion Capture using Python" project, several tools and technologies have
been employed to develop a real-time 2D motion capture system. The project
leverages the following key tools and technologies:

1. Python Programming Language: Python serves as the primary programming


language for developing the project, providing an easy-to-understand syntax and
extensive libraries for efficient coding.

2. OpenCV: OpenCV (Open Source Computer Vision Library) is a powerful


opensource library widely used in computer vision tasks. It enables image and video
processing, including pose detection, keypoint extraction, and geometric
transformations.

3. cvzone Library: The `cvzone` library is utilized to enhance the pose estimation
process by providing specialized classes like `PoseDetector`. It extends OpenCV's
functionality and simplifies the implementation of complex computer vision tasks.

4. Video Input: The project handles video input, either from pre-recorded video files
(e.g., "Video.mp4") or live webcam streams. This enables real-time motion capture
and processing.

5. Text File I/O: The system uses Python's file handling capabilities to save the
collected pose data to a text file ("AnimationFile.txt") in a structured format.

By incorporating these tools and technologies, the project achieves a reliable and
efficient 2D motion capture system, showcasing the potential of Python and OpenCV
in computer vision applications.

2
4.DESCRIPTION OF PROJECT:-
The "Motion Capture using Python" project is a comprehensive and accessible 2D
motion capture system developed to detect and record the human pose from a video
source. Utilizing Python, OpenCV, and the `cvzone` library, this project offers a user-
friendly solution for capturing motion data and opens the door to various applications,
such as animation, sports analysis, and interactive experiences.

The core functionality of the project lies in its ability to process video frames in real-
time, extracting key landmarks on the human body through the `cvzone.PoseModule`.
These landmarks represent critical joints and body parts, including shoulders, elbows,
knees, and more. The system records the (x, y, z) coordinates of these landmarks, with
the y-coordinate adjusted to follow the standard image coordinate system. This data is
collected and stored in a list called `posList`, facilitating easy access and management.

To use the system, users can input a video file containing footage of a person in motion
or utilize a live webcam stream. The project then performs pose detection on each frame,
enabling accurate motion capture in real-time. Moreover, users have the option to save
the captured pose data to a text file named "AnimationFile.txt". This file stores the data
in a structured format, allowing for further analysis, animation, or integration into other
projects.

The "Motion Capture using Python" project not only serves as a functional 2D motion
capture system but also serves as a valuable educational tool for students interested in
computer vision and motion tracking. By showcasing the capabilities of Python and
OpenCV in the realm of computer vision, the project encourages exploration and
experimentation in motion capture technology.

3
5.ADVANTAGES:-
Advantages of the "Motion Capture using Python" Project:

1. Accessibility: The project provides an accessible platform for motion capture,


allowing users of all skill levels to engage with and understand the principles of
computer vision and pose detection.

2. Educational Resource: It serves as a valuable educational tool, offering students


an opportunity to explore concepts in motion tracking, image processing, and
algorithm development within a practical context.
3. Versatility: With its ability to process both pre-recorded videos and live webcam
streams, the project caters to diverse use cases across animation, sports analysis,
and interactive experiences.

4. Real-time Processing: The system offers real-time pose detection and motion
capture, enabling immediate feedback and analysis of human movements.

5. Data Storage: It facilitates easy storage and management of captured pose data,
allowing users to access and manipulate the information for further analysis or
integration into other projects.

6. Integration Capabilities: The project seamlessly integrates with existing Python


libraries such as OpenCV and cvzone, enhancing its functionality and enabling
developers to leverage additional features and tools.

7. Customization Options: Users can customize the project to suit their specific
requirements, whether by adjusting parameters, adding new features, or extending
its functionality to meet unique use cases.

8. Scalability: It lays the groundwork for potential expansion into 3D motion capture
and integration with advanced machine learning models, offering scalability and
adaptability for future developments.

4
6.DISADVANTAGES:-
Disadvantages of the "Motion Capture using Python" Project:

1. Limited to 2D Motion Capture: The project focuses solely on 2D motion


capture, which may not be sufficient for some advanced applications that require 3D
motion tracking.

2. Accuracy Limitations: While the project strives for accuracy, the pose detection
maynot be as precise as more sophisticated motion capture systems, especially in
complex or occluded scenarios.

3. Lack of Real-world Calibration: The system does not include real-world


calibration or depth estimation, which means the captured motion data is not
translated into 3D coordinates.

4. Dependency on Video Quality: The accuracy of pose detection heavily relies on


thequality of the input video, and poor-quality videos may result in less reliable
motion capture.

5. Limited Features: The project provides basic motion capture functionalities, but
it lacks more advanced features like gesture recognition or model-based pose
estimation,which may be essential for specific applications.

5
7.PROGRAM CODE: -

import cv2
from cvzone.PoseModule import PoseDetector

cap = cv2.VideoCapture('Video.mp4')

detector = PoseDetector()
posList = []
while True:
success, img = cap.read()
img = detector.findPose(img)
lmList, bboxInfo = detector.findPosition(img)

if bboxInfo:
lmString = ''
for lm in lmList:
lmString += f'{lm[1]},{img.shape[0] - lm[2]},{lm[3]},'
posList.append(lmString)

print(len(posList))

cv2.imshow("Image", img)
key = cv2.waitKey(1)
if key == ord('s'):
with open("AnimationFile.txt", 'w') as f:
f.writelines(["%s\n" % item for item in posList])

6
8.OUTPUT:-

7
9.CONCLUSION:-
In conclusion, the "Motion Capture using Python" project successfully demonstrates a
real-time 2D motion capture system with the help of Python, OpenCV, and the `cvzone`
library. The project offers a user-friendly solution for detecting and recording human
poses from video sources. It serves as an educational resource, showcasing the potential
of Python and OpenCV in computer vision applications. While the project excels in real-
time processing and ease of implementation, it is limited to 2D motion capture, and
accuracy may vary based on video quality. Despite its limitations, the project lays the
foundation for further research and development in the dynamic field of motion capture
technology.

8
10.REFERENCES:-
1. Source code: https://www.computervision.zone/courses/3d-motion-capture/
2. Official OpenCV Documentation: https://docs.opencv.org/
3. cvzone GitHub Repository: https://github.com/codewithharry/cvzone
4. Python Documentation: https://docs.python.org/
5.https://chat.openai.com/

You might also like