I have written the following code to extract features from an image. The feature vector once extracted from the featex function, needs to be appended to a large feature 2D array containing the features of all images used for training. The code is as follows:
for dirs, path, files in os.walk("wallet_training/"):
for filename in files:
f=os.path.join("wallet_training",filename)
I=Image.open("wallet_training/1(1).jpeg")
I=imresize(I,(256,256))
p=featex(I)
features=np.vstack([features],[p])
print features.shape
It gives the following error:
NameError: name 'features' is not defined
Can someone help me why this error is coming, because as far as i remember variables in python dont need to be defined beforehand.
Thank you in advance.
featuresis?..