ELSED: Enhanced Line SEgment Drawing

Overview

Graffter Banner

ELSED: Enhanced Line SEgment Drawing

Open in Colab arXiv Project Page

This repository contains the source code of ELSED: Enhanced Line SEgment Drawing the fastest line segment detector in the literature. It is ideal for resource-limited devices like drones of smartphones. Visit the Project Webpage to try it online!

Graffter header image

Dependencies

The code depends on OpenCV (tested with version 4.1.1).

To install OpenCV ... In Ubuntu 18.04 compile it from sources with the following instructions:
# Install dependencies (Ubuntu 18.04)
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
# Download source code
git clone https://github.com/opencv/opencv.git --branch 4.1.1 --depth 1
# Create build directory
cd opencv && mkdir build && cd build
# Generate makefiles, compile and install
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j
sudo make install

Compile and Run

The code contains a demo detecting large and short line segments in one image. The code can be compiled with Cmake:

mkdir build && cd build
cmake .. && make
./elsed_main

The result for the provided image should be:

******************************************************
******************* ELSED main demo ******************
******************************************************
ELSED detected: 305 (large) segments
ELSED detected: 391 (short) segments

Cite

@misc{suárez2021elsed,
      title={ELSED: Enhanced Line SEgment Drawing}, 
      author={Iago Suárez and José M. Buenaposada and Luis Baumela},
      year={2021},
      eprint={2108.03144},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
Comments
  • Bound check fixes

    Bound check fixes

    I've been testing ELSED on a video sequence and discovered a couple of memory overrun errors. They were all caused by wrong or missing bound checks which I have fixed here.

    opened by mlourakis 3
  • why the speed of ELSED in my computer is not so fast?

    why the speed of ELSED in my computer is not so fast?

    Hi! Your code is great ! But when I use it on my computer(intel i5-11400H Ubuntu 18.04), the speed of ELSED is about 14ms and LSD(OpenCV) is about 19ms. It is not so fast in your paper. what is wrong with my computer? I just use your code to test. I hope to get your reply. Thanks!!!!!

    opened by fightmoney 2
  • The different params between large segment and

    The different params between large segment and

    Hi, the code is very good! But I have some questions. In you main.cpp, detector short segments use follow params

     // Gaussian kernel size
      int ksize = 5;
      // Sigma of the gaussian kernel
      float sigma = 1;
      // The threshold of pixel gradient magnitude.
      // Only those pixels whose gradient magnitude are larger than
      // this threshold will be taken as possible edge points.
      float gradientThreshold = 30;
      // If the pixel's gradient value is bigger than both of its neighbors by a
      // certain anchorThreshold, the pixel is marked to be an anchor.
      uint8_t anchorThreshold = 8;
      // Anchor testing can be performed at different scan intervals, i.e.,
      // every row/column, every second row/column
      unsigned int scanIntervals = 2;
    
      // Minimum line segment length
      int minLineLen = 15;
      // Threshold used to check if a list of edge points for a line segment
      double lineFitErrThreshold = 0.2;
      // Threshold used to check if a new pixel is part of an already fit line segment
      double pxToSegmentDistTh = 1.5;
      // Threshold used to validate the junction jump region. The first eigenvalue of the gradient
      // auto-correlation matrix should be at least junctionEigenvalsTh times bigger than the second eigenvalue
      double junctionEigenvalsTh = 10;
      // the difference between the perpendicular segment direction and the direction of the gradient
      // in the region to be validated must be less than junctionAngleTh radians
      double junctionAngleTh = 10 * (M_PI / 180.0);
      // The threshold over the validation criteria. For ELSED, it is the gradient angular error in pixels.
      double validationTh = 0.15;
    
      // Whether to validate or not the generated segments
      bool validate = true;
      // Whether to jump over junctions
      bool treatJunctions = true;
      // List of junction size that will be tested (in pixels)
      std::vector<int> listJunctionSizes = {5, 7, 9};
    

    when you detect large segments. what is the params?

    opened by fightmoney 1
  • Some features about `ELSED::detectEdges()` ?

    Some features about `ELSED::detectEdges()` ?

    Thanks for your nice work! I use ELSED::detectEdges() like:

    upm::ELSED lineDetector;
    auto edges = lineDetector.detectEdges(colorImg);
    for (const auto &e: edges) {
        if (e.size() < 2)
          continue;
        const auto &startPx = e.front(), &endPx = e.back();
        // ......
    }
    

    But, I find e.back() seems not a end point of a edge! What e actually means as a vector?

    opened by zhangshaos 1
  • Some  problem when computeGradients

    Some problem when computeGradients

    Hi iago: first of all, thank you for your OPEN SOURCE. I am tring to use it in my project.but when i test it, i meet some strange problem(detect some lines that shouldn’t be exist). and finally,i add a imwrite here:

    	dstInfo->gImgWO = cv::Mat:(srcImg.size(), dstInfo->dxImg.type());
    	dstInfo->gImg = cv::Mat:(srcImg.size(), dstInfo->dxImg.type());
    	dstInfo->dirImg = cv::Mat:(srcImg.size(), CV_8UC1);
                cv::imwrite("beforegImg.jpg ", dstInfo->gImg);
    

    and then i find sometimes it will creat a img that is not a "black" one, some "white" pixels on it. but when i use cv::Mat::zeros instead of cv::Mat,i test many times and did't meet that again. but i can not sure this. could you help to confirm that? Thanks. tt1 beforegImg

    opened by David-dotcom666 4
Owner
Iago Suárez
Computer Vision Engineer & Artificial Intelligence Researcher
Iago Suárez
Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

M-LSD: Towards Light-weight and Real-time Line Segment Detection Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Det

null 123 Jan 4, 2023
LETR: Line Segment Detection Using Transformers without Edges

LETR: Line Segment Detection Using Transformers without Edges Introduction This repository contains the official code and pretrained models for Line S

mlpc-ucsd 157 Jan 6, 2023
Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly

Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly Code for this paper Ultra-Data-Efficient GAN Tra

VITA 77 Oct 5, 2022
dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ)

