更新 Vision/tool/utils.py

This commit is contained in:
hjw
2024-09-09 09:53:26 +00:00
parent 55227fc898
commit 72f5c9e9fb

View File

@ -8,5 +8,27 @@
@Date 2024/8/29 15:07
'''
import numpy as np
def find_position(Depth_Z, RegionalArea, RegionalArea_Threshold, first_depth=True):
if first_depth == True:
sorted_id = sorted(range(len(Depth_Z)), key=lambda k: Depth_Z[k], reverse=False)
Depth_Z1 = [Depth_Z[i] for i in sorted_id]
RegionalArea1 = [RegionalArea[i] for i in sorted_id]
for i in range(len(Depth_Z1)):
if RegionalArea1[i] > RegionalArea_Threshold:
return sorted_id[i]
else:
sorted_id = sorted(range(len(RegionalArea)), key=lambda k: RegionalArea[k], reverse=True)
Depth_Z1 = [Depth_Z[i] for i in sorted_id]
RegionalArea1 = [RegionalArea[i] for i in sorted_id]
for i in range(len(Depth_Z1)):
if RegionalArea1[i] > RegionalArea_Threshold:
return sorted_id[i]