I know how to slice a list in python. But I have a confusion when I see the following codes:
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
img = Image.open('test.jpg')
img = np.array(img)
print(img.shape) # (204,204,3)
plt.imshow(img)
plt.imshow(img[:,:,::-1])
Both the last two lines can display the image correctly. But I wonder why img[:,:,::-1] as the img itself can display correctly. Is it just for fun or intentionally?
Thanks in advance!