Skip to content

Conversation

@santoshrajkumar
Copy link
Contributor

@santoshrajkumar santoshrajkumar commented Sep 14, 2020

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

press = False


def draw_rectangle(event, x, y, flags, params):
Copy link
Member

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?

Comment on lines +38 to +47
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)
Copy link
Member

@cclauss cclauss Sep 14, 2020

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).

Comment on lines +17 to +18
# assign top left point of rectangle
pt1 = (x, y)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# assign top left point of rectangle
pt1 = (x, y)
top_left = (x, y)

Variable names that are self-documenting can make comments redundant.

Comment on lines +20 to +21
# mouse button pressed flag
press = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# mouse button pressed flag
press = True
is_mouse_button_pressed = True

Comment on lines +27 to +28
# assign bottom right corner of rectangle
pt2 = (x, y)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# assign bottom right corner of rectangle
pt2 = (x, y)
bottom_right = (x, y)

Comment on lines +6 to +8
pt1 = (0, 0)
pt2 = (0, 0)
press = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pt1 = (0, 0)
pt2 = (0, 0)
press = False
top_left = (0, 0)
bottom_right = (0, 0)
is_mouse_button_pressed = False

@TravisBuddy
Copy link

Hey @santoshrajkumar,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 946a1450-f6cd-11ea-afed-a1bc0e34d213

@TravisBuddy
Copy link

Hey @santoshrajkumar,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: d8223330-f6cd-11ea-afed-a1bc0e34d213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants