Metadata-Version: 2.4
Name: canny-chenn
Version: 1.0.2
Summary: A simple Canny edge detector for pytorch
Keywords: computer vision,edge detection,opencv
Author: Christian Henn
Author-email: Christian Henn <chenn@alum.mit.edu>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Requires-Dist: numpy>=2.3.5
Requires-Dist: torch>=2.9.1
Requires-Python: >=3.12, <3.14
Project-URL: Repository, https://github.com/chrishenn/canny
Description-Content-Type: text/markdown

<h1 align="center" style="margin-top: 0px;">Canny Edges</h1>
<div id="img0" align="center">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img1.png" width=200 alt="img1_in">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img2.png" width=200 alt="img2_in">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img3.png" width=200 alt="img3_in">
</div>
<div id="img0" align="center">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img1_out.png" width=200 alt="img1_out">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img2_out.png" width=200 alt="img2_out">
    <img src="https://raw.githubusercontent.com/chrishenn/canny/refs/heads/main/packages/canny_chenn/doc/images/img3_out.png" width=200 alt="img3_out">
</div>

&emsp;

A simple `Torch.nn.Module` to return an image mask representing edges found by the Canny Edge-Finding algorithm.

Supports:

- PyTorch Tensor images formatted in image batches [B, C, h, w], with float32 data, and values spanning [0,1]
- any number of channels C
- TorchScript jit script, as well as the newer, traced torch-export, on the Canny `nn.Module` class

---

# Usage

I use mise to handle project tools. Install it if you don't have it

```bash
git clone https://github.com/chrishenn/canny.git
cd canny
mise i

# list available just recipes
just --list

Available recipes:
    interactive # Detect and display canny edges on a set of test images. Use ctrl+c to kill
    lint        # run project formatters/linters [alias: l]
    test        # run basic tests
    unsafe      # run ruff with unsafe-fixes
```

---

# Dev

```bash
# build distrobution pkgs locally
uv build --package canny_chenn

# push tag to trigger pypi to build pkgs and publish to pypi
git tag -a v1.0.2 -m v1.0.2 -f && git push --tags -f
```
