8 Commits
Author SHA1 Message Date
Hermes 02a70eec3e fix(rotate): 双图旋转搜索段改成 FIFO+visited+上限,并修正 cv::rotate 枚举
Build and Push / build (push) Successful in 4m2s
1) 上一版用下标 for 模拟 Python「边遍历边追加、且会删掉更差项」的写法,
   删掉下标小于 cur 的元素后 cur 又退回原位 → cur 永远推进不了,接口直接挂死
   (实测 HTTP 请求 400 秒不返回,CF 侧 504)。
   改成 FIFO 队列 + 已算角度集合 + 评估次数上限 600:语义等价且一定终止。

2) cv::rotate 的枚举与 np.rot90 不同:np.rot90 是逆时针(k=1 逆 90°),
   cv::rotate 是 0=顺时针90 / 1=180 / 2=逆时针90,直接把 k 传进去语义就错了,
   而且 k=3 是非法枚举值。改成显式映射。

3) 环带统一压到 256 以内再 matchTemplate:官方例图只有 110px,
   我们的例图会到 400~600px,不压的话每次匹配几十毫秒,36 次粗搜就到分钟级。

对照基准:用纯 cv2 复刻上游 solve_double_rotate 跑同一对官方例图得到
  {similarity 0.8927, inner_angle 25.5, raw_angle 51},annulus 220x220,耗时 0.31s。
2026-12-03 18:34:39 +08:00
Hermes 2225f04866 feat(rotate): 双图旋转改为上游的环带模板匹配算法
Build and Push / build (push) Successful in 5m59s
原来那版是「RotNet(内圈) − RotNet(外圈) 取模」,纯粹自己凑的,与上游毫无对应关系,
所以结果 344 无法解释也无法校验。

按上游 solve_double_rotate 逐行移植(pkg/opencv/opencv.cpp 新增 cv_double_rotate):
  1) 内圈:rot90 四次数「整行只有纯黑/纯白」的行数 → 上下左右剪边 → 按短边取偶数直径 resize
  2) 外圈:从中心沿四条射线找第一个非纯黑非纯白像素 → 外扩 resize_check_pixel → 剪边 resize
  3) 两边各做圆环 mask(半径 R / 内半径 R-check_pixel)得到环带
  4) 内圈环带按候选角 getRotationMatrix2D+warpAffine 旋转,与外圈环带 matchTemplate
     (TM_CCOEFF_NORMED) 取最大相似度;粗搜 1..360 step 10,命中更好就追加 angle±10 细化窗口,
     最多保留 5 个候选(与上游边遍历边追加的行为一致)
  5) inner_angle = raw_angle * speed_ratio/(speed_ratio+1)

返回结构也对齐上游:{angle(兼容), inner_angle, raw_angle, similarity};
剪不出有效环带时返回 -2,HTTP 层映射成 400。
2026-12-03 18:14:42 +08:00
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
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 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 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 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