Coder Social home page Coder Social logo

dq621 / cvtracking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ztaylor-robotics/cvtracking

0.0 0.0 0.0 1.1 MB

Python scripts for tracking fiducials via overhead mounted cameras using the OpenCV API

License: GNU General Public License v3.0

Python 100.00%

cvtracking's Introduction

CVTracking v3.07

Python scripts for tracking fiducials via overhead mounted cameras using the OpenCV API

References: A lot of the code written has been pulled from or inspired by various amazing resources from great content creators. A few shout outs include: Adrian Rosebrock from https://www.pyimagesearch.com. OpenCV Team and Contributors for tutorials, demonstrations, and source code. ...

Camera.py:

Two classes are introduced which help to initialize a usb webcamera and to initialize a webcamera stream.

Class: camObjThreaded: A class which takes in the video source (a number from 0 - n) which represents the dev/video# used to initialize an OpenCV capture device. The other intialization variable is the width. This defines the width of the stream. This is to allow for smaller resolutions which will increase processing speeds.

def __init__(): takes in the values mentioned above and then initializes the camera with a user-guided prompt. This checks to make sure the camera is calibrated for intended operations
  (CALIBRATION IS NOT AN OPTION): This design choice was made because all aruco tracking needs the mtx and dist provided from calibration. 
    In the works: This step will be expidited to prompt the user to calibrate if it doesn't find the necessary calibration files.
  Once the camera is initialized, the stream begins in a thread which handles all i/o, and undistortion of the frames being recieved by the camera.

  It is necessary that the folder calibCache is set up as follows:
  This is to provide a storage point for the mtx and dists from calibration for future use (I.E. not needing to calibrate every time)
  badImg and goodImg are directories which contain the good and bad calibration images.

  \ProjectFolder
  ---\calibCache
  ------\cam"ID"
  ---------\badImg
  ---------\goodImg
  ---------\rotationMatrices
  ---------\translationMatrices
  ---------\resolution_mtx.txt
  ---------\resolution_dist.txt
  ---\trialCache

def calibrate(): runs through an automated process of calibrating which takes images until 20 good images are captured based on the checkerboard
  calibration.

def showCalibFeed() outputs the thread stream. When closed, the FPS average will be outputted.

def start(), update() called within the class and shouldnt be called by the user

def read() returns the undistorted frame from the thread

def stop() ends the thread and stops the cv.VideoCapture() stream. Class object is rendered useless at this point and should be deleted.

class FPS: Tracks the fps of the stream and can also be used to track the average number of loop iterations per second.

class WebcamVideoStream: The base threading class that was used to help implement camObjThreaded. Thanks to pyimagesearch.com for the amazing article on threading: source URL: https://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/

class camObj = previous iteration of the camera object. This is implemented without the threading and as such was slow and cumbersome in application.

Tracker.py: README in progress

cvtracking's People

Contributors

ztaylor-robotics 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.