Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Conversation

Pranjalmishra30
Copy link
Contributor

Code to crop images by selecting a region of the image.
Also can save the cropped image. Concepts of MouseEvents are used in this script

Original Issue : #93 (comment)

@Pranjalmishra30
Copy link
Contributor Author

@disha2sinha @ankitdobhal please review my PR.

Copy link

@disha2sinha disha2sinha left a comment

Choose a reason for hiding this comment

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

Put space after comma and around operators wherever applicable. Rest all is fine

global refpt #Global refrences

if event == cv2.EVENT_LBUTTONDOWN: # When the left mouse button is cliked
refpt = [(x,y)]

Choose a reason for hiding this comment

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

Put space after comma

refpt = [(x,y)]

elif event == cv2.EVENT_LBUTTONUP: # When the left mouse button is released
refpt.append((x,y)) # recording the last coordinates

Choose a reason for hiding this comment

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

Put Space after comma


if var == ord('c'): # Crop selected images

if len(refpt)==2:

Choose a reason for hiding this comment

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

Put space around ==

if var == ord('c'): # Crop selected images

if len(refpt)==2:
roi = clone2[refpt[0][1]:refpt[1][1], refpt[0][0]:refpt[1][0]] # [x1:x2 , y1:y2]

Choose a reason for hiding this comment

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

Put space around :

@Pranjalmishra30
Copy link
Contributor Author

Updated the file with the suggested changes , please review.

Copy link
Owner

@powerexploit powerexploit left a comment

Choose a reason for hiding this comment

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

@powerexploit powerexploit merged commit 95a3bca into powerexploit:master Sep 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants