Click or drag to resize

Cv2EMD Method (InputArray, InputArray, DistanceTypes, InputArray)

Computes the "minimal work" distance between two weighted point configurations. The function computes the earth mover distance and/or a lower boundary of the distance between the two weighted point configurations.One of the applications described in @cite RubnerSept98, @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval.EMD is a transportation problem that is solved using some modification of a simplex algorithm, thus the complexity is exponential in the worst case, though, on average it is much faster.In the case of a real metric the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used to determine roughly whether the two signatures are far enough so that they cannot relate to the same object.

Namespace:  OpenCvSharp
Assembly:  OpenCvSharp (in OpenCvSharp.dll) Version: 1.0.0
Syntax
public static float EMD(
	InputArray signature1,
	InputArray signature2,
	DistanceTypes distType,
	InputArray cost
)

Parameters

signature1
Type: OpenCvSharpInputArray
First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. Each row stores the point weight followed by the point coordinates.The matrix is allowed to have a single column(weights only) if the user-defined cost matrix is used.The weights must be non-negative and have at least one non-zero value.
signature2
Type: OpenCvSharpInputArray
Second signature of the same format as signature1 , though the number of rows may be different.The total weights may be different.In this case an extra "dummy" point is added to either signature1 or signature2. The weights must be non-negative and have at least one non-zero value.
distType
Type: OpenCvSharpDistanceTypes
Used metric.
cost
Type: OpenCvSharpInputArray
User-defined size1 x size2 cost matrix. Also, if a cost matrix is used, lower boundary lowerBound cannot be calculated because it needs a metric function.

Return Value

Type: Single

[Missing <returns> documentation for "M:OpenCvSharp.Cv2.EMD(OpenCvSharp.InputArray,OpenCvSharp.InputArray,OpenCvSharp.DistanceTypes,OpenCvSharp.InputArray)"]

See Also