I have the following code, which should decrease the width of an image passed as a numpy array by one. Array seam has the column-indices of the pixels to be deleted from corresponding row. To do the deletion, I flatten the matrix, delete the pixels using their coordinates with np.delete (which works for one dimentional arrays only), then try to reshape it back with decremented width, which brings the following error - cannot reshape array of size 832846 into shape (434,639,3)
H, W, C = image.shape
image = image.reshape(H * W, C)
x = np.arange(H)
y = np.array(seam)
indices = x * y + y
image = np.delete(image, indices)
image.reshape(H, W - 1, C)