dcorcoran commited on
Commit
a7d7ac4
·
1 Parent(s): 95ffe26

Updated regex and dropping

Browse files
Files changed (1) hide show
  1. app/services/ocr_service.py +2 -2
app/services/ocr_service.py CHANGED
@@ -78,7 +78,7 @@ class OCRService:
78
  # Name field — skip "Basic Pokemon" line at very top, just grab name row
79
  # Evolved cards have an evolution picture in the top-left (~0–25% width), so the name starts further right. Basic cards start near the left edge.
80
  if evolved:
81
- name_region = image.crop((0.20 * w, 0.06 * h, 0.62 * w, 0.11 * h))
82
  else:
83
  name_region = image.crop((0.07 * w, 0.06 * h, 0.62 * w, 0.11 * h))
84
 
@@ -261,7 +261,7 @@ class OCRService:
261
  draw = ImageDraw.Draw(vis)
262
 
263
  regions = {
264
- "Name": (0.20 * w if evolved else 0.07 * w, 0.06 * h, 0.62 * w, 0.11 * h),
265
  "HP": (0.64 * w, 0.06 * h, 0.85 * w, 0.11 * h),
266
  "Length/Weight": (0.125 * w, 0.53 * h, 0.86 * w, 0.57 * h),
267
  "Moves": (0.02 * w, 0.57 * h, 0.98 * w, 0.88 * h),
 
78
  # Name field — skip "Basic Pokemon" line at very top, just grab name row
79
  # Evolved cards have an evolution picture in the top-left (~0–25% width), so the name starts further right. Basic cards start near the left edge.
80
  if evolved:
81
+ name_region = image.crop((0.23 * w, 0.06 * h, 0.62 * w, 0.11 * h))
82
  else:
83
  name_region = image.crop((0.07 * w, 0.06 * h, 0.62 * w, 0.11 * h))
84
 
 
261
  draw = ImageDraw.Draw(vis)
262
 
263
  regions = {
264
+ "Name": (0.23 * w if evolved else 0.07 * w, 0.06 * h, 0.62 * w, 0.11 * h),
265
  "HP": (0.64 * w, 0.06 * h, 0.85 * w, 0.11 * h),
266
  "Length/Weight": (0.125 * w, 0.53 * h, 0.86 * w, 0.57 * h),
267
  "Moves": (0.02 * w, 0.57 * h, 0.98 * w, 0.88 * h),