Skip to content

Commit 68b3edb

Browse files
author
Sharat Chikkerur
authored
Plot changes (#550)
1 parent 3d90f70 commit 68b3edb

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

utils_cv/detection/plot.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ def plot_detections(
268268
idx: int = None,
269269
keypoint_meta: Dict = None,
270270
ax: plt.axes = None,
271+
text_size: int = None,
272+
rect_th: int = None,
273+
keypoint_th = None,
271274
) -> PIL.Image.Image:
272275
""" Put mask onto image.
273276
@@ -278,16 +281,24 @@ def plot_detections(
278281
keypoint_meta: meta data of keypoints which should include at least
279282
"skeleton".
280283
ax: an optional ax to specify where you wish the figure to be drawn on
284+
text_size: override text size
285+
rect_th: override thickness of annotation rectangles
286+
key
281287
"""
282288
# Open image
283289
assert detection["im_path"], 'Detection["im_path"] should not be None.'
284290
im = Image.open(detection["im_path"])
285291

292+
default_plot_settings = PlotSettings()
293+
if not text_size: text_size = default_plot_settings.text_size
294+
if not rect_th: rect_th = default_plot_settings.rect_th
295+
if not keypoint_th: keypoint_th = default_plot_settings.keypoint_th
296+
286297
# Adjust the rectangle thickness etc. to the image resolution
287298
scale = max(im.size) / 500.0
288-
rect_th = int(PlotSettings().rect_th * scale)
289-
text_size = int(PlotSettings().text_size * scale)
290-
keypoint_th = int(PlotSettings().keypoint_th * scale)
299+
rect_th = int(rect_th * scale)
300+
text_size = int(text_size * scale)
301+
keypoint_th = int(keypoint_th * scale)
291302

292303
# Get id of ground truth image/annotation
293304
if data and idx is None:

0 commit comments

Comments
 (0)