Code Monkey home page Code Monkey logo

linedetection's Introduction

Line detection

I need to develop an algorithm for a drone line tracking school project.
The goal of this part of the project is to detect the nearest and biggest line of a photo.

Used libraries

OpenCV is used to detect line shapes of a photo.
Some shape filtering are processed with Numpy.
Matplotlib is used to analyse the results.

Example of a line detection

Filtering criterias have been defined to make line detection more reliable.
Instead of switching lines frequently during the same flight, the algorithm analyses the green lines accurately and chooses the red one as the right line to track based on the chosen criteria.

Without filtering

1

After applying the LENGTH filter

325

The LENGTH filter is simply based on the distance between the lines' ends.
The distance calculus is focused on the Y axis.

After applying the FORWARD filter

319

The result of the FORWARD filter is likely to be a short and straight line.
This filter is based on the comparison of the line ends' positions on the X axis to be sure the line is not too oriented.

Configuration

{
    "names" : {
        "LINES" : 0,
        "FILTERED_LINES" : 1,
        "LONG_LINES" : 2
    },
    "values" : [
        "lines",
        "filtered_lines",
        "long_lines"
    ],
    "criterias" : {
        "MIN_LENGTH" : 250,
        "MAX_VERTICAL_POSITION" : 200,
        "MAX_CENTER_DISTANCE" : 150,
        "MIN_ANGLE" : 1
    },
    "filters" : {
        "LENGTH" : 0,
        "FORWARD" : 1,
        "BOTTOM" : 2
    }
}

MIN_LENGTH is the minimum length of the line to be detected.
MAX_VERTICAL_POSITION corresponds to the maximum position the bottom end of the line can appear.
MAX_CENTER_POSITION defines distance that separates the line from the center.

How to use ?

  pip install -r requirements.txt
  bash init.sh
  python3 detection.py

linedetection's People

Contributors

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