feat: started selecting bounding boxes

This commit is contained in:
Hazel 2025-04-23 17:48:49 +02:00
parent 1dd387d980
commit 208f818e18
3 changed files with 7 additions and 2 deletions

3
.gitignore vendored
View File

@ -160,4 +160,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
.venv .venv
assets/* assets/*
*.pt

View File

@ -266,7 +266,7 @@ def detect_human_parts(human: dict, face_padding: int = 20):
cv2.imwrite(detected, image) cv2.imwrite(detected, image)
def detect_humans(to_detect: str, crop_padding: int = 20, skip_detection_if_present: bool = True): def detect_humans(to_detect: str, crop_padding: int = 20, skip_detection_if_present: bool = False):
_p = Path(to_detect) _p = Path(to_detect)
detected = str(_p.with_name(_p.stem + "_detected" + _p.suffix)) detected = str(_p.with_name(_p.stem + "_detected" + _p.suffix))
boxes_file = str(_p.with_name(_p.stem + "_boxes.json")) boxes_file = str(_p.with_name(_p.stem + "_boxes.json"))
@ -287,6 +287,9 @@ def detect_humans(to_detect: str, crop_padding: int = 20, skip_detection_if_pres
# Load image # Load image
image = cv2.imread(to_detect) image = cv2.imread(to_detect)
r = cv2.selectROI(image)
print(r)
original_image = cv2.imread(to_detect) original_image = cv2.imread(to_detect)
height, width, channels = image.shape height, width, channels = image.shape

View File

@ -0,0 +1 @@
# https://learnopencv.com/how-to-select-a-bounding-box-roi-in-opencv-cpp-python/