-
Notifications
You must be signed in to change notification settings - Fork 212
Cropping Images Dynamically #264
Cropping Images Dynamically #264
Conversation
@disha2sinha @ankitdobhal please review my PR. |
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.
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)] |
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.
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 |
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.
Put Space after comma
|
||
if var == ord('c'): # Crop selected images | ||
|
||
if len(refpt)==2: |
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.
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] |
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.
Put space around :
Updated the file with the suggested changes , please review. |
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.
Nice @Pranjalmishra30 .
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)