In [ ]:
# import opencv library
import cv2
import numpy as np
 
# Load the image
img = cv2.imread('003.jpg',0)
 
cv2.imshow("Grayscale_image_modified.jpg",img)
cv2.waitKey()
cv2.destroyAllWindows()
 
for k in range(0,50):
    # The [:,:] stands for everything. The first : stands for the first dimension and the second : stands for the second dimension
    img[:,:] = (img[:,:] * 0.97).astype(np.uint8)
    # Show the results
    cv2.imshow('Updated',img)
    cv2.waitKey(40)
     
# Save the image
cv2.imwrite("Grayscale_image_modified.jpg",img)
cv2.destroyAllWindows()
# Show the results
cv2.imshow('Updated',img)
cv2.destroyAllWindows()