Photochk 1.0.0 — 類似写真を探して整理する macOS アプリ

フォルダ内の写真から、中身が同じものと見た目が似ているものを検出して
グループにまとめ、残す1枚を選んでほかをゴミ箱へ送れるようにする。

検出は安い判定から順に4段:
- ファイルサイズが同じものだけ SHA-256 でバイト一致を確定
- dHash(知覚ハッシュ)のハミング距離で候補ペアを抽出
- 候補に出てくる画像だけ Vision の feature print で精査
- Union-Find で連結成分をグループ化

判定のしきい値は実写画像で距離を実測して決めた(docs/calibration.md)。
tools/release-update.sh で Gitea のリリースを更新する。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
yfoxjp
2026-07-28 08:02:14 +09:00
co-authored by Claude Opus 5
commit c7f68b6cca
38 changed files with 3102 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import Testing
@testable import Photochk
@Suite("UnionFind")
struct UnionFindTests {
@Test("結合していない要素はそれぞれ単独の成分になる")
func isolatedElements() {
var uf = UnionFind(count: 4)
let components = uf.components().map { $0.sorted() }.sorted { $0[0] < $1[0] }
#expect(components == [[0], [1], [2], [3]])
}
@Test("推移的に結合した要素は1つの成分にまとまる")
func transitiveMerge() {
var uf = UnionFind(count: 5)
uf.union(0, 1)
uf.union(1, 2)
uf.union(3, 4)
let components = uf.components().map { $0.sorted() }.sorted { $0[0] < $1[0] }
#expect(components == [[0, 1, 2], [3, 4]])
}
@Test("同じ成分をもう一度 union しても何も変わらない")
func repeatedUnion() {
var uf = UnionFind(count: 3)
#expect(uf.union(0, 1) == true)
#expect(uf.union(1, 0) == false)
#expect(uf.find(0) == uf.find(1))
#expect(uf.find(0) != uf.find(2))
}
}