DEVIL

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

VISVESVARAYA TECHNOLOGICAL

UNIVERSITY
Jnana Sangama, Belagavi - 590014

A
CGIP Mini Project Report
On
“ZOOM ANY PICTURE USING HAND GESTURE IN
OPENCV”

Submitted By:
MD ADIL
(USN:-
3BK21CS023)

Under The Guidance of

Prof. KIRTI RANI

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


BASAVAKALYAN ENGINEERING COLLEGE
BASAVAKALYAN-585327

Academic Year-2023-24
BET’s
BASAVAKALYAN ENGINEERING COLLEGE
BASAVAKALYAN-585327

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Certificate

This is to certify that the project work entitled " ZOOM ANY PICTURE
USING HAND GESTURE" work carried out by MD ADIL (USN:3BK21CS023)
student of VI semester (CBCS) B.E. (Computer Science & Engineering) in partial
fulfillment for the CGIP Lab with Mini Project (21CSL55) prescribed by
Visvesvaraya Technological University, Belgavi during the academic year 2023-
2024.

Signature of Guide Head of Department

Prof.Kirti Rani Prof. Suvarnalata

Hiremath

Name of the Examiners Signature with Date

1)-----------------

2)-----------------
ACKNOWLEDGMENT

At this pleasing moment of having successfully completed our project, we wish to convey our
sincere thanks and gratitude to our esteemed institute "BASAVAKALYAN ENGINEERING
COLLEGE BASAVAKALYAN ".

First and foremost our sincere thanks to our Principal Dr.Ashok Kumar Vangeri for forwarding us
to carryout our project and offering adequate duration in completing our project

We are also grateful to the Head of department of Computer Science & Engineering Prof.Suvarnalata
Hiremath for her constructive suggestions &Encouragement during our project.

We wish to place our graceful thanks to our project guide Prof. Kirti Rani, Without whose help and
guidance would not have been possible to complete this project.

We express our heartfelt thanks to our all staff members of our department who helped us a lot in the
completion of directly and indirectly within the schedule period.

Last but not least we would like to thanks our friends and family members for increased
andpropels and encouragement throughout in this position.

Project Associates:
MD ADIL (3BK21CS023)
TABLE OF CONTENT

CHAPTER NO TITLES PG-NO


1 ABSTRACT 05

2 INTRODUCTION TO CGIP 06

3 SOFTWARE AND HARDWARE REQUIREMENT 07

4 INTRODUCTION 08

5 PROBLEM STATEMENT AND SPECIFICATION 09

6 OBJECTIVES 10

7 OUTCOMES 11

8 IMPLEMENTATION CODE

9 SNAPSHOTS
14

OUTPUT

10 CONCLUSION 16

REFERENCES 17
ABSTRACT
In the realm of human-computer interaction, the development of intuitive and
efficient control mechanisms is paramount. This mini-project focuses on
designing a zoom any picture using hand gesture OpenCV, a widely-used open-
source computer vision and machine learning software library. The project aims
to leverage hand gesture recognition to manipulate the zoom levels of a
multimedia system, providing a contactless and user-friendly interface
The core of the system involves capturing real-time video input through a
webcam, processing the frames to detect and track hand gestures. Using
OpenCV's advanced image processing techniques, such as background
subtraction, contour detection, and convex hull analysis, the system identifies
specific gestures that correspond to , in, out or move to hand gesture
A machine learning model, trained to recognize these gestures, further
enhances the accuracy and robustness of the gesture recognition process. The
detected gestures are then mapped to corresponding Zoom control commands,
which are executed to adjust the system's audio output.

This project demonstrates the integration of computer vision techniques with


everyday applications, showcasing how OpenCV can be utilized to create
practical, non-invasive control systems. The developed Zoom controller not
only highlights the capabilities of OpenCV in real-time image processing but
also opens avenues for further exploration in gesture-based user interfaces.

DEPT OF CSE, BKEC BASAVAKALYAN 5


CHAPTER 2

INTRODUCTION TO CGIP
CGIP stands for "Computer Graphics and Image Processing." It is a field of
study and research that focuses on the generation, manipulation, and analysis of
visual images and graphical representations using computers. CGIP
encompasses a wide range of techniques and applications, including.

 Computer Graphics: Involves creating and rendering visual content using


algorithms and techniques such as 3D modeling, rendering, animation, and
virtual reality. Computer graphics find applications in gaming, simulations,
visual effects in movies, scientific visualization, and more.

 Image Processing: Involves techniques for digital manipulation and analysis


