I'm trying to find a way to cut 25% from each side of the image.
I was trying with this cutted_data = data[1:645,1:645]
but it's not what I'm looking for.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as img
image_name = 'image.jpg'
data = plt.imread('image.jpg')
cutted_data = data[...?]
print(data)
print(np.shape(data))
plt.subplot(231)
plt.imshow(data)
plt.axis('off')
plt.title('Obraz w naturalnych kolorach')
plt.subplot(234)
plt.imshow(cutted_data)
plt.axis('off')
plt.title('Przycięty obraz')
plt.show()
You can try:
data = plt.imread('image.jpg')
rows, cols = data.shape[:2]
cut_data = data[rows//4:-rows//4, cols//4:-cols//4]