How to create Positive and Negative Eigenfaces using Mean image?

I’m trying to generate Eigenvectors of positive and negative Eigenfaces and here is the following code:

model = cv2.face.EigenFaceRecognizer_create()
model.train(np.asarray(faces), np.asarray(labels))

# Save model results
model.save(test_config.TRAINING_FILE)
mean = model.getMean().reshape(faces[0].shape)
cv2.imwrite(MEAN_FILE, normalize(mean, 0, 255, dtype=np.uint8))
eigenvectors = model.getEigenVectors()
pos_eigenvector = eigenvectors[:,0].reshape(faces[0].shape)
cv2.imwrite(POSITIVE_EIGENFACE_FILE, normalize(pos_eigenvector, 0, 255, dtype=np.uint8))
neg_eigenvector = eigenvectors[:,1].reshape(faces[0].shape)
cv2.imwrite(NEGATIVE_EIGENFACE_FILE, normalize(neg_eigenvector, 0, 255, dtype=np.uint8))

I’m getting an error from this block:

neg_eigenvector = eigenvectors[:,1].reshape(faces[0].shape)
IndexError: index 1 is out of bounds for axis 1 with size 1

After Inspecting and Debugging the block I found out that, the line:

eigenvectors = model.getEigenVectors()

the above line is producing a black image and its vectors

[[ 0.] [ 0.] [ 0.] ..., [ 0.] [ 0.] [ 0.]]

I don’t know what happened, the eigenvectors are not generated in the first place. So, is there any fix or any other alternative ways for generating Positive and Negative Eigefaces from mean Image?

Here is the Full Code.

what makes you think, there are NEGATIVE eigenvectors ?
(sounds like a misconception to me)

also, what is eigenvectors.shape ?
(error complains,it has only a single column)

and how many images / persons are in your train data ?

now the main problem is, I can’t get eigenvectors.
I’m getting output as

[[ 0.] [ 0.] [ 0.] ..., [ 0.] [ 0.] [ 0.]]

could you please anwer my questions ?