Skip to main content

PCLines transform for python

Project description

pclines package for Python

pclines

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

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

Requrements

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

Installation

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.

Example

  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

Contribute

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.

Source Distribution

pclines-1.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

pclines-1.0.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pclines-1.0.2.tar.gz.

File metadata

  • Download URL: pclines-1.0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.12

File hashes

Hashes for pclines-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f25339a3d682d7faccbfd4c63628b404deff525f1d93e2ed172c30bf3a322416
MD5 10e0ce7f98dfe0a4830e03d08720a9cd
BLAKE2b-256 e97c68eefaad7c605f716e85842a21b8c1e11c4260fefaf890f9ab72d64be28b

See more details on using hashes here.

File details

Details for the file pclines-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pclines-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.12

File hashes

Hashes for pclines-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c647dc9154e3f4ceac213e3cbf0d70659f7b4b5c3d8aae28b2d511fe7d49d165
MD5 912b4dfd09b270e4b0deaab96358736d
BLAKE2b-256 814a0e80359818b5974dfba3d5341d36a21c3857e5fb98d9df0ca378c68f4a81

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page