of visual data. This includes tasks such as image enhancement, restoration,
segmentation, pattern recognition, and object detection. Image processing is
widely used in medical imaging, satellite imagery analysis, security systems,
and multimedia applications

DEPT OF CSE, BKEC BASAVAKALYAN 6


Chapter 3
SOFTWARE ANDHARDWARERE QUIREMENT
Hardware requirements:
• Processor: A multi-core processor (Intel i5/i7 or AMD
equivalent) is recommended to handle image processing tasks
efficiently.

• RAM: At least 8 GB of RAM to ensure smooth operation and


quick processing of images.

• Storage: A minimum of 256 GB SSD for faster read/write


operations, which is beneficial when handling large datasets and
installing necessary software.

• Frame Rate: A camera with a frame rate of 30 frames per second


(fps) is ideal for real-time video processing.

Software Requirements:
• Operating System
The system can be developed on any major operating system,
including Windows, macOS, or Linux. Ensure that your operating
system is up to date to avoid compatibility issues with libraries
and tools.

• Programming Language

Python: Python is the preferred programming language for this


project due to its simplicity and the extensive range of libraries
available for image processing and computer vision.

• Development Platform

IDE/Text Editor: An Integrated Development Environment (IDE)


such as PyCharm, VSCode, or Jupyter Notebook is
recommended for writing and debugging code.

DEPT OF CSE, BKEC BASAVAKALYAN 7


• Libraries and Framework

Chapter 4
INTRODUCTION
Zooming into a picture using hand gestures combines computer vision and
gesture recognition techniques to enable intuitive interaction with digital
content. Here’s a detailed introduction to how this innovative technology can be
implemented:

Implementing zooming into a picture using hand gestures not only enhances
user interaction but also showcases the potential of combining advanced
computer vision techniques with everyday human gestures to create compelling
user interfaces. As technology advances, these interactions are becoming more
accessible and integral to various applications across industries.

Camera or Depth Sensor: A device capable of capturing images or depth


information is essential. This could be a standard webcam for basic
implementations or more advanced depth-sensing cameras like Microsoft
Kinect for precise gesture recognition
Processing Unit: A computer or embedded system capable of processing the
image data and running the necessary algorithms in real-time.
Hand Detection: The system first needs to detect and recognize the presence of
a hand within the captured image or depth map. This can be achieved using
techniques like background subtraction, skin color segmentation, or more
advanced methods involving convolutional neural networks (CNNs) for hand
detection.
Gesture Recognition: Once the hand is detected, the system must interpret
gestures to understand user commands. For zooming into a picture, the gesture
could involve pinching fingers together (to indicate zoom-in) or spreading
fingers apart (to indicate zoom-out).
Image Processing: Depending on the detected gesture, the system then
processes the image or changes the display to simulate zooming. This might
involve scaling the image, adjusting the viewport, or applying other
transformation techniques.

DEPT OF CSE, BKEC BASAVAKALYAN 8


Feedback and Interaction: The system should provide real-time feedback to
the user, showing the zoomed-in portion of the image as the gesture is
recognized and interpreted.

DEPT OF CSE, BKEC BASAVAKALYAN 9


CHAPTER 5

PROBLEM STATEMENT

Design a system that allows a user to zoom in and out of a picture displayed on
a screen using hand gestures. The system should be able to recognize specific
gestures to control the zoom level of the picture in real-time.
SPECIFICATION
 Input: The system should take input from a camera or a sensor capable of
detecting hand gestures.
 Gestures: Define specific gestures for zooming in and out, such as spreading
fingers apart for zooming in and pinching fingers together for zooming out.
Zoom Levels: Implement a mechanism to smoothly adjust the zoom level of
the picture based on the detected gestures.
 Real-time Feedback: Provide visual feedback to the user to indicate the
current zoom level and the effect of their gestures.
 Integration: Ensure compatibility with a display system (e.g., monitor,
projector, or digital screen) to showcase the zoomed picture.

DEPT OF CSE, BKEC BASAVAKALYAN 10


Chapter 6
OBJECTIVES
 Hand Gesture Recognition: Detect and recognize specific hand gestures that
indicate zoom-in or zoom-out commands.

 Image Processing: Implement a method to zoom into an image based on the


detected gesture.

 Real-time Interaction: Ensure that the system can perform zooming in real-
