• Stars
    star
    279
  • Rank 147,967 (Top 3 %)
  • Language
    Python
  • Created about 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

using single camera to measure the distance opencv python,

Distance measurement using single1️⃣camera πŸ“·

GitHub Repo stars GitHub forks YouTube Channel Subscribers

If you want to estimate distance of objects with your simple webcam, then this algorithm(Triangle similarity) would be helpful for you to find Distance from object to camera, I have provide to two examples, one is simple face detection and distance Estimation, other is Yolo4 object detection and distance Estimation

Here in this readme file you will get short description, if need more details, then you can watch video tutorial on YouTube as well.

Distance & Speed Estimation Demo

Distance.and.Speed.Estimation.Demo.mp4

Video Tutorials

Distance Estimation Youtube Tutorail YouTube Video Views

Distance & Speed Estimation Youtube Tutorial YouTube Video Views

YoloV4 Object Detection & Distance Estimation YouTube Video Views Project GitHub Repository

YoloV4 Distance Estimation

YoloV4.Distance.Estimation.mp4

Distance Estimation on Raspberry Pi πŸ“

Distnace.Estiamtion.on.Pi.mp4

βœ”οΈ here is source code and details for Instllation of Opencv-python on πŸ“ Pi πŸ˜ƒ Distance Estimation on Raspberry pi πŸ“

βœ”οΈ I have included Speed Estimation code is well check that out.

βœ”οΈ You can find the implementation of Distance estimation of multiple objects using Yolo V4 Object Detector Opencv-python

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 focal_length(measured_distance, real_width, width_in_rf_image):

    focal_length_value = (width_in_rf_image * measured_distance) / real_width
    #return focal length.
    return focal_length_value

The Focal Length finder Function Tacks Three Arguments:

measured_distance It is distance which we have measured while capturing reference image:straightruler:. **_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.

I have also create Face Following Robot which use distance Estimation, if you are interested you can Watch my Youtube Video You can create Face Following Robot with Raspberry that would be easy then, using Arduino Stuff, Raspberry πŸ“ Pi will make it system on Robot πŸ€–

if You found this Helpful, please star ⭐ it.

You can Watch my Video Tutorial on Computer Vision Topics, just check out my YouTube Channel AiPhile Youtube

If You have any Question or need help in CV Project, Feel free to DM on Instagram Instagram

I am avalaible for paid work here Fiverr fiverr

πŸ’šπŸ–€ Join me on Social Media πŸ–€πŸ’š

YouTube AiPhile Youtube GitHub GitHub Medium Medium Fiverr Fiverr Instagram Instagram

More Repositories

1

Eyes-Position-Estimator-Mediapipe

This is Eyes πŸ‘οΈ πŸ‘οΈ Tracking Project, here we will use computer vision techniques to extracting the eyes, Mediapipe python modules will provide the face landmarks,
Python
133
star
2

Yolov4-Detector-and-Distance-Estimator

Python
95
star
3

Basic-Augmented-reality-course-opencv

This is basics Augmented reality course, which is free you can find video tutorial on https://www.youtube.com/aiphile
Python
71
star
4

QR-detection-and-Distance-Estimation

QR code Detection and Distance Estimation opencv Python, it more accurate version of distance Estimation,
Python
47
star
5

Eyes-Tracking-Opencv-and-Dlib

Estimating the position of Eyes πŸ‘€
Python
42
star
6

iris-Segmentation-mediapipe-python

Iris tracking MediaPipe Video Tutorial Source code
Python
34
star
7

yolov4-opencv-python

yolov4 object detection using opencv python, its simplest way to run inference on yolo
Python
26
star
8

Face-Following-Robot-using-Distance-Estimation

This Robot will follow the Face and according to The Distance Estimation using Computer Vision, without and Sensor Then a Single Camera
Python
22
star
9

computer-vision-projects

This repository will contain My Computer Vision Project, plus their tutorial on youtube and source code.
13
star
10

Improved_detection-with-Optical-Flow-distance-estimation

Python
12
star
11

AiPhile-Mediapipe-Course

Mediapipe Course 2023, here you can find the course https://www.youtube.com/c/aiphile
Python
11
star
12

Machine-Learning-Models-Mediapipe-

Trying different model,
Python
8
star
13

youtube-videos-Code

This repository contains the code of YouTube Video.
Python
6
star
14

Opencv_Youtube_Series

Python
4
star
15

cartoonize-images

how to cartoonize images using python and AI
Jupyter Notebook
4
star
16

generate-QR-code-with-face-in-it

Generate QR code with face in it
Python
4
star
17

DeepFakeAndSuperResultion

I will use first order model to create deep fake and up scale the video up required resolution using another AI
Jupyter Notebook
4
star
18

Distance-Estimation-Opencv-CPP

C++
3
star
19

Asadullah-Dal17

3
star
20

Face_Detection_Projects

This repository will provide you source code and comparison of face detection with different Modules, like, performance, fps, accuracy etc., with complete Video, with having each video different project with it.
Python
3
star
21

face-detection-Comparsion-between-Opencv-and-Dlib-on-Raspberry-Pi-4

These scripts will detect face for you, if want to exmine which face detector is better on Raspberry Pi just open Up task manger while detection face/ runing these scripts on Raspberry pi
Python
3
star
22

Qr-code-detection-distance-estimation

QR code tracking with optical flow, and increase the distance estimation, range using Optical flow tracking, from 15.5 cm(on 1.5 cm sized QR code), 7x more which is due to optical flow,
Python
3
star
23

Improve-object-detection

Improve object detection using optical flow opencv python.
Python
2
star
24

Mediapip-Eyes-tracking

πŸ‘οΈ πŸ‘οΈ Tracking using Mediapipe python module,
Python
2
star
25

learn-opencv-python

learn opencv-python from basic to advances, with AiPhile
Python
2
star
26

face_swaping

face swapping with colab
Jupyter Notebook
2
star
27

AiPhile

This simple Computer Vision Module is built on top of OpenCV-python, It has some helpful functions, like drawing transparent shapes, text with background, etc.
Python
2
star
28

utils

draw text with better readability OpenCV python (backgrounded text), Draw shapes with controlled transparency using OpenCV-python only, like rectangle, 🟩 custom shape fillPoly πŸ”Ί , with opacity
Python
2
star
29

face-Recognition-

face Recognition using different modules of python and deep learning
Python
1
star
30

Mobile-camera-for-Opencv-Python-

Python
1
star
31

Simple-Computer-vision

simple and short computer vision projects
Python
1
star
32

Pong-Game-pygame

learning Pygame, part of AR Project.
Python
1
star
33

testing-code-space

EJS
1
star
34

Color-Identification

How to Identify the color in the live video feed using python opencv.
Python
1
star
35

Color-Detection-Opencv-python

Detect color and Identify the color in the video feed Opencv python
1
star
36

computer-vision-on-raspberry-pi

simple computer vision projects on raspberry pi 4,
Python
1
star
37

contours-detection-advance

contours sorting by area
Python
1
star
38

Optical-Flow-Tutorial-Opencv-python

Python
1
star
39

ArUco-Marker-Detection-and-Pos-Estimation-Cplus-plus

1
star
40

FirstOrderMotion

1
star
41

text-to-Speech-python

Convert Text into Speech and Save as Audio File using python module pyttsx3
Python
1
star
42

Config_files

1
star
43

testing

1
star
44

OpenCV-Python-Series

this Series will be published on AiPhile-Urdu and Hindi
1
star
45

AiPhile_site

my computer vision projects pages
1
star