fixed reindex in render2d
This commit is contained in:
@@ -175,16 +175,29 @@ def process_frame(args) -> Tuple[int, np.ndarray, Optional[Path]]:
|
|||||||
lidar_data["normalized_range"] = 1 / np.sqrt(
|
lidar_data["normalized_range"] = 1 / np.sqrt(
|
||||||
lidar_data["x"] ** 2 + lidar_data["y"] ** 2 + lidar_data["z"] ** 2
|
lidar_data["x"] ** 2 + lidar_data["y"] ** 2 + lidar_data["z"] ** 2
|
||||||
)
|
)
|
||||||
|
# check for zero values in normalized_range and output the x y and z values for them
|
||||||
|
zero_range_indices = lidar_data[lidar_data["normalized_range"] == 0].index
|
||||||
|
if not zero_range_indices.empty:
|
||||||
|
print(
|
||||||
|
f"Warning: Found {len(zero_range_indices)} points with zero normalized range at indices: {zero_range_indices.tolist()}"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
"X, Y, Z values for these points:",
|
||||||
|
lidar_data.loc[zero_range_indices, ["x", "y", "z"]].to_numpy(),
|
||||||
|
)
|
||||||
|
# Set zero values to NaN to avoid issues with training
|
||||||
|
lidar_data.loc[zero_range_indices, "normalized_range"] = np.nan
|
||||||
|
|
||||||
projection_data = lidar_data.pivot(
|
projection_data = lidar_data.pivot(
|
||||||
index="vertical_position",
|
index="vertical_position",
|
||||||
columns="horizontal_position",
|
columns="horizontal_position",
|
||||||
values="normalized_range",
|
values="normalized_range",
|
||||||
)
|
)
|
||||||
projection_data = projection_data.reindex(
|
projection_data = projection_data.reindex(
|
||||||
columns=range(horizontal_resolution), fill_value=0
|
columns=range(horizontal_resolution), fill_value=np.nan
|
||||||
)
|
)
|
||||||
projection_data = projection_data.reindex(
|
projection_data = projection_data.reindex(
|
||||||
index=range(vertical_resolution), fill_value=0
|
index=range(vertical_resolution), fill_value=np.nan
|
||||||
)
|
)
|
||||||
projection_data, output_horizontal_resolution = crop_projection_data_to_roi(
|
projection_data, output_horizontal_resolution = crop_projection_data_to_roi(
|
||||||
projection_data, roi_angle_start, roi_angle_width, horizontal_resolution
|
projection_data, roi_angle_start, roi_angle_width, horizontal_resolution
|
||||||
|
|||||||
Reference in New Issue
Block a user