35 lines
988 B
Python
35 lines
988 B
Python
#!/usr/bin/env python
|
||
# -*- coding: UTF-8 -*-
|
||
'''
|
||
@Project :AutoControlSystem-master
|
||
@File :utils.py
|
||
@IDE :PyCharm
|
||
@Author :hjw
|
||
@Date :2024/8/29 15:07
|
||
'''
|
||
|
||
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]
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|