Skip to content

Instantly share code, notes, and snippets.

@victormurcia
Created October 20, 2022 14:32
Show Gist options
  • Select an option

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

Select an option

Save victormurcia/f3a8fb96986299cadd8854d27310d5b9 to your computer and use it in GitHub Desktop.
resizing an image
#Resizing an image
#cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]])
xscale = [0.75,0.5,0.25]
yscale = [0.75,0.5,0.25]
rimg1 = cv2.resize(rgb_img, (0,0), fx=xscale[0], fy=yscale[0])
rimg2 = cv2.resize(rgb_img, (0,0), fx=xscale[1], fy=yscale[1])
rimg3 = cv2.resize(rgb_img, (0,0), fx=xscale[2], fy=yscale[2])
fig,axs = plt.subplots(1,3, figsize=(30,15))
axs[0].imshow(rimg1)
axs[1].imshow(rimg2)
axs[2].imshow(rimg3)
plt.show()
print("The width, height and depth of this image are ",rimg1.shape)
print("The width, height and depth of this image are ",rimg2.shape)
print("The width, height and depth of this image are ",rimg3.shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment