NORM_HAMMIG2 and NORM_TYPE_MASK with same values (Bug #4208)


Added by Luis Díaz Más about 10 years ago. Updated about 10 years ago.


Status:Cancelled Start date:2015-02-20
Priority:Low Due date:
Assignee:Ilya Lavrenov % Done:

0%

Category:core
Target version:- Estimated time:0.01 hour
Affected version:2.4.9 (latest release) Operating System:Any
Difficulty:Easy HW Platform:Any
Pull request:

Description

I just found that in the enumeration used for the NORM TYPES, two types have the same value (HAMMING2 & TYPE_MASK):

enum { NORM_INF=1, NORM_L1=2, NORM_L2=4, NORM_L2SQR=5, NORM_HAMMING=6, NORM_HAMMING2=7, NORM_TYPE_MASK=7, NORM_RELATIVE=8, NORM_MINMAX=32 };

I'm not sure if this is a desired feature for some internal reason, but I was doing some unit tests in a personal project that depends on OpenCV and I discovered that. The same issue still present in the OpenCV 3.0 version.


History

Updated by Ilya Lavrenov about 10 years ago

Hi Luis,
Actually, it's not a bug. NORM_TYPE_MASK is necessary to separate type of norm from another additional flags, such as NORM_RELATIVE. So, the typical scenario is:

int normType = type & NORM_TYPE_MASK;
bool isRelative = (type & NORM_RELATIVE) != 0;  

So, NORM_TYPE_MASK must be greater or equal to maximum value of norm type (it's NORM_HAMMING2=7 in our case)

  • Status changed from New to Cancelled
  • Assignee changed from Vadim Pisarevsky to Ilya Lavrenov

Also available in: Atom PDF