Giter Club home page Giter Club logo

volume_up_and_down_with_your_index_finger's Introduction

Volume Control with Your Index Finger 🎛️👆

Untitled.video.-.Made.with.Clipchamp.2.mp4

Overview 🌟

Welcome to the Volume Control with Your Index Finger repository! This project uses OpenCV and MediaPipe to control your computer's volume with simple hand gestures. Move your index finger to the right to increase the volume and to the left to decrease it.

Features 🚀

  • Real-Time Hand Gesture Recognition: Control volume with your index finger in real-time.
  • Simple User Interface: Clear visual cues for volume control actions.
  • Easy to Use: No need for additional hardware, just your webcam.

Installation and Setup 🛠️

  1. Clone the Repository:

    git clone https://github.com/fastuptime/Volume_Up_And_Down_With_Your_Index_Finger.git
    cd Volume_Up_And_Down_With_Your_Index_Finger
  2. Install Dependencies:

    • Ensure you have Python installed.
    • Install required packages:
      pip install opencv-python mediapipe numpy pyautogui
  3. Run the Program:

    • Execute the Python script:
      python volume_control.py

Usage 💻

  1. Launch the Program:

    • Run the script. The webcam will start, and the program will begin detecting hand gestures.
  2. Volume Control:

    • Move your index finger to the right to increase the volume.
    • Move your index finger to the left to decrease the volume.
    • Visual cues will be displayed on the screen indicating the current action.
  3. Exit the Program:

    • Press the 'Esc' key to quit the program.

Code Explanation 📝

volume_control.py

  • Import Libraries:

    import cv2
    import mediapipe as mp
    import numpy as np
    import pyautogui
  • Initialize MediaPipe and OpenCV:

    mp_drawing = mp.solutions.drawing_utils
    mp_hands = mp.solutions.hands
    
    cap = cv2.VideoCapture(0)
  • Volume Control Function:

    def volume_control():
        with mp_hands.Hands(min_detection_confidence=0.8, min_tracking_confidence=0.5) as hands:
            while cap.isOpened():
                success, image = cap.read()
                if not success:
                    print("Kamera açılamadı. Yazılım kapatılıyor.")
                    continue
    
                image = cv2.cvtColor(cv2.flip(image, 1), cv2.COLOR_BGR2RGB)
                image.flags.writeable = False
                results = hands.process(image)
    
                image.flags.writeable = True
                image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
    
                if results.multi_hand_landmarks:
                    for hand_landmarks in results.multi_hand_landmarks:
                        mp_drawing.draw_landmarks(image, hand_landmarks, mp_hands.HAND_CONNECTIONS)
    
                        x = hand_landmarks.landmark[8].x
                        y = hand_landmarks.landmark[8].y
                        cv2.circle(image, (int(x*640), int(y*480)), 5, (255, 0, 0), -1)
                        cv2.putText(image, '< Azalt / Artir >', (int(x*640), int(y*480)), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 0, 0), 2, cv2.LINE_AA)
                        
                        if x > 0.5:
                            cv2.putText(image, 'Sesi Artir', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA)
                            pyautogui.press('volumeup')
                        else:
                            cv2.putText(image, 'Sesi Azalt', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA)
                            pyautogui.press('volumedown')
    
                cv2.imshow('Ses Kontrol', image)
                if cv2.waitKey(5) & 0xFF == 27:
                    break
    
    volume_control()
    cap.release()
    cv2.destroyAllWindows()

Contributing 🤝

Contributions are welcome! Feel free to open issues or submit pull requests.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request.

volume_up_and_down_with_your_index_finger's People

Contributors

fastuptime avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.