node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »


This is a javascript version of the famous LSD (Line Segment Detector) algorithm. It was created using emscripten to compile the official C version into javascript and adding a bit of wrapper code to convert between javascript and C data types.

Currently only the main lsd() function call is available.


See example.js


You don't need to compile this unless you change the C code. Just use the pre-compiled index.js and index.*.js files.

First install emscripten. On a Ubuntu 14.04 the following should work:

sudo apt-get install emscripten

On Ubuntu 16.04 there appears to be an issue with emscripten. You'll need to build emscripten using emsdk:

sudo apt-get install cmake build-essential git
wget ""
tar cvzf emsdk-portable.tar.gz
cd emsdk-portable/
./emsdk update
./emsdk install latest
./emsdk activate latest
source ./

Now get the lsd source code:

cd line-segment-detector/
wget ""

To build:



License is AGPLv3