@@ -69,7 +69,7 @@ def draw_image(img, angle, dir_cam=False):
6969 img .draw_string (int (v [2 ][0 ]), int (v [2 ][1 ]), "z" , image .COLOR_GREEN , 1.5 )
7070
7171def show_msg (disp , msg ):
72- img = image .Image (disp .width (), disp .height ())
72+ img = image .Image (disp .width (), disp .height (), bg = image . COLOR_BLACK )
7373 size = image .string_size (msg , 1.5 )
7474 x = (img .width () - size .width ()) // 2
7575 y = (img .height () - size .height ()) // 2
@@ -93,7 +93,7 @@ def main(disp):
9393 try :
9494 sensor = imu .IMU ("default" )
9595 except Exception :
96- img = image .Image (disp .width (), disp .height ())
96+ img = image .Image (disp .width (), disp .height (), bg = image . COLOR_BLACK )
9797 msg = "Init IMU failed, maybe no IMU"
9898 size = image .string_size (msg , scale = 1.2 , font = "hershey_complex_small" )
9999 img .draw_string ((img .width () - size .width ()) // 2 , (img .height () - size .height ()) // 2 , msg , image .COLOR_WHITE , scale = 1.2 , font = "hershey_complex_small" )
@@ -123,7 +123,7 @@ def main(disp):
123123 # make y axis same with camera(x rotate 90 degree)
124124 angle .x -= pitch_offset
125125
126- img = image .Image (disp .width (), disp .height ())
126+ img = image .Image (disp .width (), disp .height (), bg = image . COLOR_BLACK )
127127 img .draw_string (2 , 4 , f"pitch: { angle .x :.2f} , roll: { angle .y :.2f} , yaw: { angle .z :.2f} " , image .COLOR_WHITE , 1.5 )
128128 img .draw_string (2 , 36 , f"dt: { int (dt * 1000 ):3d} ms, temp: { data .temp :.1f} " , image .COLOR_WHITE , 1.5 )
129129 draw_image (img , angle , pitch_offset == 90 )
@@ -164,7 +164,7 @@ def main(disp):
164164 import traceback
165165 e = traceback .format_exc ()
166166 print (e )
167- img = image .Image (disp .width (), disp .height ())
167+ img = image .Image (disp .width (), disp .height (), bg = image . COLOR_BLACK )
168168 img .draw_string (2 , 2 , e , image .COLOR_WHITE , font = "hershey_complex_small" , scale = 0.6 )
169169 disp .show (img )
170170 while not app .need_exit ():
0 commit comments