Commit Graph
13 Commits
Author SHA1 Message Date
Hermes 20b79b0445 fix(opencv): 阴影滑块按上游列扫描重写,修 findContours 三通道崩溃
Build and Deploy / build (push) Failing after 3m22s
Build and Deploy / deploy (push) Skipped
上一版只加了尺寸校验,同尺寸输入暴露出第二个 bug:
  threshold 之后仍是 CV_8UC3 就交给 findContours →
  "FindContours supports only CV_8UC1 images"

现在按上游 AntiCAP solve_slider_comparison 的算法重写:
  · absdiff 逐通道,任一道 > 80 记为差异像素(对齐 image.point(lambda x: 255 if x > 80 else 0))
  · 三通道掩码用 cv::compare + bitwise_or 合成单通道 CV_8UC1
  · 逐列扫描:差异像素 >= 5 的列 → start_x = 列号+2,start_y = 首次达标行号-5(与上游一致)
  · 列扫描找不到时退回最大差异区域外接矩形(保留旧路径作为兜底)
  · 尺寸不一致返回 -2,Go 侧映射成 400
2026-12-03 08:43:24 +08:00
Hermes 68f181e0ac fix: 相似度改走双输出 Siamese(对齐上游 AntiCAP),阴影滑块补尺寸校验
Build and Deploy / build (push) Failing after 3m8s
Build and Deploy / deploy (push) Skipped
对照上游 https://github.com/81NewArk/AntiCAP 逐项核对后修两处:

1) 相似度(internal/captcha/handler.go + pkg/onnx)
   上游是 outputs = session.run(None, feed); emb1, emb2 = outputs[0], outputs[1]
   —— 模型本身分别吐出两路 embedding。
   旧实现只 run 了 1 个输出(onnx.cpp 里 Run 的 output_count = 1),
   再把这个张量从中间切成两半当两个 embedding,
   实测四组完全不同的输入返回同一个值(0.49188173),等于接口失效。
   现在新增 onnx_run_dual_input_two_outputs 取前两个输出,
   两路各算 L2 距离后 1/(1+dist);单输出模型保留旧路径回退并打日志。

2) 阴影滑块(pkg/opencv + internal/handler)
   上游 solve_slider_comparison 要求 target 与 background 同尺寸
   (PIL ImageChops.difference 的硬前提),旧实现不校验,
   尺寸不同时直接抛 OpenCV -209 尺寸不匹配,返回 500。
   现在前置校验并返回 400 + 明确原因;SliderMatch 也补了「滑块不能大于背景」的校验。

预处理与旋转逻辑核对结论:preprocessSiamese(105×105 / ImageNet norm)与
preprocessRotation(正方形中心裁剪 + h/√2 + 224 / ImageNet norm)与上游一致,未改。
2026-12-03 08:23:51 +08:00
admin 8dcbfb5535 fix: handle YOLO11 output format [1,5,8400] with transpose for OpenCV DNN
Build and Deploy / build (push) Successful in 2m36s
Build and Deploy / deploy (push) Successful in 9s
2026-07-17 08:54:23 +00:00
admin 5c3b7ef81d fix: CastTypeInfoToTensorInfo 使用 const 指针
Build and Deploy / build (push) Failing after 2m55s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 22:37:14 +00:00
admin 1962f75a47 fix: ONNX Runtime API 兼容 - 添加 OrtEnv 环境
Build and Deploy / build (push) Failing after 2m27s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 22:29:13 +00:00
admin 145e8c99ba fix: 添加 ONNX Runtime 头文件路径和 fstream 头文件
Build and Deploy / build (push) Failing after 2m25s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 22:24:13 +00:00
admin 015b1406e2 feat: 完整实现 CGO 版本 - ONNX Runtime + OpenCV DNN (YOLO)
Build and Deploy / build (push) Failing after 2m22s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 21:27:26 +00:00
admin 7afefe5e9f feat: 实现 ONNX Runtime CGO 绑定和 OCR/Math 推理逻辑
Build and Deploy / build (push) Failing after 2m23s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 21:14:34 +00:00
admin ffd99a25c3 fix: add Image struct definition in opencv.cpp
Build and Deploy / build (push) Successful in 2m4s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 13:30:24 +00:00
admin 6bbec4da4a fix: use pkg-config for opencv4 in CGO
Build and Deploy / build (push) Failing after 1m50s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 13:04:31 +00:00
admin 4bf7f609e7 fix: use CPPFLAGS for OpenCV include path
Build and Deploy / build (push) Failing after 1m56s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 12:50:39 +00:00
admin 2230a4404f fix: add OpenCV 4 include path in CGO directives
Build and Deploy / build (push) Failing after 1m26s
Build and Deploy / deploy (push) Has been skipped
2026-07-16 12:33:18 +00:00
admin 524c404194 feat: initial commit - Go + CGO captcha recognition service
Build and Deploy / build-frontend (push) Failing after 2s
Build and Deploy / build-backend (push) Has been skipped
Build and Deploy / build-docker (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped
Features:
- Go + CGO ONNX/OpenCV wrapper for high performance
- SQLite (default) / MySQL database support
- Optional Redis caching
- JWT authentication system
- Multiple captcha recognition APIs:
  - OCR text recognition
  - Slider captcha matching
  - Image similarity comparison
  - Rotation captcha detection
  - Object detection
- React frontend with install wizard
- Docker and docker-compose support
- Gitea CI/CD pipeline

Project structure:
- cmd/server: Main entry point
- internal/: Core business logic
- pkg/onnx: ONNX Runtime CGO wrapper
- pkg/opencv: OpenCV CGO wrapper
- web/: React frontend
- deploy/: Deployment configs
- scripts/: Utility scripts
2026-07-16 08:56:38 +00:00