Ask Your Question

In the Histogram Cost Extractor module, what does the values returned by buildcostMatrix function signify?

asked 2017-05-29 23:49:50 -0500

lohachan0108 gravatar image

updated 2017-05-30 01:39:46 -0500

I am using buildcostMatrix function and passing it 2 arguments which are the descriptors of two images. I am getting a matrix of double. But it is very huge and therefore hard to comprehend. Can anyone please explain how to make sensible information out of the huge matrix which is returned by the function?

void buildCostMatrix (InputArray descriptors1, InputArray descriptors2, OutputArray costMatrix)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-11-08 13:42:38 -0500

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:

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-29 23:49:50 -0500

Seen: 115 times

Last updated: May 30 '17