I am trying to compute the Earth Mover Distance between two histograms I have (x1,x2), using the following snippet I obtained from http://docs.opencv.org/2.4/modules/imgproc/doc/histograms.html:
cv2.cv.CalcEMD2(x1, x2,cv2.cv.CV_DIST_L1)
However I keep getting this error.
TypeError: CvArr argument 'signature1' must be IplImage, CvMat or CvMatND. Use fromarray() to convert numpy arrays to CvMat or cvMatND"
I tried using .fromarray() to convert what I had into a CvMat format with no success yet. Is there something I am doing wrong?
Here are the two types of array i am working with (shortened to three elements for clarity) I tried to convert using cv2.cv.fromarray():
np.histogramdd(data, bins = 80))
giving me:
(array([ 28., 5., 0.]), [array([-1.71194523, -1.66131523, -1.61068523])])
and a normal np array:
[28. 5. 0.]
Neither work for me and neither allow me to compute the Earth mover distance between arrays. Any help would be greatly appreciated!