Skip to main content

PCLines transform for python

Project description

pclines package for Python


This package implements a PCLines transform for line detection in images.

    author={M. {Dubská} and A. {Herout} and J. {Havel}},
    booktitle={CVPR 2011},
    title={PClines — Line detection using parallel coordinates},


  • Python 3.6+
  • numpy
  • numba
  • scikit-image


The package is on PyPI, so just run following command and install the package.

> pip install pclines

Alternatively, you can download this repository and install manually.


  1. Import package
import pclines as pcl
  1. Data and observations The observations are 2D weighted coordinates enclosed by a known bounding box. As an example we extract edge points from an image.
image = imread("doc/test.png", as_gray=True)
edges = sobel(image)
r,c = np.nonzero(edges > 0.5)
x = np.array([c,r],"i").T
weights = edges[r,c]

  1. Accumulation in PCLines space
h,w = image.shape[:2]
bbox=(0,0,w,h)  #  Bounding box of observations
d = 1024  # Accumulator resolution
P = PCLines(bbox, d) # Create new accumulator
P.insert(x, weights) # Insert observations
p, w = P.find_peaks(min_dist=10, prominence=1.3, t=0.1) # Find local maxima

  1. Detected lines
h = P.inverse(p)  # (a,b,c) parameters of lines
X,Y = utils.line_segments_from_homogeneous(h, bbox)  # Convert to line segments for plotting


If you have a suggestion for improvement, let us know by filling an issue. Or you can fork the project and submit a pull request.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pclines, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pclines-1.0.2-py3-none-any.whl (6.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pclines-1.0.2.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page