Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/pixel-grid-detector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pixel grid detector CI

on:
push:
paths:
- "native/pixel-perfect/**"
- ".github/workflows/pixel-grid-detector.yml"
pull_request:
paths:
- "native/pixel-perfect/**"
- ".github/workflows/pixel-grid-detector.yml"

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: native/pixel-perfect/crates/detector
steps:
- uses: actions/checkout@v7

- name: Rust format
run: cargo fmt --check

- name: Rust tests
run: cargo test --release --locked
1 change: 1 addition & 0 deletions native/pixel-perfect/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
268 changes: 268 additions & 0 deletions native/pixel-perfect/crates/detector/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions native/pixel-perfect/crates/detector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "windup-pixel-grid-detector"
version = "0.1.0"
edition = "2021"
license = "MIT"
publish = false

[dependencies]
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
rayon = "1.12.0"
rustfft = "6"
21 changes: 21 additions & 0 deletions native/pixel-perfect/crates/detector/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Astropulse, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions native/pixel-perfect/crates/detector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Pixel grid detector

Windup 的独立本地像素网格识别库。它只读取 PNG/JPEG 字节并返回网格元数据,不负责重建图片,也不引用任何生成管线或应用服务。

默认执行 Pixel Art Fixer 的完整多检测器共识流程:autocorrelation、run-length comb、shift self-similarity 与证据仲裁。调用方可以显式选择 `DetectorMode::Fast` 作为低延迟模式。

```bash
cargo test --release --locked
```

公共入口为 `detect_bytes`,返回字段包括 `cols`、`rows`、`step_x`、`step_y`、`consensus` 和 `confidence`。Python 绑定由独立集成模块提供,本 crate 不依赖 Python 或 Windup 后端。

## Capability boundary

传统网格检测默认面向隐含像素单元不小于约 3px 的输入。小于 3px 的高密度伪像素可能缺少足够的周期证据,本模块暂不保证其自动识别结果;调用方应允许用户提供显式像素尺寸。这里不添加针对单张图片的启发式特例。
7 changes: 7 additions & 0 deletions native/pixel-perfect/crates/detector/UPSTREAM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Upstream

检测算法源自 [Retro-Diffusion/pixel-art-fixer](https://github.com/Retro-Diffusion/pixel-art-fixer),固定于提交 `ef376e57e1c272633ca2dbf5f29ec3fcf6596465`,使用 MIT License。

Windup 仅增加字节输入的 library 边界、输入资源限制、项目内测试与统一格式化;检测算法逻辑保持上游实现。

`tests/frog-500.png` 由同一固定提交的 MIT 示例 `examples/frog.png` 以 Lanczos 缩放至 500×500,用于覆盖完整检测器的仲裁路径。
Loading
Loading