Code Monkey home page Code Monkey logo

vanishing-point-detector's Introduction

Vanishing Point Detection using Least Squares

Detector on sample footage.
Red colored lines were considered for estimating the vanishing point. The black circle marks the region of interest, where the center of the circle is the approximate vanishing point.

  1. Dependencies
  2. Speed
  3. Algorithm

Citing Vanishing-Point-Detector

Please cite our work if Vanishing-Point-Detector and our approach helps your research.

@Misc{Vanishing-Point-Detector,
  author = {{Dhall*}, A. and {Chandak*} Y.}
  title = "{Vanishing Point Detection using Least Squares}",
  howpublished = {\url{https://github.com/ankitdhall/Vanishing-Point-Detector}},
  year = {2015}
}

Dependencies

  • OpenCV for C++
  • Armadillo

Speed

Average performance: 21 fps

Algorithm

  • The algorithm starts by computing dx and dy of the image. Then the edge vectors are formed which encodes the direction and magnitude at each pixel.

  • This field is segmented into connected regions of pixels that share the same vector direction up to a certain tolerance.

  • The principal axis of the bounding box enclosing this region gives a single pixel thick straight line. Then, x, y co-ordinates of either ends are stored.

  • Then the lines are converted to the ax + by = c form.

  • These co-efficients (a, b, c) are stored in the matrix A, B in the following format:

     A = [a1 b1  
          a2 b2  
            ..  
            ..  
         an bn]    
     B = [c1 c2 ... cn ]'  
  • Solve for vector X in AX = B with the concept of least square approximation of the answer. Where X = [x y] T

  • For each pair of lines in the matrix A, their point of intersection X’ = [x y] T is found. This is multiplied with the matrix A and then B is subtracted to get the error vector E.

    E = AX’ – B
  • The squared sum of error vector is computed and whichever X’ gave the least summation of errors is chosen as the vanishing point in the image.

vanishing-point-detector's People

Contributors

ankitdhall avatar

Watchers

James Cloos 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.