-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: add postprocessing steps for masks and geojsons
- Loading branch information
1 parent
c4cb19b
commit 12667e3
Showing
6 changed files
with
212 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import numpy as np | ||
from numpy._typing import NDArray | ||
|
||
|
||
def create_marking_array( | ||
masks: list[NDArray], | ||
colors: list[int], | ||
image: NDArray, | ||
) -> NDArray: | ||
"""Create a single color marking array based on masks and colors. | ||
Parameters: | ||
- masks: List of masks representing markings. | ||
- colors: List of colors corresponding to each mask. | ||
- image: Original sketch map frame. | ||
Returns: | ||
NDArray: Single color marking array. | ||
""" | ||
single_color_marking = np.zeros( | ||
(image.shape[0], image.shape[1]), | ||
dtype=np.uint8, | ||
) | ||
for color, mask in zip(colors, masks): | ||
single_color_marking[mask] = color | ||
return single_color_marking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters