-
-
Notifications
You must be signed in to change notification settings - Fork 49.7k
drawOnWebcamVideoOpenCV #2424
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
drawOnWebcamVideoOpenCV #2424
Conversation
| press = False | ||
|
|
||
|
|
||
| def draw_rectangle(event, x, y, flags, params): |
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.
Python type hints on function parameters and return type?
| cap = cv2.VideoCapture(0) | ||
| width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) | ||
| height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) | ||
|
|
||
|
|
||
| # Create a named window for connections | ||
| cv2.namedWindow(winname="frame") | ||
|
|
||
| # Bind draw_rectangle function to mouse cliks | ||
| cv2.setMouseCallback("frame", draw_rectangle) |
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.
All of this code (lines 38-67) is going to run in Travis CI every time we test this code (i.e. on every pull request to the repo).
| # assign top left point of rectangle | ||
| pt1 = (x, y) |
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.
| # assign top left point of rectangle | |
| pt1 = (x, y) | |
| top_left = (x, y) |
Variable names that are self-documenting can make comments redundant.
| # mouse button pressed flag | ||
| press = True |
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.
| # mouse button pressed flag | |
| press = True | |
| is_mouse_button_pressed = True |
| # assign bottom right corner of rectangle | ||
| pt2 = (x, y) |
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.
| # assign bottom right corner of rectangle | |
| pt2 = (x, y) | |
| bottom_right = (x, y) |
| pt1 = (0, 0) | ||
| pt2 = (0, 0) | ||
| press = False |
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.
| pt1 = (0, 0) | |
| pt2 = (0, 0) | |
| press = False | |
| top_left = (0, 0) | |
| bottom_right = (0, 0) | |
| is_mouse_button_pressed = False |
|
Hey @santoshrajkumar, TravisCI finished with status TravisBuddy Request Identifier: 946a1450-f6cd-11ea-afed-a1bc0e34d213 |
|
Hey @santoshrajkumar, TravisCI finished with status TravisBuddy Request Identifier: d8223330-f6cd-11ea-afed-a1bc0e34d213 |
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.