更新 Vision/tool/utils.py
This commit is contained in:
@ -1,12 +1,34 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
'''
|
'''
|
||||||
@Project :AutoControlSystem-master
|
@Project :AutoControlSystem-master
|
||||||
@File :utils.py
|
@File :utils.py
|
||||||
@IDE :PyCharm
|
@IDE :PyCharm
|
||||||
@Author :hjw
|
@Author :hjw
|
||||||
@Date :2024/8/29 15:07
|
@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]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user