@@ -280,7 +280,7 @@ def scale_to_range(arr, target_min, target_max):
280280 gray = np .array ([])
281281 a0 = time .perf_counter ()
282282 if spi_frame_get (image_frame , width * height * 2 , 0 ) == 0 : #src picture
283- # print(f"{inspect.currentframe().f_lineno}: 耗时: {time.perf_counter() - a0:.6f} 秒")
283+ print (f"{ inspect .currentframe ().f_lineno } : 耗时: { time .perf_counter () - a0 :.6f} 秒" )
284284
285285 # if FRAME_NUM % 50 == 0:
286286 # d = [0x0d, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
@@ -305,6 +305,8 @@ def scale_to_range(arr, target_min, target_max):
305305 x3grayimg_np = tensor .tensor_to_numpy_uint8 (x3graytensor , copy = False ).reshape ((576 , 768 ))
306306 elif x3model_name [2 :5 ] == './sr3_ir.mud' [2 :5 ]:
307307 x3grayimg_np = tensor .tensor_to_numpy_uint8 (x3graytensor , copy = False ).reshape ((576 , 768 ))
308+ elif x3model_name [2 :7 ] == './sr2.5_ir.mud' [2 :7 ]:
309+ x3grayimg_np = tensor .tensor_to_numpy_uint8 (x3graytensor , copy = False ).reshape ((480 , 640 ))
308310 else :
309311 raise RuntimeError ("Unsupported x3 model" )
310312 x3grayimg_np = x3grayimg_np .astype (np .uint8 )
@@ -318,6 +320,12 @@ def scale_to_range(arr, target_min, target_max):
318320 x3model_name = './sr3_ir_32.mud'
319321 output_layer_name = 'output'
320322 elif x3model_name == './sr3_ir_32.mud' :
323+ x3model_name = './sr2.5_ir32.mud'
324+ output_layer_name = 'output'
325+ elif x3model_name == './sr2.5_ir32.mud' :
326+ x3model_name = './sr2.5_ir48.mud'
327+ output_layer_name = 'output'
328+ elif x3model_name == './sr2.5_ir48.mud' :
321329 x3model_name = './espcn_x3.mud'
322330 output_layer_name = '19'
323331 else :
@@ -330,9 +338,10 @@ def scale_to_range(arr, target_min, target_max):
330338 img_8bit = scale_to_range (img_8bit , img_8bit_raw_min_max [0 ], img_8bit_raw_min_max [1 ]).astype (np .uint8 )
331339 else :
332340 img_8bit = cv2 .resize (img_8bit , (disp .width (), disp .height ()))
333-
341+ print ( f" { inspect . currentframe (). f_lineno } : 耗时: { time . perf_counter () - a0 :.6f } 秒" )
334342 # 伪彩色映射(热力图)
335343 color_img = cv2 .applyColorMap (img_8bit , cv2 .COLORMAP_MAGMA ) # BGR格式 COLORMAP_HOT COLORMAP_TURBO
344+ print (f"{ inspect .currentframe ().f_lineno } : 耗时: { time .perf_counter () - a0 :.6f} 秒" )
336345 color_img = image .cv2image (color_img )
337346
338347 center_pos = (height // 2 , width // 2 )
0 commit comments