@@ -36,7 +36,9 @@ def show_image(img, extent=None, axis=False, inline=True, grayscale=False):
3636 if inline :
3737 pil_im = Image .fromarray (img )
3838 plt .figure (figsize = [2 * x for x in plt .rcParams ["figure.figsize" ]])
39- img_plot = plt .imshow (pil_im , extent = extent , cmap = ("gray" if grayscale else None ))
39+ img_plot = plt .imshow (
40+ pil_im , extent = extent , cmap = ("gray" if grayscale else None )
41+ )
4042 if not axis :
4143 plt .axis ("off" )
4244 plt .show ()
@@ -292,7 +294,7 @@ def show_image_with_boxes(
292294 if isinstance (box , Box2D ) or (
293295 isinstance (box , (ObjectState , BoxDetection , MaskDetection , BasicBoxTrack2D ))
294296 and isinstance (box .box , Box2D )
295- ):
297+ ):
296298 if isinstance (
297299 box , (ObjectState , BoxDetection , MaskDetection , BasicBoxTrack2D )
298300 ):
@@ -310,9 +312,17 @@ def show_image_with_boxes(
310312 bl_edge = (box .xmin , box .ymin )
311313 # add text
312314 if text is not None :
313- add_text_to_image (img1 , bl_edge , text [i ], fontscale = fontscale , font_thickness = font_thickness )
315+ add_text_to_image (
316+ img1 ,
317+ bl_edge ,
318+ text [i ],
319+ fontscale = fontscale ,
320+ font_thickness = font_thickness ,
321+ )
314322 # add id
315- add_text_to_image (img1 , bl_edge , ID , fontscale = fontscale , font_thickness = font_thickness )
323+ add_text_to_image (
324+ img1 , bl_edge , ID , fontscale = fontscale , font_thickness = font_thickness
325+ )
316326 elif (
317327 isinstance (box , (Box3D , BasicBoxTrack3D ))
318328 or (
@@ -480,7 +490,7 @@ def show_lidar_bev_with_boxes(
480490 extent_max = [
481491 (min (pc [:, 0 ]), max (pc [:, 1 ])),
482492 (min (pc [:, 1 ]), max (pc [:, 1 ])),
483- (min (pc [:, 2 ]), max (pc [:, 2 ]))
493+ (min (pc [:, 2 ]), max (pc [:, 2 ])),
484494 ]
485495 extent_use = []
486496 for ex , ex_max in zip (extent , extent_max ):
@@ -550,7 +560,7 @@ def show_lidar_bev_with_boxes(
550560 img1 = 255 * np .ones ([bev_size [0 ], bev_size [1 ], 3 ], dtype = np .uint8 )
551561 else :
552562 raise NotImplementedError (background_color )
553-
563+
554564 # get scaling
555565 if extent_use is None :
556566 width_scale = (max_width - min_width ) / bev_size [0 ]
@@ -691,8 +701,8 @@ def plot_line(img1, line, line_color):
691701 if return_image :
692702 if scale_return_image :
693703 scale_ratio = width_scale / range_scale
694- dx = bev_size [0 ]* scale_ratio if scale_ratio > 1 else bev_size [0 ]
695- dy = bev_size [1 ]/ scale_ratio if scale_ratio < 1 else bev_size [1 ]
704+ dx = bev_size [0 ] * scale_ratio if scale_ratio > 1 else bev_size [0 ]
705+ dy = bev_size [1 ] / scale_ratio if scale_ratio < 1 else bev_size [1 ]
696706 new_size = (int (dx ), int (dy ))
697707 return cv2 .resize (img1 , new_size )
698708 else :
0 commit comments