[WIP] Refactoring meta-detection
This commit is contained in:
parent
0f11441b20
commit
acf46a7a48
@ -3,16 +3,7 @@ from typing import List
|
||||
|
||||
from cv_analysis.utils import until, make_merger_sentinel
|
||||
from cv_analysis.utils.rectangle import Rectangle
|
||||
from cv_analysis.utils.spacial import overlap, adjacent
|
||||
|
||||
|
||||
def close(alpha: Rectangle, beta: Rectangle, max_gap=14):
|
||||
# FIXME: Parameterize via factory
|
||||
return adjacent(alpha, beta, tolerance=max_gap, strict=True)
|
||||
|
||||
|
||||
def is_related(alpha: Rectangle, beta: Rectangle):
|
||||
return close(alpha, beta) or overlap(alpha, beta)
|
||||
from cv_analysis.utils.spacial import is_related
|
||||
|
||||
|
||||
def connect_related_rectangles(rectangles: List[Rectangle]):
|
||||
|
||||
@ -273,5 +273,14 @@ def intersection_along_axis(alpha, beta, axis):
|
||||
return intersection
|
||||
|
||||
|
||||
def is_related(alpha: Rectangle, beta: Rectangle):
|
||||
return close(alpha, beta) or overlap(alpha, beta)
|
||||
|
||||
|
||||
def close(alpha: Rectangle, beta: Rectangle, max_gap=14):
|
||||
# FIXME: Parameterize via factory
|
||||
return adjacent(alpha, beta, tolerance=max_gap, strict=True)
|
||||
|
||||
|
||||
def overlap(alpha: Rectangle, beta: Rectangle):
|
||||
return intersection(alpha, beta) > 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user