Marthee commited on
Commit
5ab6962
·
verified ·
1 Parent(s): aced75f

Update doors_fasterrcnn.py

Browse files
Files changed (1) hide show
  1. doors_fasterrcnn.py +22 -17
doors_fasterrcnn.py CHANGED
@@ -271,6 +271,11 @@ def add_annotations_to_pdf(image, pdf_name, lines, sanda, char_width, line_midpo
271
 
272
  #Annotation for drawin lines as in the markups
273
  for i in range(len(lines)):
 
 
 
 
 
274
  # annot = page.add_line_annot(lines[i][0], lines[i][1])
275
  # # annot = page.add_line_annot(sanda[i][0], lines[i][0])
276
  # # annot = page.add_line_annot(sanda[i][1], lines[i][1])
@@ -278,23 +283,23 @@ def add_annotations_to_pdf(image, pdf_name, lines, sanda, char_width, line_midpo
278
  # annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
279
  # annot.update()
280
 
281
- annot = page.add_line_annot(fitz.Point(*lines[i][0]) * derotationMatrix, fitz.Point(*lines[i][1]) * derotationMatrix)
282
- annot.set_border(width=2, dashes=None) # Optional border styling
283
- annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
284
- annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
285
- annot.update()
286
-
287
- annot = page.add_line_annot(fitz.Point(*sanda[i][0]) * derotationMatrix, fitz.Point(*lines[i][0]) * derotationMatrix)
288
- annot.set_border(width=2, dashes=None) # Optional border styling
289
- annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
290
- annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
291
- annot.update()
292
-
293
- annot = page.add_line_annot(fitz.Point(*sanda[i][1]) * derotationMatrix, fitz.Point(*lines[i][1]) * derotationMatrix)
294
- annot.set_border(width=2, dashes=None) # Optional border styling
295
- annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
296
- annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
297
- annot.update()
298
  # output_pdf_path = pdf_name+"_annotated.pdf"
299
  # Save the PDF with annotations
300
 
 
271
 
272
  #Annotation for drawin lines as in the markups
273
  for i in range(len(lines)):
274
+ l_points = [fitz.Point(*sanda[i][0])* derotationMatrix, fitz.Point(*lines[i][0])* derotationMatrix, fitz.Point(*lines[i][1])* derotationMatrix, fitz.Point(*sanda[i][1])* derotationMatrix]
275
+ annot = page.add_polyline_annot(l_points)
276
+ annot.set_border(width=2, dashes=None) # Optional border styling
277
+ annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
278
+ annot.update()
279
  # annot = page.add_line_annot(lines[i][0], lines[i][1])
280
  # # annot = page.add_line_annot(sanda[i][0], lines[i][0])
281
  # # annot = page.add_line_annot(sanda[i][1], lines[i][1])
 
283
  # annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
284
  # annot.update()
285
 
286
+ #annot = page.add_line_annot(fitz.Point(*lines[i][0]) * derotationMatrix, fitz.Point(*lines[i][1]) * derotationMatrix)
287
+ #annot.set_border(width=2, dashes=None) # Optional border styling
288
+ #annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
289
+ #annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
290
+ #annot.update()
291
+
292
+ #annot = page.add_line_annot(fitz.Point(*sanda[i][0]) * derotationMatrix, fitz.Point(*lines[i][0]) * derotationMatrix)
293
+ #annot.set_border(width=2, dashes=None) # Optional border styling
294
+ #annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
295
+ #annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
296
+ #annot.update()
297
+
298
+ #annot = page.add_line_annot(fitz.Point(*sanda[i][1]) * derotationMatrix, fitz.Point(*lines[i][1]) * derotationMatrix)
299
+ #annot.set_border(width=2, dashes=None) # Optional border styling
300
+ #annot.set_colors(stroke=(1, 0, 0)) # Set the line color to red
301
+ #annot.set_info(content=str(1.0)+' m',subject='Perimeter Measurement', title="ADR Team")
302
+ #annot.update()
303
  # output_pdf_path = pdf_name+"_annotated.pdf"
304
  # Save the PDF with annotations
305