-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from swisstopo/LGVISIUM-63-Extraction-of-the-G…
…roundwater-logo-using-Computer-Vision Close LGVISIUM-63: Extraction of the groundwater logo using computer vision
- Loading branch information
Showing
17 changed files
with
339 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"swissgeol", | ||
"swisstopo", | ||
"textblock", | ||
"USCS", | ||
"venv" | ||
] | ||
} |
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
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,36 @@ | ||
"""Utility functions for the data extractor module.""" | ||
|
||
from fitz import Rect | ||
from stratigraphy.lines.line import TextLine | ||
|
||
|
||
def get_lines_near_rect( | ||
search_left_factor: float, | ||
search_right_factor: float, | ||
search_above_factor: float, | ||
search_below_factor: float, | ||
lines: list[TextLine], | ||
rect: Rect, | ||
) -> list[TextLine]: | ||
"""Find the lines of the text that are close to a given rectangle. | ||
Args: | ||
search_left_factor (float): The factor to search to the left of the rectangle. | ||
search_right_factor (float): The factor to search to the right of the rectangle. | ||
search_above_factor (float): The factor to search above the rectangle. | ||
search_below_factor (float): The factor to search below the rectangle | ||
lines (list[TextLine]): Arbitrary text lines to search in. | ||
rect (fitz.Rect): The rectangle to search around. | ||
Returns: | ||
list[TextLine]: The lines close to the rectangle. | ||
""" | ||
search_rect = Rect( | ||
rect.x0 - search_left_factor * rect.width, | ||
rect.y0 - search_above_factor * rect.height, | ||
rect.x1 + search_right_factor * rect.width, | ||
rect.y1 + search_below_factor * rect.height, | ||
) | ||
feature_lines = [line for line in lines if line.rect.intersects(search_rect)] | ||
|
||
return feature_lines |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+668 Bytes
src/stratigraphy/groundwater/assets/269126062-bp_page1_template.npy
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.
204a50d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report