Skip to content

Instantly share code, notes, and snippets.

@victormurcia
Created October 20, 2022 16:50
Show Gist options
  • Select an option

  • Save victormurcia/e91c968ca2d140d3c7ed0d8ce665f939 to your computer and use it in GitHub Desktop.

Select an option

Save victormurcia/e91c968ca2d140d3c7ed0d8ce665f939 to your computer and use it in GitHub Desktop.
making an roi
#Select ROI from image
imagedraw = cv2.selectROI('select',rgb_img)
cv2.waitKey(0)
cv2.destroyWindow('select')
#cropping the area of the image within the bounding box using imCrop() function
roi_image = rgb_img[int(imagedraw[1]):int(imagedraw[1]+imagedraw[3]),
int(imagedraw[0]):int(imagedraw[0]+imagedraw[2])]
fig,axs = plt.subplots(1,1, figsize=(5,5))
axs.imshow(roi_image)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment