Skip to content

Instantly share code, notes, and snippets.

@ritvikmath
Created December 20, 2019 15:39
Show Gist options
  • Select an option

  • Save ritvikmath/734c103b216f9b8b0caa5c38095cbf8d to your computer and use it in GitHub Desktop.

Select an option

Save ritvikmath/734c103b216f9b8b0caa5c38095cbf8d to your computer and use it in GitHub Desktop.
#operate on a copy of the image
copyImg = img.copy()
#get the x and y center points of our image
center_x = n/2
center_y = m/2
#create a circle mask which is centered in the middle of the image, and with radius 100
circle_mask = (x-center_x)**2 + (y-center_y)**2 <= 100**2
#black out anywhere within the circle mask
copyImg[circle_mask] = [0,0,0]
#show the image
plt.imshow(copyImg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment