pylsd is the python bindings for LSD - Line Segment Detector
Project description
pylsd
1. Introduction
pylsd is the python bindings for LSD - Line Segment Detector.
2. Install
This package uses distutils, which is the default way of installing python modules. To install in your home directory, securely run the following:
git clone https://github.com/primetang/pylsd.git
cd pylsd
python setup.py install
Or directly through pip
to install it:
pip install pylsd
3. Usage
We can use the package by using from pylsd.lsd import lsd
, and lines = lsd(src)
is the call format for the lsd
function, where src
is a Grayscale Image (H * W
numpy.array), and the return value lines
is the Detected Line Segment, lines
is an N * 5
numpy.array, each row represents a straight line, the 5-dimensional vector is:
[point1.x, point1.y, point2.x, point2.y, width]
According to these presentations, we can use it just like the following code (here is the link):
- by using cv2 module
import cv2
import numpy as np
import os
from pylsd.lsd import lsd
fullName = 'car.jpg'
folder, imgName = os.path.split(fullName)
src = cv2.imread(fullName, cv2.IMREAD_COLOR)
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
lines = lsd(gray)
for i in xrange(lines.shape[0]):
pt1 = (int(lines[i, 0]), int(lines[i, 1]))
pt2 = (int(lines[i, 2]), int(lines[i, 3]))
width = lines[i, 4]
cv2.line(src, pt1, pt2, (0, 0, 255), int(np.ceil(width / 2)))
cv2.imwrite(os.path.join(folder, 'cv2_' + imgName.split('.')[0] + '.jpg'), src)
- by using PIL(Image) module
from PIL import Image, ImageDraw
import numpy as np
import os
from pylsd.lsd import lsd
fullName = 'house.png'
folder, imgName = os.path.split(fullName)
img = Image.open(fullName)
gray = np.asarray(img.convert('L'))
lines = lsd(gray)
draw = ImageDraw.Draw(img)
for i in xrange(lines.shape[0]):
pt1 = (int(lines[i, 0]), int(lines[i, 1]))
pt2 = (int(lines[i, 2]), int(lines[i, 3]))
width = lines[i, 4]
draw.line((pt1, pt2), fill=(0, 0, 255), width=int(np.ceil(width / 2)))
img.save(os.path.join(folder, 'PIL_' + imgName.split('.')[0] + '.jpg'))
The following is the result:
- car.jpg by using cv2 module
- house.png by using PIL(Image) module
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ocrd_fork_pylsd-0.0.8-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc0f6aff65c573fd2b2d93e62261bdf2af35c5e568a9a053d5685813eff45929 |
|
MD5 | ab492436b4d026996294753865bda26b |
|
BLAKE2b-256 | 504db6b9d6f35fb1510b1781d0cee022b29d72eda637986eaea6d5e8b941c415 |
Hashes for ocrd_fork_pylsd-0.0.8-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a9b21e5003bfbfeefc9c5f4937ed4ab65ab817dd46f6cf951e2ee4160ebc580 |
|
MD5 | 98215bb97fcc8d7e38c55215ec7320ab |
|
BLAKE2b-256 | 2b81ab8b5d77763e811630cab7d44be72a5885bb78e0ad5145506d9a5c3fdd5d |
Hashes for ocrd_fork_pylsd-0.0.8-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08660f69c1dd3c691a46ddb998107e9e78e336659d5366373e1a01718611990e |
|
MD5 | 167c11ddf06bfddbd43bc5f150cd9614 |
|
BLAKE2b-256 | bd62a3f0f59401d5d7e9e4f91bd8ef65a1a9841246957e5d30165338f38a6aeb |
Hashes for ocrd_fork_pylsd-0.0.8-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f32c04043cf6b9de4f2f657939707c9a29f69a2cf5fc35d6e0a2836ec3b5f1f3 |
|
MD5 | 7d959a586b001a13759d534e66b01d12 |
|
BLAKE2b-256 | a473e77853ce93b89ad69bb56e9b1a5609c86713e4edb97ad85ebce8bfae7399 |
Hashes for ocrd_fork_pylsd-0.0.8-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02e1210c64ef9fc51482f4c858443d5598888e7467d7f1e95e3370558e848afb |
|
MD5 | 6a75ac38637fa76c6e91ab9086e99c56 |
|
BLAKE2b-256 | 3071b354470f841b6fa8f463664bc89e2425a88a8f5fffa7fccda36e70274bab |
Hashes for ocrd_fork_pylsd-0.0.8-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b93da8137a2105983b71b1f2b565e46b836cf8aed76544ba1384b6fbf3a99f2c |
|
MD5 | 7a454893edec1c5370fb2b6e84c2a6a6 |
|
BLAKE2b-256 | 2ab5c44e0fac01e9a72a5787e49d6ca931957d9a5da23885c5f2ec77e82d1316 |
Hashes for ocrd_fork_pylsd-0.0.8-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80e7a73322e32335ba221dc89c06e4b99252fffafd54bd385d86ac42ca1a358d |
|
MD5 | 06e4f814af0d743d9fbb4fb67132e6fa |
|
BLAKE2b-256 | 979b6950aac0c3aa5038f6c8bc26d45db022a4fc4c1177418187fb925b48ca44 |
Hashes for ocrd_fork_pylsd-0.0.8-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4354ce74fe2999f0d88f9199601f3969a00fa2eee280aab3e03bf698b8f238 |
|
MD5 | d5fc1c9062ba5bc1a2406af5c4c9788d |
|
BLAKE2b-256 | d2cd0e468e3c831d565e2abb15a6c339afbb6f519ac85365e9a1ffa51e113014 |
Hashes for ocrd_fork_pylsd-0.0.8-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af5413b0b6f079cb0dd3f76323884ab088410c7df5788c6bc396ad7d8efcac32 |
|
MD5 | a80976337174490e8cdc273c6181427f |
|
BLAKE2b-256 | 69f443c7975686b4d52344d93749cab25ad2515394e8d53b69636a6008984090 |
Hashes for ocrd_fork_pylsd-0.0.8-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a20deed57b810b25d6e5d7e2835355b02035b6c8c08fb16638bcede184da7e33 |
|
MD5 | cc91ec9a9545322013530250e22e12db |
|
BLAKE2b-256 | 65efe826d1a16405d3d852aa76c911b916165112fa8fa21dba5d096a328e0bc3 |
Hashes for ocrd_fork_pylsd-0.0.8-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc6f64073a2b91577d6e62b676623591bb9320f288702f6eea76295d36384458 |
|
MD5 | d3dda0abc42407e9f28b22541994a658 |
|
BLAKE2b-256 | 43ec8cc00d4022b114b1b8a7e08f2823791dc0ce0a51b907e45d69a942973039 |
Hashes for ocrd_fork_pylsd-0.0.8-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72d2a8365375fe7baf7f781415d66e3c9d0174bc67598403cdc586b3f8ebe759 |
|
MD5 | 02d58fa02d76e97a0f35d9c0c799f0c8 |
|
BLAKE2b-256 | de8f12bedcfb5c5ddb2466db3a8b4d95ab901eaa7217c5ff44eb4d1c479e1a76 |
Hashes for ocrd_fork_pylsd-0.0.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec41c5778718c596fbd6980100793265971d8863b85ed3ad6bbb382339030e2 |
|
MD5 | 679864ae98ba470cd31369ec5fb7646b |
|
BLAKE2b-256 | 9f56f49d055001b3a33fe4086afa2d3026e372ca01543c686ba2dadcd057dd5e |
Hashes for ocrd_fork_pylsd-0.0.8-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 874cdcf7c99c4a9fa8b9022fce4c7404e621373145aa719d9306180f40271120 |
|
MD5 | a04fdf36f385930cbba1e6f3787793c6 |
|
BLAKE2b-256 | db09fad7e06ee1d529a09b1ca269345c23c6db2b639d7bbc91f2d8ded1e1e0f3 |
Hashes for ocrd_fork_pylsd-0.0.8-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a1a416d5019ddf68a8fe864c72b650864e2bb9e192b92ebd0c7f36a616f490 |
|
MD5 | 530a637709d45e119ba6503752fcca58 |
|
BLAKE2b-256 | 9ad57f70d040fe8e48e58a0b13f6334ec0e954633a1ebeb1e5480f5771a70162 |
Hashes for ocrd_fork_pylsd-0.0.8-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5bf5c7148489b0a20bcb56dcc4a84abf83523f35d88e1d572406b676bfbec1e |
|
MD5 | 1f563251457611f4109883035ceb40d2 |
|
BLAKE2b-256 | 958afa4c5206d7938d2f223be4447068b671bb587033b742afa94dde95f4265c |
Hashes for ocrd_fork_pylsd-0.0.8-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e2db0d6e09dc8c76ad1af9325683663bff6bb07efbd20be97086998c88b31ec |
|
MD5 | 1754d0a6fa5cbe4edfd660d6dbb10c05 |
|
BLAKE2b-256 | ff9c7e8e65914371dc31e3ba247a83ec885462edd446fcdccfad14499be81fa6 |
Hashes for ocrd_fork_pylsd-0.0.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89a01305fb01a2031a026c9f0c07a8c25772b2cadcb4f18680045211b27d5c4 |
|
MD5 | 08965b03c5ff67d1abd7a8b16c9086ee |
|
BLAKE2b-256 | 21691968f699d950a12414280ae34cb0035ec2c5af44c37b7697626fed6e2e3f |
Hashes for ocrd_fork_pylsd-0.0.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86081959448276fcdec24972f4f537d36c2b9ff73c085b35e9c88e8551b47391 |
|
MD5 | a2621ac9324d962934a3c15cc934c623 |
|
BLAKE2b-256 | c90c9dc49e9a271b3c3b1fa994802b06d289e450267d94a5b79e135811ba4127 |
Hashes for ocrd_fork_pylsd-0.0.8-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d98c327c9d02dbf32b72b8aba09cafb7f80bfc578b0ec1bfaf1cd417c62b53b |
|
MD5 | 728b54367cea63c7747b10b4213bb7de |
|
BLAKE2b-256 | 18659b0b6883ef152899f6b5c597ed868bac66de8c922e6070d8a2cac3468cf1 |
Hashes for ocrd_fork_pylsd-0.0.8-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2e3cde579a9f50c373df13303111cd4a55e8d2f743abbd41cc529672a970a09 |
|
MD5 | 13c58f308e7b913422e3f4645f391f85 |
|
BLAKE2b-256 | 6e2d65d879bf50d1f780af38ce42bff5621426dcc73ecd28d994d5daa248689b |
Hashes for ocrd_fork_pylsd-0.0.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4574526d7b3221a51c83bcd72fbee74cd0d2cceda1a6bb02cec22c5e218fafea |
|
MD5 | 94bc2d39a12e7cb03611a59557f6974d |
|
BLAKE2b-256 | 212e7b63453b864107f8ccfd749c6ca2e4d87d29ac57a8f7b870bce30ae03db1 |
Hashes for ocrd_fork_pylsd-0.0.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93f05d7e22873973fed1ee3f7183f1e53d48db2d57bbdfb19db9402040a8c053 |
|
MD5 | 6a4a46db5456e8d834492199c28c3205 |
|
BLAKE2b-256 | 053ddfb070682c39f02b2da4c08a15f20d7429d9f09a42f337f91d0f969f6a26 |
Hashes for ocrd_fork_pylsd-0.0.8-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd47c141fe390d3694ea4f323b4329a76cfd84597eb1ac91c40f0d60d437e819 |
|
MD5 | cb1db2de37f647eaa4a19ca5a79c778c |
|
BLAKE2b-256 | 1ba7f0607326c00e616820ab79c1c8df9627006f3e4819bcbe6c615103b41a86 |
Hashes for ocrd_fork_pylsd-0.0.8-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee734019ca1a66b34ff916c7cbd7c30e1827c308e730793716965c4e8c49054 |
|
MD5 | 0379b56ac707c7eb13ce8b14eb96fd32 |
|
BLAKE2b-256 | 7ad534ca26e18a5d2417e21604805d986cf5527b6443f3d5c936f8165b844050 |
Hashes for ocrd_fork_pylsd-0.0.8-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88d3720b546a5dfac8aa5b2879761d6583ed865ebb43b2393195732a9bdeba50 |
|
MD5 | 30fa27801140bfa4d610bcf2e7538f57 |
|
BLAKE2b-256 | 8ec6791a47575342b5f6e5e941d3b22180378adc4c2e87a02438acfd268e9eaa |
Hashes for ocrd_fork_pylsd-0.0.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9636ba0689c672f5e71203d05a360052d4d5cb8be63266fa8c3ce59ed626bca |
|
MD5 | 21918dd5322adb40f3907c1128ec010d |
|
BLAKE2b-256 | 05f96e2d96f70d40ccd0bef1c22a0ea06bdc9b973ec4c5e99df35d960bfc7495 |
Hashes for ocrd_fork_pylsd-0.0.8-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 586f158dcea52fea95b1928701ca1d534fac6bdc73faba46b6560c09aac81913 |
|
MD5 | 7ec24236312539235ccf9ce188b69407 |
|
BLAKE2b-256 | 1b7f9d28aa9e366283f94148e855cc6a8bafcf9c6a8c57a3fb7b80bded12dcf1 |
Hashes for ocrd_fork_pylsd-0.0.8-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acda728ec970b227d930c11e8f41dff4b3acf9ef5ade347c4e72f30d599f71e4 |
|
MD5 | c354b3ff790f9114cf394f4b35583906 |
|
BLAKE2b-256 | 5efd96e9029456d6d63fdcd4d9276ba1a99c42b80b0167bc931bd6e444b060c0 |
Hashes for ocrd_fork_pylsd-0.0.8-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0bca39543c5f037ed3039a949a480cebdac7978378edd8f8bd591bb0091de07 |
|
MD5 | 755b3cea95976b1d19dccada6515128e |
|
BLAKE2b-256 | 001c1bcd4940de4e0e14d126f5fa70e16fcd7e08b98f5abcf8e090cf166fb2ac |
Hashes for ocrd_fork_pylsd-0.0.8-cp37-cp37m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c61d51091b5509df1ebba7e63b833a1ed3504760d547653b695b6d33cfd02d3 |
|
MD5 | c48f188c4d7dd89d13f0163b8030d952 |
|
BLAKE2b-256 | 462e4fe5b357385b664548dcf9ecb99d50ebdc9e83e1392e3a273073e42b2e1a |
Hashes for ocrd_fork_pylsd-0.0.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db5a75602205329df81edf4e2d8f788bac056535d3b06dc6cfa13564eb30a4df |
|
MD5 | aa26a125d3e7c39edf57e654f7339d57 |
|
BLAKE2b-256 | 20a218060d43b679fa14a2e14d5af91d78a1b4d8aabc27406e491df59424d130 |
Hashes for ocrd_fork_pylsd-0.0.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6044ca69212dd1348977d5ef2b3499b39916d4f95f69af27f8e2d1d726a2c70 |
|
MD5 | c14587d1e42427c23b1fd12f0f25eb3f |
|
BLAKE2b-256 | 29b5572f816530c11b16237e98a26a1c74a69426868eb7aba552dfb03a356632 |
Hashes for ocrd_fork_pylsd-0.0.8-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5378d46895e0a405b46e31a583eabc0eff55f08d83b5a421fe7cef5cb5e6274b |
|
MD5 | eff76d0b0e8a5fcf30d3aac18c10b4f1 |
|
BLAKE2b-256 | b57a138b59745a7de90abd62575cc96a30ff51d6887cdce4d0841038dc9b4db7 |
Hashes for ocrd_fork_pylsd-0.0.8-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca7cd54dc9fe3dc8d3f7c0783c27da5d85023d3aba523b61e4f5f12dfd9bcc8b |
|
MD5 | b2350751e7e848227c9c8e132b03df07 |
|
BLAKE2b-256 | 025397ea88037151b4ac680c5ff9570fd419d034a70050cfef3a029922cfa091 |
Hashes for ocrd_fork_pylsd-0.0.8-cp36-cp36m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eca8e6593c67a19f62de537f0c25cb99110e7b94d18c2017dbaf3e74318a7d52 |
|
MD5 | cd0951697ae66a82c189e874004594b2 |
|
BLAKE2b-256 | e4c730388265ef6faf61f1f69257a279493ee7bc85f4ec97297cacc4c48cb384 |
Hashes for ocrd_fork_pylsd-0.0.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40b631a3c7eb8bd9243d2b10ebd3530be782843875646105e50ae84fa9459a81 |
|
MD5 | f49e95c83fa267fdf4c8d47ceee435b9 |
|
BLAKE2b-256 | 59d267a9190d78c7b89fb7e8fe770cc980992d3387545da309466aed4b362ea4 |
Hashes for ocrd_fork_pylsd-0.0.8-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61e424fd6d750bbc99f423a743e6a2f57d9f661c08cd6c35bacc7a24b1f5597f |
|
MD5 | e3f3d70d58bfd9d21606d07153581baa |
|
BLAKE2b-256 | e0ee3d2ee3480960881c231aa3a02cff7737a9be8295ff7ebbc7903b4c8cd13c |
Hashes for ocrd_fork_pylsd-0.0.8-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b44b7f7ccd80573ef38370862b27f6551e738082cf926ad9834be03ec7605737 |
|
MD5 | a458656215e08984e5f96b40da069da4 |
|
BLAKE2b-256 | 6b061692b3e8ebe39a76d84833fc7592275d474d1c4514e63bbbef5b0035ba5b |