Metadata-Version: 2.4
Name: easobel
Version: 0.1.0
Summary: SIMD-accelerated Sobel edge detection. 5-12x faster than OpenCV single-threaded.
Author: Peter Lukka
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/petlukk/easobel
Project-URL: Repository, https://github.com/petlukk/easobel
Keywords: sobel,edge-detection,simd,image-processing,computer-vision
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21
Dynamic: license-file

# easobel

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

```python
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

```bash
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](https://github.com/petlukk/eacompute), 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
