Difference between cv2.NORM_L2 and cv2.NORM_L1 in opencv python

sp497 picture sp497 · Sep 29, 2015 · Viewed 9.3k times · Source

I am using sift algorithm from python extra modules for some feature matching. Although one thing I did not understand is the concept behind the normType passed to the BFMatcher. i.e Which ones have to be used in what case?

Any help will be invaluable

Answer

Miki picture Miki · Sep 29, 2015

From WolframAlpha NormL1 and NormL2:

Given a vector:

enter image description here

Norm L1 is the taxicab (or manhattan) distance (sum of absolute values):

enter image description here

while Norm L2 is the euclidean distance (square root of sum of squares):

enter image description here

The type of norm tells the BFMatcher how to compute the distances between every two features.

The NORM L1 is in general much faster to compute (mostly because you don't compute the square root). The NORM L2 is more accurate.

You can find a nice comparison here.