Git Product home page Git Product logo

line-segment-detector's Introduction

Line Segment Detector

This is an open-source implementation of the Line Segment Detector paper by Grompone von Gioi et al. This is a complete reimplementation from scratch, as the original source code publsihed with the paper is under the Aferro GPL license, which is much too restrictive for common use cases. As a result, this project is published under a much more permissive MIT license.

Installing the Library

Pending release on PyPi, the library can be installed directly from GitHub:

pip3 install git+https://github.com/hdkai/Line-Segment-Detector.git

Detecting Lines in an Image

The library exposes a single method:

def line_segment_detector (image: ndarray, scale=0.8, angle_tolerance=22.5):
    """
    Compute line segments in an image using a modified implementation of the 
    Line Segment Detector paper: http://www.ipol.im/pub/art/2012/gjmr-lsd/article.pdf

    Parameters:
        image (ndarray): Input image, either RGB or greyscale.
        scale (float): Downscale factor for processing.
        angle_tolerance (float): Angle tolerance in degrees.

    Returns:
        ndarray: Lines array with shape (N,8), with each row being [ x1, y1, x2, y2, cx, cy, l, w ].
    """

The function accepts a single color or greyscale image, and returns an Nx8 matrix, where each row contains:

  1. The x coordinate of the first point on the line segment.
  2. The y coordinate of the first point on the line segment.
  3. The x coordinate of the second point on the line segment.
  4. The y coordinate of the second point on the line segment.
  5. The x coordinate of the center of the line segment.
  6. The y coordinate of the center of the line segment.
  7. The length of the line segment l.
  8. The width of the line segment w. For every detected line, w < l.

Requirements

  • Python 3.6+
  • Cython 0.29.21+.

line-segment-detector's People

Contributors

olokobayusuf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.