Skip to content

Commit

Permalink
Add: 사용자 입력 필터링
Browse files Browse the repository at this point in the history
바운딩 박스 내 입력은 제외하기
  • Loading branch information
semnisem committed Nov 19, 2024
1 parent afe22d9 commit ca972d4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/AIProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ def __init__(self, yolo_path: str, sam_path: str, device: torch.device = torch.d
self.height = 0
self.width = 0

def remove_points_in_bboxes(point_list, label_list, bbox_list):
def is_point_in_bbox(p, b):
x, y = p
x_min, y_min, x_max, y_max = b
return x_min <= x <= x_max and y_min <= y <= y_max

filtered_p = []
filtered_l = []
for p, l in zip(point_list, label_list):
if not any(is_point_in_bbox(p, b) for b in bbox_list):
filtered_p.append(p)
filtered_l.append(l)

return filtered_p, filtered_l

def remove_alpha(self, image):
self.height, self.width = image.shape[:2]
self.size = self.height * self.width
Expand Down

0 comments on commit ca972d4

Please sign in to comment.