Niv Sardi commited on
Commit
a966873
1 Parent(s): 4b2814a

imtool: use BoundingBox

Browse files

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>

Files changed (1) hide show
  1. crawler/imtool.py +4 -6
crawler/imtool.py CHANGED
@@ -109,7 +109,7 @@ def crop(fn, logos):
109
  return None
110
  eiy = TILE_SIZE
111
 
112
- return (six, siy), (eix, eiy)
113
 
114
  p = intersect()
115
  if p:
@@ -122,12 +122,10 @@ def crop(fn, logos):
122
  if len(li):
123
  with open(f"{name}.txt", 'w') as f:
124
  for p in li:
125
- cw = p[1][0] - p[0][0]
126
- ch = p[1][1] - p[0][1]
127
- cx = cw/2 + p[0][0]
128
- cy = ch/2 + p[0][1]
129
 
130
- a = f"{basename} {cx/TILE_SIZE} {cy/TILE_SIZE} {cw/TILE_SIZE} {ch/TILE_SIZE}"
131
  f.write(a)
132
  print(a)
133
 
 
109
  return None
110
  eiy = TILE_SIZE
111
 
112
+ return BoundingBox(six, siy, eix - six, eiy - siy)
113
 
114
  p = intersect()
115
  if p:
 
122
  if len(li):
123
  with open(f"{name}.txt", 'w') as f:
124
  for p in li:
125
+ cx = cw/2 + p.x
126
+ cy = ch/2 + p.y
 
 
127
 
128
+ a = f"{basename} {cx/TILE_SIZE} {cy/TILE_SIZE} {p.w/TILE_SIZE} {p.h/TILE_SIZE}"
129
  f.write(a)
130
  print(a)
131