Marthee commited on
Commit
9f6c306
·
verified ·
1 Parent(s): 6e90955

Update doors_fasterrcnn.py

Browse files
Files changed (1) hide show
  1. doors_fasterrcnn.py +6 -2
doors_fasterrcnn.py CHANGED
@@ -293,8 +293,12 @@ def add_annotations_to_pdf(image, pdf_name, lines, sanda, char_width, line_midpo
293
  annot.update()
294
  for i in range(len(doubleD_bbox)):
295
  # rect_coords should be a tuple: (x1, y1, x2, y2)
296
- coordinates = [(*doubleD_bbox[i][0]) * derotationMatrix, (*doubleD_bbox[i][1]) * derotationMatrix, (*doubleD_bbox[i][2]) * derotationMatrix, (*doubleD_bbox[i][3])* derotationMatrix]
297
- rect = fitz.Rect(coordinates)
 
 
 
 
298
  rect_annot = page.add_rect_annot(rect)
299
  rect_annot.set_border(width=2) # Adjust border width
300
  rect_annot.set_colors(stroke=(1, 0, 0)) # Red rectangle
 
293
  annot.update()
294
  for i in range(len(doubleD_bbox)):
295
  # rect_coords should be a tuple: (x1, y1, x2, y2)
296
+ tpl1 = (doubleD_bbox[i][0], doubleD_bbox[i][1])
297
+ tpl2 = (doubleD_bbox[i][2], doubleD_bbox[i][3])
298
+ tpl_derotated = fitz.Point(*tpl1) * derotationMatrix
299
+ tpl2_derotated = fitz.Point(*tpl2) * derotationMatrix
300
+ coordinates_derotated = [tpl_derotated[0],tpl_derotated[1],tpl2_derotated[0],tpl2_derotated[1]]
301
+ rect = fitz.Rect(coordinates_derotated)
302
  rect_annot = page.add_rect_annot(rect)
303
  rect_annot.set_border(width=2) # Adjust border width
304
  rect_annot.set_colors(stroke=(1, 0, 0)) # Red rectangle