Does OpenCV offer a squared norm function for cv::Point?

前端 未结 2 856
时光取名叫无心
时光取名叫无心 2021-01-17 20:30

I have to check several distances between points against a distance threshold. What I can do is taking the square of my threshold and compare it with the squared norm of

2条回答
  •  没有蜡笔的小新
    2021-01-17 21:17

    It seems there's nothings specific to address this problem.

    I thought that one solution could be using the ddot method (dot product), and compute something like

    cv::Point distVec = a-b;
    double squaredNorm = distVec.ddot(distVec);
    

    If one is willing to take the risk, there's cv::normL2Sqr which requires the input to be in array format: cv::Point might be directly convertible to int[].

    I will personally move on by writing my own squared norm.

提交回复
热议问题