earth movers algorithm for histogram comparison is based on the producer-consumer problem
Suppose we have m producers and each producer comes with a weight representing the amount of product he has. We denote producer set P as: P = {(p1, w1), ...,(pm, wm)} Suppose we also have n customers and each consumer comes with a weight indicating the amount of product he needs. We denote the consumer set C as: C = {(c1, w1), ..., (cn, wn)}
in analogy to the histogram comparison problem, we have 2 histograms, each histogram is a vector of a bin, and the amount of pixels in that bin, and the 2 histogram vectors are the producers vector and the consumer vector
also consider we already have a distance matrix D of size m X n, we want to calculate the flow matrix that describes how much "product" are to be moved from every producer to every consumer, where the total sum of this flow matrix should be minimized.
i tried and failed to find an algorithm (preferebly an implementation in python) to calculate this flow matrix.
if anyone knows or can point me in the right direction i would really appreciate it
thanks