dualFace dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ) We provide python implementations for our CVM 2021 paper "dualFac

Haoran XIE 46 Nov 10, 2022
deep learning model that learns to code with drawing in the Processing language

sketchnet sketchnet - processing code generator can we teach a computer to draw pictures with code. We use Processing and java/jruby code paired with

null 41 Dec 12, 2022
A simple PyTorch Implementation of Generative Adversarial Networks, focusing on anime face drawing.

AnimeGAN A simple PyTorch Implementation of Generative Adversarial Networks, focusing on anime face drawing. Randomly Generated Images The images are

Jie Lei 雷杰 1.2k Jan 3, 2023
labelpix is a graphical image labeling interface for drawing bounding boxes

Welcome to labelpix ?? labelpix is a graphical image labeling interface for drawing bounding boxes. ?? Homepage Install pip install -r requirements.tx

schissmantics 26 May 24, 2022
Colour detection is necessary to recognize objects, it is also used as a tool in various image editing and drawing apps.

Colour Detection On Image Colour detection is the process of detecting the name of any color. Simple isn’t it? Well, for humans this is an extremely e

Astitva Veer Garg 1 Jan 13, 2022
Code for "Learning to Segment Rigid Motions from Two Frames".

rigidmask Code for "Learning to Segment Rigid Motions from Two Frames". ** This is a partial release with inference and evaluation code.

Gengshan Yang 157 Nov 21, 2022
[CVPR2021] DoDNet: Learning to segment multi-organ and tumors from multiple partially labeled datasets

DoDNet This repo holds the pytorch implementation of DoDNet: DoDNet: Learning to segment multi-organ and tumors from multiple partially labeled datase

null 116 Dec 12, 2022
code for `Look Closer to Segment Better: Boundary Patch Refinement for Instance Segmentation`

Look Closer to Segment Better: Boundary Patch Refinement for Instance Segmentation (CVPR 2021) Introduction PBR is a conceptually simple yet effective

H.Chen 143 Jan 5, 2023
COD-Rank-Localize-and-Segment (CVPR2021)

COD-Rank-Localize-and-Segment (CVPR2021) Simultaneously Localize, Segment and Rank the Camouflaged Objects Full camouflage fixation training dataset i

JingZhang 52 Dec 20, 2022
Temporal Segment Networks (TSN) in PyTorch

TSN-Pytorch We have released MMAction, a full-fledged action understanding toolbox based on PyTorch. It includes implementation for TSN as well as oth

null 1k Jan 3, 2023
【ACMMM 2021】DSANet: Dynamic Segment Aggregation Network for Video-Level Representation Learning

DSANet: Dynamic Segment Aggregation Network for Video-Level Representation Learning (ACMMM 2021) Overview We release the code of the DSANet (Dynamic S

Wenhao Wu 46 Dec 27, 2022
This project aims to segment 4 common retinal lesions from Fundus Images.

This project aims to segment 4 common retinal lesions from Fundus Images.

Husam Nujaim 1 Oct 10, 2021
Identify the emotion of multiple speakers in an Audio Segment

MevonAI - Speech Emotion Recognition Identify the emotion of multiple speakers in a Audio Segment Report Bug · Request Feature Try the Demo Here Table

Suyash More 110 Dec 3, 2022
Pytorch implementation of paper "Learning Co-segmentation by Segment Swapping for Retrieval and Discovery"

SegSwap Pytorch implementation of paper "Learning Co-segmentation by Segment Swapping for Retrieval and Discovery" [PDF] [Project page] If our project

xshen 41 Dec 10, 2022
some classic model used to segment the medical images like CT、X-ray and so on

github_project This is a project for medical image segmentation. This project includes common medical image segmentation models such as U-net, FCN, De

null 2 Mar 30, 2022