time as gestures are recognized.

 Capture Frames: Continuously capture frames from the camera feed.

 Hand Detection: Use techniques like background subtraction, skin detection,


or more advanced methods like Haar cascades or deep learning-based models to
detect the presence and location of a hand in the frame.

DEPT OF CSE, BKEC BASAVAKALYAN 11


Chapter 7

OUTCOMES
 Success in accurately detecting and classifying zoom-in and zoom-out
gestures.

 This outcome is crucial for the overall functionality of the system. High
accuracy ensures a seamless user experience.

Efficient processing of video frames to detect gestures and perform zooming


operations in real-time.

 Smooth and responsive zooming ensures that users perceive the system as
interactive and reliable

 The ability to zoom into specific regions of the image effectively without
losing quality.

 Techniques such as image cropping and resizing should maintain clarity and
detail as the image is zoomed

 Users find it intuitive to zoom into images using natural hand gestures.

 Gesture recognition that aligns with users' expectations and is easy to perform
enhances usability

DEPT OF CSE, BKEC BASAVAKALYAN 12


Chapter 8

IMPLEMENTATION CODE
import cv2
from cvzone.HandTrackingModule import HandDetector

cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)

detector = HandDetector(detectionCon=0.7)

startDis = None
scale = 0
cx, cy = 200, 200

while True:
success, img = cap.read()
hands, img = detector.findHands(img)

img1 = cv2.imread("one.jpg")

if len(hands) == 2:
hand1 = hands[0]
hand2 = hands[1]

hand1_fingers = detector.fingersUp(hand1)
hand2_fingers = detector.fingersUp(hand2)

if hand1_fingers == [1, 1, 0, 0, 0] and hand2_fingers == [1, 1, 0, 0,


0]:
lmList1 = hand1["lmList"]
lmList2 = hand2["lmList"]

if startDis is None:
length, _, _ = detector.findDistance(hand1["center"],
hand2["center"], img)
startDis = length

length, _, _ = detector.findDistance(hand1["center"],
hand2["center"], img)
scale = int((length - startDis) // 2)
cx, cy = hand1["center"]

else:
startDis = None

DEPT OF CSE, BKEC BASAVAKALYAN 13


try:
h1, w1, _ = img1.shape
newH, newW = ((h1 + scale) // 2) * 2, ((w1 + scale) // 2) * 2
img1_resized = cv2.resize(img1, (newW, newH))
img[cy - newH // 2: cy + newH // 2, cx - newW // 2: cx + newW // 2] =
img1_resized

except Exception as e:
print(f"Error: {str(e)}")

cv2.imshow("Zoom and Image Overlay", img)


if cv2.waitKey(1) & 0xFF == ord('q'):
break

cap.release()
cv2.destroyAllWindows()

DEPT OF CSE, BKEC BASAVAKALYAN 14


Chapter 9

OUTPUT

[Running] python -u "c:\Users\adils\Desktop\Zoom-Any-Picture-Using-Hand-


Gestures--main\tempCodeRunnerFile.py"
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
WARNING: All log messages before absl::InitializeLog() is called are written
to STDERR
W0000 00:00:1721324508.157256 17044 inference_feedback_manager.cc:114]
Feedback manager requires a model with a single signature inference. Disabling
support for feedback tensors.
W0000 00:00:1721324508.189491 17044 inference_feedback_manager.cc:114]
Feedback manager requires a model with a single signature inference. Disabling
support for feedback tensors.

DEPT OF CSE, BKEC BASAVAKALYAN 15


Chapter 10

CONCLUSION

In conclusion, the concept of zooming into a picture using hand gestures


combines advanced computer vision techniques with interactive user interfaces
to create a novel and engaging user experience. By detecting and interpreting
specific gestures as commands to zoom in or out, the system enables intuitive
control over digital content without the need for traditional input devices

DEPT OF CSE, BKEC BASAVAKALYAN 16


Chapter 11
REFRENCE

https://chatgpt.com/#:~:text=Website%3A-,OpenCV,-Documentation
%20and%20tutorials

https://chatgpt.com/#:~:text=Documentation%20and%20tutorials
%3A-,OpenCV%20Tutorials,-MediaPipe%3A%20A

https://chatgpt.com/#:~:text=GitHub%20repository%3A-,MediaPipe
%20GitHub,-TensorFlow%20and%20PyTorch

DEPT OF CSE, BKEC BASAVAKALYAN 17

You might also like