X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=src%2FUtils.cpp;h=df6802baa2f2b34cb078dee404598d77fb4ba005;hb=HEAD;hp=c174e282436f9b010a0fa55b5991f369c6cc5078;hpb=d06c701dfc59f196bac017708b626f0daa92973f;p=trackerpp.git diff --git a/src/Utils.cpp b/src/Utils.cpp index c174e28..df6802b 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -1,10 +1,16 @@ #include "Utils.h" +#include +#include using namespace suanzi; using namespace cv; +using namespace std; double distance_cosine(const Eigen::VectorXd& u, const Eigen::VectorXd& v) { + if (u.dot(u) * v.dot(v) == 0){ + throw overflow_error("zero vector for cosine distance"); + } return (1 - u.dot(v) / std::sqrt(u.dot(u) * v.dot(v))); }