OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Fri, 31 Jul 2015 03:39:15 -0500normalized euclidean Distance between 2 points in an imagehttp://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/ Hello forum,
When attempting to find the distance stated above, would it be better to use the bhattacharrya distance or the mahalanobis distance ?
The mahalanobis function requires an input of the covariance matrix. Based on wikipedia it says the matrix should be diagonal for the function to be equal to the normalized euclidean distance. I am not sure how to get that diagonal covariance matrix from 2 points in an image.
Wed, 29 Jul 2015 02:04:39 -0500http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/Answer by StevenPuttemans for <p>Hello forum,</p>
<p>When attempting to find the distance stated above, would it be better to use the bhattacharrya distance or the mahalanobis distance ? </p>
<p>The mahalanobis function requires an input of the covariance matrix. Based on wikipedia it says the matrix should be diagonal for the function to be equal to the normalized euclidean distance. I am not sure how to get that diagonal covariance matrix from 2 points in an image.</p>
http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?answer=67310#post-id-67310You can simply use the norm interface of OpenCV to do it for you right? Some more info can be found [here](http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=norm#double%20norm%28InputArray%20src1,%20InputArray%20src2,%20int%20normType,%20InputArray%20mask%29) and [here](http://answers.opencv.org/question/14188/calc-eucliadian-distance-between-two-single-point/).Wed, 29 Jul 2015 02:52:31 -0500http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?answer=67310#post-id-67310Comment by StevenPuttemans for <p>You can simply use the norm interface of OpenCV to do it for you right? Some more info can be found <a href="http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=norm#double%20norm%28InputArray%20src1,%20InputArray%20src2,%20int%20normType,%20InputArray%20mask%29">here</a> and <a href="http://answers.opencv.org/question/14188/calc-eucliadian-distance-between-two-single-point/">here</a>.</p>
http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67331#post-id-67331So once you got the distance measure, you want a value between 0 1? Then you will first have to decide what your maximum distance value will be for your application in order to have a correct remapping.Wed, 29 Jul 2015 04:49:13 -0500http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67331#post-id-67331Comment by Nbb for <p>You can simply use the norm interface of OpenCV to do it for you right? Some more info can be found <a href="http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=norm#double%20norm%28InputArray%20src1,%20InputArray%20src2,%20int%20normType,%20InputArray%20mask%29">here</a> and <a href="http://answers.opencv.org/question/14188/calc-eucliadian-distance-between-two-single-point/">here</a>.</p>
http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67455#post-id-67455Thanks and Sorry I misunderstood the use of the mahalanobis distance.Fri, 31 Jul 2015 03:39:15 -0500http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67455#post-id-67455Comment by Nbb for <p>You can simply use the norm interface of OpenCV to do it for you right? Some more info can be found <a href="http://docs.opencv.org/modules/core/doc/operations_on_arrays.html?highlight=norm#double%20norm%28InputArray%20src1,%20InputArray%20src2,%20int%20normType,%20InputArray%20mask%29">here</a> and <a href="http://answers.opencv.org/question/14188/calc-eucliadian-distance-between-two-single-point/">here</a>.</p>
http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67329#post-id-67329Sorry, what I meant was I would like the value to be between 0 to 1Wed, 29 Jul 2015 04:35:31 -0500http://answers.opencv.org/question/67291/normalized-euclidean-distance-between-2-points-in-an-image/?comment=67329#post-id-67329