feat: add bounded crop evidence and keyed gallery cache

This commit is contained in:
kiyo9w 2026-09-28 15:49:34 +09:00
parent 69de9ea418
commit 0d0e9f82b9
8 changed files with 1065 additions and 41 deletions

View file

@ -123,7 +123,8 @@ class VisionOcr(OcrEngine):
ok, encoded = cv2.imencode(".png", image)
if not ok:
return OcrResult(engine=self.name, elapsed_ms=(time.perf_counter() - started) * 1000.0)
data = NSData.dataWithBytes_length_(encoded.tobytes(), len(encoded.tobytes()))
raw = encoded.tobytes()
data = NSData.dataWithBytes_length_(raw, len(raw))
source = self._quartz.CGImageSourceCreateWithData(data, None)
cg_image = self._quartz.CGImageSourceCreateImageAtIndex(source, 0, None)