Problem in Python- Only last numpy array is written to .csv file instead of all arrays being appended to it.How can I fix this?
import cv2, glob
from PIL import Image
import numpy as np
images = glob.glob('*.bmp')
for image in images:
img=cv2.imread(image,0) #original image
re=cv2.resize(img, dsize=(128,128), interpolation=cv2.INTER_LINEAR)
cv2.imwrite("resized_"+image,re) #resized image
a = np.asarray(re) #resized image is converted to pixels
np.savetxt("sal.csv",a, delimiter=',')
print(np.asarray(re)) #which are printed to csv file. Problem is only the last image pixel values are printed to csv file. Any suggestions to rectify this.