-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Added mediapipeDetection file for person detection (Face, hands, pose detection) #4669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Functionalities include face, hand, and pose detection. This file focuses on pose detection.
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| # FEED CAPTURE | ||
| cap = cv2.VideoCapture(0) # Webcam feed | ||
|
|
||
| pTime = 0 |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: pTime
|
|
||
| make_1080p() | ||
|
|
||
| def make_720p(): |
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.
Please provide return type hint for the function: make_720p. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_720p
| cap.set(3, 1280) | ||
| cap.set(4, 720) | ||
|
|
||
| def make_480p(): |
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.
Please provide return type hint for the function: make_480p. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_480p
|
|
||
| #make_480p() | ||
|
|
||
| def change_res(width, height): |
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.
Please provide return type hint for the function: change_res. If the function does not return a value, please provide the type hint as: def function() -> None:
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function change_res
Please provide type hint for the parameter: width
Please provide type hint for the parameter: height
| backStage1 = "Crooked" | ||
| backStage2 = "Crooked" | ||
| backColor = red | ||
| backStage = "Crooked" |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backStage
| # Sitting-Standing condition | ||
|
|
||
| if backStage=="Crooked" and stage3=="Folded" and stage4=="Folded": | ||
| sittingStage = "Sitting" |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: sittingStage
| if backStage=="Crooked" and stage3=="Folded" and stage4=="Folded": | ||
| sittingStage = "Sitting" | ||
| if backStage=="Straight" and stage3=="Stretched" and stage4=="Stretched" and sittingStage=="Sitting": | ||
| sittingStage = "Standing" |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: sittingStage
|
|
||
|
|
||
| # CALCULATE FPS | ||
| cTime = time.time() |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: cTime
| # CALCULATE FPS | ||
| cTime = time.time() | ||
| fps = 1/(cTime-pTime) | ||
| pTime = cTime |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: pTime
Updated variable names to follow appropriate python naming convention
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| # FEED CAPTURE | ||
| cap = cv2.VideoCapture(0) # Webcam feed | ||
| #cap = cv2.VideoCapture('Videos/3.mp4') | ||
| p_Time = 0 |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: p_Time
|
|
||
| # Resolution scaling | ||
|
|
||
| def make_1080p()-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_1080p
|
|
||
| make_1080p() | ||
|
|
||
| def make_720p()-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_720p
| cap.set(3, 1280) | ||
| cap.set(4, 720) | ||
|
|
||
| def make_480p()-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_480p
|
|
||
| #make_480p() | ||
|
|
||
| def change_res(width, height)-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function change_res
Please provide type hint for the parameter: width
Please provide type hint for the parameter: height
| back_Stage = "Straight" | ||
| if backAngle1 < 174 and backAngle2 < 174 and back_Stage1 == back_Stage2 =='Straight': | ||
| back_Stage1 = "Crooked" | ||
| back_Stage2 = "Crooked" |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: back_Stage2
| if backAngle1 < 174 and backAngle2 < 174 and back_Stage1 == back_Stage2 =='Straight': | ||
| back_Stage1 = "Crooked" | ||
| back_Stage2 = "Crooked" | ||
| backColor = red |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backColor
| back_Stage1 = "Crooked" | ||
| back_Stage2 = "Crooked" | ||
| backColor = red | ||
| back_Stage = "Crooked" |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: back_Stage
|
|
||
|
|
||
| # CALCULATE FPS | ||
| c_Time = time.time() |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: c_Time
| # CALCULATE FPS | ||
| c_Time = time.time() | ||
| fps = 1/(c_Time-p_Time) | ||
| p_Time = c_Time |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: p_Time
More changes in variable naming
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.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
|
|
||
| # Resolution scaling | ||
|
|
||
| def make_1080p()-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function make_1080p
| white = (255,255,255) | ||
| color1 = (0,255,0) | ||
| color2 = (0,255,0) | ||
| backColor = (255,255,255) |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backColor
| # ANGLE CALCULATIONS | ||
|
|
||
| # X-Y PLANE | ||
| def calculate_angle(a, b, c)-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function calculate_angle
Please provide descriptive name for the parameter: a
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: b
Please provide type hint for the parameter: b
Please provide descriptive name for the parameter: c
Please provide type hint for the parameter: c
|
|
||
|
|
||
| # Y-Z PLANE | ||
| def calculate_angle_yz(a, b, c)-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function calculate_angle_yz
Please provide descriptive name for the parameter: a
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: b
Please provide type hint for the parameter: b
Please provide descriptive name for the parameter: c
Please provide type hint for the parameter: c
|
|
||
|
|
||
| # X-Z PLANE | ||
| def calculate_angle_xz(a, b, c)-> None: |
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.
As there is no test file in this pull request nor any test function or class in the file computer_vision/mediapipeDetection.py, please provide doctest for the function calculate_angle_xz
Please provide descriptive name for the parameter: a
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: b
Please provide type hint for the parameter: b
Please provide descriptive name for the parameter: c
Please provide type hint for the parameter: c
| lElbowAngleYZ = "YZ: " + str(int(calculate_angle_yz(lshoulder, lelbow, lwrist))) | ||
| rElbowAngleYZ = "YZ: " + str(int(calculate_angle_yz(rshoulder, relbow, rwrist))) | ||
| lShoulderAngleYZ = "YZ:" + str(int(calculate_angle_yz(lhip, lshoulder, lelbow))) | ||
| rShoulderAngleYZ = "YZ:" + str(int(calculate_angle_yz(rhip, rshoulder, relbow))) |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: rShoulderAngleYZ
| angle4 = int(calculate_angle(rhip, rknee, rankle)) | ||
|
|
||
|
|
||
| backAngle1 = int(calculate_angle(lshoulder, lhip, lknee)) |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backAngle1
|
|
||
|
|
||
| backAngle1 = int(calculate_angle(lshoulder, lhip, lknee)) | ||
| backAngle2 = int(calculate_angle(rshoulder, rhip, rknee)) |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backAngle2
| if backAngle1 > 174 and backAngle2 > 174: | ||
| back_stage1 = "Straight" | ||
| back_stage2 = "Straight" | ||
| backColor = white |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backColor
| if backAngle1 < 174 and backAngle2 < 174 and back_stage1 == back_stage2 =='Straight': | ||
| back_stage1 = "Crooked" | ||
| back_stage2 = "Crooked" | ||
| backColor = red |
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.
Variable and function names should follow the snake_case naming convention. Please update the following name accordingly: backColor


Face, Hand, and Pose Detection Using Mediapipe and OpenCV
Fixes Issue #4668
Functionalities include face, hand, and pose detection. This file focuses on pose detection.
Functionalities:
Improvements:
Screenshots:
Checklist:
Fixes: #{$ISSUE_NO}.