Skip to main content

SIMD-accelerated Sobel edge detection. 5-12x faster than OpenCV single-threaded.

Project description

easobel

SIMD-accelerated Sobel edge detection. 5-12x faster than OpenCV single-threaded.

import easobel
import numpy as np

image = np.random.rand(1080, 1920).astype(np.float32)

edges = easobel.sobel(image)                        # single-threaded
edges = easobel.sobel_mt(image, num_threads=4)      # multi-threaded

Installation

pip install easobel

Pre-built wheels for Linux x86_64, Linux aarch64, and Windows x86_64. No compiler needed.

API

easobel.sobel(image) -> np.ndarray

Single-threaded Sobel edge detection.

  • Input: 2D float32 numpy array (height, width), grayscale
  • Output: 2D float32 array, same shape
  • Border pixels are zero (Sobel stencil needs 1-pixel border)
  • Image must be at least 3x3

easobel.sobel_mt(image, num_threads=None) -> np.ndarray

Multi-threaded Sobel with row-striped parallelism.

  • Same input/output as sobel()
  • num_threads defaults to os.cpu_count()
  • ctypes releases the GIL for true thread parallelism

Algorithm

Computes gradient magnitude using L1 norm: |Gx| + |Gy|.

Sobel kernels:

Gx = [-1  0  1]     Gy = [-1 -2 -1]
     [-2  0  2]          [ 0  0  0]
     [-1  0  1]          [ 1  2  1]

The SIMD kernel processes 4 pixels per iteration using f32x4 vectors with a scalar tail loop for remaining pixels.

How it works

The Sobel kernel is written in Ea, a SIMD kernel compiler. Pre-compiled shared libraries are shipped in the wheel. Python handles validation and memory management via ctypes.

License

Apache-2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

easobel-0.1.0-py3-none-win_amd64.whl (11.1 kB view details)

Uploaded Python 3Windows x86-64

easobel-0.1.0-py3-none-manylinux_2_17_x86_64.whl (13.3 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

easobel-0.1.0-py3-none-manylinux_2_17_aarch64.whl (12.7 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

File details

Details for the file easobel-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: easobel-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for easobel-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bb72257cfb9ccee47c48a84c531ecf03beef778ab85f7be7513934afaff54920
MD5 4c467b0a7e2cb2c999c410e3c1d21a4b
BLAKE2b-256 4cc861ed6e84d5043a7d51f51b4edd944a8dd2138460ea66415aff2262913cef

See more details on using hashes here.

Provenance

The following attestation bundles were made for easobel-0.1.0-py3-none-win_amd64.whl:

Publisher: publish.yml on petlukk/easobel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file easobel-0.1.0-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for easobel-0.1.0-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 780b53f136e1a175168139f54b6c90a72766799a50ad85c59f7be166412a0136
MD5 54ff1629f3f48679e441df2bf46602bb
BLAKE2b-256 af810ba399d4a5f323e5c16c32694c0db10bb09ae355b63984ddb0056116335b

See more details on using hashes here.

Provenance

The following attestation bundles were made for easobel-0.1.0-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish.yml on petlukk/easobel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file easobel-0.1.0-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for easobel-0.1.0-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 24aabe08aa8b3a99db16f4a39f7887ef8cb4757cb14ecfe8f50067d121c6bd57
MD5 aa26f85be3c6eb1e34c6d2301e0666e4
BLAKE2b-256 99259feed5136e8108d1afcb2aa5e1b180e1882c976c4bbaca9eee636aca23e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for easobel-0.1.0-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish.yml on petlukk/easobel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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