Commit 053bf233 authored by oscar's avatar oscar

提交更新

parent def778d5
......@@ -460,6 +460,7 @@ class NumpyEncoder(json.JSONEncoder):
g_saveFileType = 1 #0为pcd文件,1是bin文件
g_showCloud = 0 #0不显示,1显示
g_pcd_info = {}
def Save_Cloud_File(cloud,json):
#去除boxx内的点
......@@ -504,7 +505,7 @@ def Save_Cloud_File(cloud,json):
axis_pcd = o3d.geometry.TriangleMesh.create_coordinate_frame(size=5, origin=[0, 0, 0])
drawpointcloud += [axis_pcd]
custom_draw_geometry_with_key_callback(drawpointcloud, "")
g_pcd_info[cloud["pcdName"]] = len(cloud["boxes"])
......@@ -532,10 +533,14 @@ def Check_Add_Cloud_box(save_cloud,bbox,pcd,pcdName,path,index):
break;
if add_idx == -1 :
#需要保存数据了
if index > 1 and len(save_cloud) >= 20 and len(save_cloud[0]["boxes"]) >= 5 :
if index > 1 and len(save_cloud) >= 50 and len(save_cloud[0]["boxes"]) >= 10 :
save_cloud[0]["isSave"] = 1
elif index > 1 and len(save_cloud) > 0 and len(save_cloud[0]["boxes"]) > 20 :
save_cloud[0]["isSave"] = 1
elif index > 1 and len(save_cloud) > 0 and len(save_cloud[0]["boxes"]) > 10 :
elif index > 1 and len(save_cloud) >= 100 :
save_cloud[0]["isSave"] = 1
if len(save_cloud[0]["boxes"]) < 10:
print("save cloud file = ",save_cloud[0]["pcdName"], " box num = ", len(save_cloud[0]["boxes"]))
if add_idx == -1:
new_cloud = {}
new_cloud["np_pcd"] = np.array(pcd.points)
......@@ -634,10 +639,10 @@ if __name__ == '__main__':
for bbox in bboxes:
# exportCenterBL = get_loc_from_origin([bbox[4][0], bbox[4][1], bbox[4][2]], 0, generate_Trans)
lidar_loc_ex,out_BL_ex,exportCenterBL = get_loc([bbox[4][0], bbox[4][1], bbox[4][2],bbox[6][0],bbox[6][1],bbox[6][2],bbox[2]], 0, generate_Trans,generate_kitti2origin)
print(exportCenterBL)
# print(exportCenterBL)
angle2 = car_yaw_cal(generate_car_yaw_cal_angle,bbox[2])
mapInfoExport = get_map_data(exportCenterBL[0],exportCenterBL[1],angle2)
print("call get ex data isInMap = ",mapInfoExport)
# print("call get ex data isInMap = ",mapInfoExport)
if mapInfoExport[0] != 1:
continue;
laneAngle = mapInfoExport[10];
......@@ -646,8 +651,8 @@ if __name__ == '__main__':
detaAngel -= 360
while detaAngel < -180:
detaAngel += 360
print("angle = ",angle2," laneAngle = ",laneAngle," detaAngel = ",detaAngel)
if abs(detaAngel) > 30:
# print("angle = ",angle2," laneAngle = ",laneAngle," detaAngel = ",detaAngel)
if bbox[0] != "pedestrian" and abs(detaAngel) > 30:
continue;
#获取到汽车点云符合条件,可以添加到新点云里
# f1.write('%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\n'%(exportCenterBL[0],exportCenterBL[1],bbox[4][0], bbox[4][1], bbox[4][2],bbox[6][0], bbox[6][1], bbox[6][2],angle2,laneAngle))
......@@ -666,15 +671,17 @@ if __name__ == '__main__':
dz = np.array([0,0,delta_z])
pickcloud = np.add(pickcloud,dz)
print(pickcloud)
# print(pickcloud)
bbox[1] += dz
Add_Cloud_box(save_cloud_list,idx,bbox,pickcloud,save_json)
if isDeal == 1:
index += 1
if index >= 10:
break
if index % 10 == 0:
print("while index = ",index)
# if index >= 10:
# break
else:
isStop = 1
for cloud in save_cloud_list:
......@@ -682,6 +689,9 @@ if __name__ == '__main__':
jsn_path = os.path.join(generate_root_path,generate_child_dir + ".json")
with open(jsn_path,'w') as file_obj:
json.dump(save_json,file_obj,cls=NumpyEncoder)
for file, num in g_pcd_info.items():
if num < 10:
print("file = ",file,", box num = ",num)
# for dir in dirs:
# if os.path.isdir(origin_root_path + "/" + dir) == False:
# continue
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment