Skip to content

Commit

Permalink
Pull request #13: Feature/WORKASS-18 init state detection
Browse files Browse the repository at this point in the history
Merge in IKT213G22H/workass from feature/WORKASS-18-init-state-detection to main

* commit 'eb42b27255ea335922315094f6d1cc766d88c55b':
  feat: roi is added after the first push up rep
  fix: the roi calculation depends on the distance from the camera
  • Loading branch information
Marija Konstantinovna Bravikova authored and Yauhen Yavorski committed Nov 5, 2022
2 parents dd37a49 + eb42b27 commit fcf7698
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions ROI/ROI.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ def detect_roi(self, image, landmarks):
if landmark.y > maximum_y:
maximum_y = landmark.y

roi_min_x = minimum_x*image_width - image_width*0.1
roi_max_x = maximum_x*image_width + image_width*0.1
roi_min_y = minimum_y*image_height - image_height*0.1
roi_max_y = maximum_y*image_height + image_height*0.1
delta_x = maximum_x*image_width - minimum_x*image_width
delta_y = maximum_y*image_height - minimum_y*image_height

roi_min_x = minimum_x*image_width - delta_x*0.1
roi_max_x = maximum_x*image_width + delta_x*0.1
roi_min_y = minimum_y*image_height - delta_y*0.1
roi_max_y = maximum_y*image_height + delta_y*0.1

self.roi_detected = 'true'

Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

# region of interest
roi = ROI()
init_state_detected = False

# Initialize the FPS reader for displaying on the final image
fps_injector = FPS()
Expand Down Expand Up @@ -74,7 +73,8 @@
try:
my_landmarks = my_results.pose_landmarks.landmark
# my_image = create_region_of_interest(my_image, my_landmarks)
if init_state_detected and not roi.roi_detected:

if push_up.reps and not roi.roi_detected:
roi.detect_roi(my_image, my_landmarks)

visibility_threshold = 0.6
Expand Down

0 comments on commit fcf7698

Please sign in to comment.