pointtree.visualization
Tools for visualizing processing results.
- pointtree.visualization.color_instance_segmentation(
- point_cloud: DataFrame,
- instance_id_column: str,
- target_instance_id_column: str | None = None,
- fp_ids: List[int] | None = None,
- fn_ids: List[int] | None = None,
Sets the color of each point based on its instance ID.
- Parameters:
point_cloud (
DataFrame) – Point cloud to be colored.instance_id_column (
str) – Name of the column containing the instance IDs.target_instance_id_column (
str|None) – Name of the column containing the ground truth instance IDs. (default:None)fp_ids (
List[int] |None) – List of the predicted tree IDs that represent false positives. If set toNone, false positives are not colored by a dedicated color. (default:None)fn_ids (
List[int] |None) – List of the ground truth tree IDs that represents false negatives. If set toNone, false negatives are not colored by a dedicated color. (default:None)
- Returns:
Point cloud with added or modified “r”, “g”, “b”, “a” attributes.
- Return type:
pandas.DataFrame
- pointtree.visualization.color_semantic_segmentation(
- point_cloud: DataFrame,
- classes_to_colors: Dict[int, str],
- semantic_segmentation_column: str = 'classification',
Sets the color of each point based on its semantic class.
- Parameters:
point_cloud (
DataFrame) – Point cloud to be colored.classes_to_colors (
Dict[int,str]) – Mapping of class IDs to hex color codes.semantic_segmentation_column (
str) – Name of the column containing semantic class IDs. Defaults to"classification". (default:'classification')
- Returns:
Point cloud with added or modified “r”, “g”, “b”, “a” attributes.
- pointtree.visualization.hex_to_rgb(hex_color: str) Tuple[float, float, float][source]
Converts hexadecimal color code to RGB color value.
- Parameters:
hex – Hexadecimal color code.
- Returns:
RGBA color value.
- pointtree.visualization.plot_fitted_shape(
- xy: ndarray[Any, dtype[float32 | float64]],
- file_path: str | Path,
- circle: ndarray[Any, dtype[float32 | float64]] | None = None,
- ellipse: ndarray[Any, dtype[float32 | float64]] | None = None,
- polygon: ndarray[Any, dtype[float32 | float64]] | None = None,
Plots a shape fitted to a set of 2D points. The shape to be plotted can either be a circle, an ellipse, or a polygon.
- Parameters:
xy (
ndarray[Any,dtype[float32|float64]]) – Coordinates of the points to which the shape was fitted.file_path (
str|Path) – File path under which the image is to be saved.circle (
ndarray[Any,dtype[float32|float64]] |None) – Parameters of the circle in the following order: x-coordinate of the center, y-coordinate of the center, radius. If set toNone, no circle is plotted. (default:None)ellipse (
ndarray[Any,dtype[float32|float64]] |None) – Parameters of the ellipse in the following order: x- and y-coordinates of the center, radius along the semi-major, radius along the semi-minor axis, and the counterclockwise angle of rotation from the x-axis to the semi-major axis of the ellipse. If set toNone, no ellipse is plotted. (default:None)polygon (
ndarray[Any,dtype[float32|float64]] |None) – Sorted vertices (x- and y-coordinates) of the polygon. If set toNone, no polygon is plotted. (default:None)
- Shape:
xy: \((N, 2)\)circle: \((3)\)ellipse: \((5)\)polygon: \((V)\)
where\(N = \text{ number of points}\)\(V = \text{ number of polygon vertices}\)
- pointtree.visualization.save_tree_map(
- image: ndarray,
- output_path: str,
- *,
- is_label_image: bool = False,
- crown_borders: ndarray[Any, dtype[bool_]] | None = None,
- border_mask: ndarray[Any, dtype[bool_]] | None = None,
- seed_mask: ndarray[Any, dtype[bool_]] | None = None,
- core_mask: ndarray[Any, dtype[bool_]] | None = None,
- tree_positions: ndarray[Any, dtype[int64]] | None = None,
- crown_positions: ndarray[Any, dtype[int64]] | None = None,
- trunk_positions: ndarray[Any, dtype[int64]] | None = None,
Saves a 2D map showing canopy height models, tree positions etc. as image file.