Skip to main content

subpixel-edges

A pure Python implementation of the subpixel edge location algorithm from https://doi.org/10.1016/j.imavis.2012.10.005

The reference implementation can be found on from https://it.mathworks.com/matlabcentral/fileexchange/48908-accurate-subpixel-edge-location

Installation

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) 
help(subpixel_edges) 

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

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

Development

git clone https://github.com/gravi-toni/subpixel-edges.git
pip install -e .

To run the tests (includes OpenCV):

pip install -e .[tests]

To run the examples (includes OpenCV):

pip install -e .[examples]

Metadata

Release files for subpixel-edges 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subpixel-edges 0.1.1
File Size Uploaded
subpixel-edges-0.1.1.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subpixel-edges 0.1.1
File Interpreter ABI Platform
subpixel_edges-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / subpixel-edges-0.1.1.tar.gz

Download URL subpixel-edges-0.1.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
97581b7553e5d9e1dff3e2aab29bf4aeed380bb2c3076f8227315a09b4e2d6cb
BLAKE2b-256 checksum
How to use checksums
89367d3e0a11bddb2b5eb3e01ef71d963942c12329e86dbb144efa812c28b21a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / subpixel_edges-0.1.1-py3-none-any.whl

Download URL subpixel_edges-0.1.1-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f85bf014e9b2c8cbb5bd8333fb3223f9b762c37ad2d664da182e3e3e1a080b73
BLAKE2b-256 checksum
How to use checksums
9c7a04a59e9756e25319a2017b7d3c0bd77af6217dedd617916b69a2eb3f91e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page