1 | initial version |
This computes a matrix of pair-wise distances between all pairs of rows of descriptors1 and descriptors2. So costMatrix shape should be (descriptors1.rows, descriptors2.rows) and costMatrix(i,j) = distance(descriptors1, descriptors2) where distance is specific to the histogram cost you chose (L2, chi ...).
Notice that the buildCostMatrix normalizes the rows before computing the distance which may be something you do not want.
You can find the computation details here: https://github.com/opencv/opencv_contrib/blob/master/modules/shape/src/hist_cost.cpp