Reputation:
Im using the following code to compute eigen vectors together with eigen values.
mean, eigenvectors, eigenvalues = cv2.PCACompute2(data_pts, mean)
but why am i getting the following error?
AttributeError: module 'cv2' has no attribute 'PCACompute2'
I have installed opencv-contrib-python
though using pip but still the error persists.
Is there any ways to find eigen values apart from PCACompute2?
Upvotes: 1
Views: 1483
Reputation: 1
you need to install the contrib
package
sudo -H pip install opencv-contrib-python
sudo -H pip install opencv-python
Upvotes: 0
Reputation: 902
Maybe numpy.linalg.eig is what you're looking for? Assuming you're sending your input as a square matrix.
import numpy as np
eigenvalues, eigenvectors = np.linalg.eig(M)
You may also want to take a look at an answer to this question: Do non-square matrices have eigenvalues? .
Upvotes: 1