Skip to main content

Pure Python implementation of subpixel edge location algorithm based on partial area effect

Project description


A pure Python implementation of the subpixel edge location algorithm from

The reference implementation can be found on from


pip install subpixel-edges

Quick start

For a quick overview of the code functionalities, install the following packages first:

$ pip install subpixel-edges
$ pip install opencv-python
$ pip install matplotlib

Then go into the directory you want to use and copy the image you want to analyze (let's say lena.png). Now open a Python console and execute the following commands:

import cv2
import matplotlib.pyplot as plt

from subpixel_edges import subpixel_edges

# (optional) 

img = cv2.imread("lena.png")
img_gray = (cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)).astype(float)
edges = subpixel_edges(img_gray, 25, 0, 2)

plt.quiver(edges.x, edges.y, edges.nx, -edges.ny, scale=40)


git clone
pip install -e .

To run the tests (includes OpenCV):

pip install -e .[tests]

To run the examples (includes OpenCV):

pip install -e .[examples]

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

subpixel-edges-0.1.1.tar.gz (11.1 kB view hashes)

Uploaded source

Built Distribution

subpixel_edges-0.1.1-py3-none-any.whl (15.6 kB view hashes)

Uploaded py3

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