Giter Site home page Giter Site logo

learntechwithus / stereo-vision Goto Github PK

View Code? Open in Web Editor NEW
337.0 19.0 110.0 2.12 MB

This program has been developed as part of a project at the University of Karlsruhe in Germany. The final purpose of the algorithm is to measure the distance to an object by combining two webcams and use them as a Stereo Camera.

License: MIT License

Python 100.00%
camera calibration stereo-vision measure distance picture opencv

stereo-vision's Introduction

Stereo-Vision

This program has been developed as part of a project at the University of Karlsruhe in Germany. The final purpose of the algorithm is to measure the distance to an object by using Stereo Cameras.

A video of the project can be found here: https://www.youtube.com/watch?v=xjx4mbZXaNc

It is still an experimental version and further improvements will have to be done.

Contributors

  • Stephane VUJASINOVIC
  • Frederic UHRWEILLER

Requirements

You will need:

  • Two webcams
  • Python installled on your computer
  • A Chessboard for the calibration

Required python packages:

  • numpy
  • openCV
  • openpyxl
  • scikitlearn

"Take_images_for_calibration.py"

You will need to take pictures with both cameras yith this script in order to calibrate the cameras (remove the distorsion and stereo calibration) It is good to take around 30 to 50 pictures with both cameras.

”Main_Stereo_Vision_Prog.py”

This script is used to calibrate the cameras with the pictures previously taken by the script "Take_images_for_calibration.py". A disparity map is then generated and thank to a third order regression, it is possible to measure the distance to a defined object by clicking on it.

Camera used in this project

Cameras used in the projet are: Logitech Webcam C170. C270 and C370 are also fine.

Amazon Links for webcams (best prices):

stereo-vision's People

Contributors

freduhr avatar hafidhh avatar karan2808 avatar learntechwithus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stereo-vision's Issues

Question about general use in any case

Hello,

I would like to know, if this script can measure the distance of any object shown in a stream, no matter where it's located?
If not, what adjustments in the code are necessary?

I plan to use a stereo camera and a pretrained CNN, which detects objects, additionally I want to measure the distance to the detected objects.

Thanks in advance

distance calculation

Distance= -593.97average**(3) + 1506.8average**(2) - 1373.1*average + 522.06

how do you substitute the values in the above...What is the equation you are using to get the distance value.

Mapping pixels for distance

How do I select a point in 2d image (either from the right camera or the left camera) and get the distance through the stereo vision?

Clarity on dependency versions

It is unclear what the versions of dependencies (OpenCV, numpy etc) this successfully works with and have had some issues running out of the box. Can you be more specific on environment configuration and versions please. Thanks

Algorithm and Source

it would be nice if you also include the method you are using such as algorithm, papers, result, etc. As a student, it would be really help full to learning such stuff

SystemError: new style getargs format but argument is not a tuple

When we run "Main_Stereo_Vision_Prog.py" it gives the above error in stereocalibrate function

# StereoCalibrate function
flags = 0
flags |= cv2.CALIB_FIX_INTRINSIC
#flags |= cv2.CALIB_FIX_PRINCIPAL_POINT
#flags |= cv2.CALIB_USE_INTRINSIC_GUESS
#flags |= cv2.CALIB_FIX_FOCAL_LENGTH
#flags |= cv2.CALIB_FIX_ASPECT_RATIO
#flags |= cv2.CALIB_ZERO_TANGENT_DIST
#flags |= cv2.CALIB_RATIONAL_MODEL
#flags |= cv2.CALIB_SAME_FOCAL_LENGTH
#flags |= cv2.CALIB_FIX_K3
#flags |= cv2.CALIB_FIX_K4
#flags |= cv2.CALIB_FIX_K5
retS, MLS, dLS, MRS, dRS, R, T, E, F= cv2.stereoCalibrate(objpoints,
                                                          imgpointsL,
                                                          imgpointsR,
                                                          mtxL,
                                                          distL,
                                                          mtxR,
                                                          distR,
                                                          ChessImaR.shape[::-1],
                                                          criteria_stereo,
                                                          flags)

Output:

Starting calibration for the 2 cameras... 
Cameras Ready to use
Traceback (most recent call last):
  File "/home/prasad/Desktop/Distance with SV/Main_Stereo_Vision_Prog.py", line 135, in <module>
    (flags,flags))
SystemError: new style getargs format but argument is not a tuple

Calculating the distance

Hi,

May I ask you to explain this line of the code, for which reason you are using those numbers.
Distance= -593.97*average**(3) + 1506.8*average**(2) - 1373.1*average + 522.06

Thanks.

Processing speed is too slow

-Processing speed is too slow, I need to make it faster what I should do?
-What is the maximum distance range? I got only 5 meters, Is there any way to get the distance reach about 8 meters??
-Should I input the distance between the two lenses in the code??

ximgproc

Hi,
When I try to run the main program I got the following error:
AttributeError: module 'cv2' has no attribute 'ximgproc'

Does I need any additional libraries?

Getting error for Excel file

I don't understand the concept of Excel file... Can you please elaborate, How and why its needs the Excel file... I'm getting the following error

PS B:\TUHIN\PYTHON PROGRAMS> python '.\10_1 Main_Stereo_Vision_Prog.py' Traceback (most recent call last): File ".\10_1 Main_Stereo_Vision_Prog.py", line 23, in <module> from openpyxl import Workbook # Used for writing data into an Excel file ModuleNotFoundError: No module named 'openpyxl'

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.