chalmersgit / emd Goto Github PK
View Code? Open in Web Editor NEWComputes the Earth Mover's Distance between two distributions using Scipy
Computes the Earth Mover's Distance between two distributions using Scipy
hello, thank you for your awesome implementation.
i compare your work with opencv implementation and find a parameter cost .
https://docs.opencv.org/3.4.4/d6/dc7/group__imgproc__hist.html#ga902b8e60cc7075c8947345489221e0e0
but yours does not have such parameter.
i dont quite understand this. In my understanding, cost matrix is computed by the distance function, e.g. L2. why there are both cost matrix and distance function as the parameters?
Hi,
(This is not an issue of your code, but wanted to clarify things before using it)
I tried using the code and also tried the OpenCV EMD function, but got different results.
Here is my code:(I also adjusted weights on your code to all of them to be 1)
from cv2 import *
import numpy as np
a = np.asarray([[1,100, 40, 22], [1, 211, 20, 2 ], [1, 32, 190, 150 ], [ 1,2, 100, 100]], dtype=float)
b = np.asarray([[ 1,0, 0, 0 ], [1, 50, 100, 80 ], [1, 255, 255, 255 ]], dtype=float)
a64 = cv.fromarray(a)
a32 = cv.CreateMat(a64.rows, a64.cols, cv.CV_32FC1)
cv.Convert(a64, a32)
b64 = cv.fromarray(b)
b32 = cv.CreateMat(b64.rows, b64.cols, cv.CV_32FC1)
cv.Convert(b64, b32)
print cv.CalcEMD2(a32,b32,cv.CV_DIST_L2)
cv.WaitKey(0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.