Giter Club home page Giter Club logo

distance_measurement_using_single_camera's Introduction

Distance measurement using single:one:camera :camera:

You can use this code to measuere the distance from object to camera using single camera ๐Ÿ“ท .

I have detect a face in the frame and estimated a distance using the width of face.

Clone this Repo:

git clone https://github.com/Asadullah-Dal17/Distance_measurement_using_single_camera

install Opencv-python

  • Windows

    pip install opencv-python

  • install Opencv-python on Linux or Mac

    pip3 install opencv-python

Run the code

  • windows: ๐Ÿ‘‡

    python distance.py

    ------ OR ---------

    python Updated_distance.py

  • linux or Mac ๐Ÿ‘‡

    python3 distance.py

    ------ OR ---------

    python3 Updated_distance.py

๐Ÿ’กFocal Length Finder Function Description ๐Ÿ’ก

# focal length finder function
def FocalLength(measured_distance, real_width, width_in_rf_image):
    focal_length = (width_in_rf_image* measured_distance)/ real_width
    return focal_length

The Focal Length finder Function Tacks Three Arguments:

measured_distance It is distance which we have measured while capturing reference image. From object to Camera which is Known_distance = 72.2 #centimeter

real_width Its measure with width of object in real world, here i measure the width of face in real world which was Known_width =14.3 #centimeter

width_in_rf_image it width of object in the image/frame it will be in pixels

๐Ÿ’กDistance Finder Function Description ๐Ÿ’ก

# distance estimation function
def Distance_finder (Focal_Length, real_face_width, face_width_in_frame):
    distance = (real_face_width * Focal_Length)/face_width_in_frame
    return distance

This Funciton Taks Three Argument,

Focal_Length it is focal length, out of FocalLength finder function.

real_face_width Its measure width of object in real world, here i measure the width of face in real world which was Known_width =14.3 #centimeter

face_width_in_frame width of face in the frame, unit will pixels here.

You can Which my Video on the Youtube: https://youtu.be/zzJfAw3ASzY

Updated_Distance.py Looks something likes This.

Gif Update Distnace code

I have also create Face Following Robot which use distance Estimation, if you are interested you can Watch my Youtube Video

if You found this Helpful, please star โญ it.

if you have any Query feel free to ask me on my Social Media.

๐Ÿ’š Join Me on Social Media ๐Ÿ’š

AiPhile Youtube AiPhile Facebook AiPhile Insta Github

distance_measurement_using_single_camera's People

Contributors

asadullah-dal17 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.