expose flow and hhd for benchmark
This commit is contained in:
+13
-5
@@ -20,7 +20,7 @@ def main():
|
||||
# cal_path为校准文件路径, 每一个设备需要创建/使用一个校准文件
|
||||
|
||||
# 方式1: 从视频文件读取
|
||||
sensor = orisys.Sensor("s1.mp4", config_name="./config/prototype_of3.json", cal_path= "./config/dd01a_0.npy", isstitch=True, cuda=False, verbose=True, poisson_backend='opencl')
|
||||
sensor = orisys.Sensor("s1_480p.mp4", config_name="./config/prototype_of3_480p.json", cal_path= "./config/dd01a_0_480p.npy", isstitch=True, cuda=False, verbose=True, poisson_backend='cpu')
|
||||
|
||||
# 方式2: 从摄像头读取(取消注释使用)
|
||||
# sensor = orisys.Sensor(0, config_name="./config/prototype_of3.json", cal_path= "./config/cal.npy", isstitch=True, cuda=True, verbose=True)
|
||||
@@ -39,9 +39,17 @@ def main():
|
||||
# print("motion detected")
|
||||
# 步骤 2.2: 计算形变场 (必要步骤)
|
||||
start_time = time.perf_counter()
|
||||
sensor.compute_deformation()
|
||||
sensor.compute_flow()
|
||||
|
||||
end_time = time.perf_counter()
|
||||
compute_deformation_time = end_time - start_time
|
||||
compute_flow_time = end_time - start_time
|
||||
|
||||
start_time = time.perf_counter()
|
||||
sensor.compute_hhd()
|
||||
|
||||
end_time = time.perf_counter()
|
||||
compute_hhd_time = end_time - start_time
|
||||
|
||||
# 步骤 2.3: 计算触碰点
|
||||
start_time = time.perf_counter()
|
||||
sensor.compute_contact()
|
||||
@@ -98,8 +106,8 @@ def main():
|
||||
capture_time = sensor._last_capture_time
|
||||
processing_time = sensor._last_processing_time
|
||||
|
||||
total_time = get_img_time + compute_deformation_time + compute_contact_time + read_info_time + display_time
|
||||
print(f"get_img: {get_img_time*1000:.2f}ms (capture: {capture_time*1000:.2f}ms, processing: {processing_time*1000:.2f}ms), deformation: {compute_deformation_time*1000:.2f}ms, contact: {compute_contact_time*1000:.2f}ms, read: {read_info_time*1000:.2f}ms, display: {display_time*1000:.2f}ms, total: {total_time*1000:.2f}ms")
|
||||
total_time = get_img_time + compute_flow_time + compute_hhd_time + compute_contact_time + read_info_time + display_time
|
||||
print(f"get_img: {get_img_time*1000:.2f}ms (capture: {capture_time*1000:.2f}ms, processing: {processing_time*1000:.2f}ms), flow: {compute_flow_time*1000:.2f}ms,hhd: {compute_hhd_time*1000:.2f}ms, contact: {compute_contact_time*1000:.2f}ms, read: {read_info_time*1000:.2f}ms, display: {display_time*1000:.2f}ms, total: {total_time*1000:.2f}ms")
|
||||
|
||||
#步骤 3.5: 键盘控制
|
||||
key = cv2.waitKey(1) & 0xFF
|
||||
|
||||
Reference in New Issue
Block a user