in source code ,I find the table in this way:it means value < 16 ,then it is 1 or 0
I wonder it should be inverse:value > 15 ,then it is 1 or 0
INTER_TAB_SIZE = 32;//32 is the scale size
NNDeltaTab_i[i*INTER_TAB_SIZE+j] = j < INTER_TAB_SIZE/2;
NNDeltaTab_i[i*INTER_TAB_SIZE+j] = i < INTER_TAB_SIZE/2;
int a = sA[x1] & (INTER_TAB_SIZE2-1);
XY[x1*2] = sXY[x1*2] + NNDeltaTab_i[a];
XY[x1*2+1] = sXY[x1*2+1] + NNDeltaTab_i[a];
can you devise an “experiment” using
remap() and suitable input data, that would show whether the code is correct or wrong?
when in doubt, you should trust that code more than your own understanding. it has received plenty of consideration by people that know what they’re doing.
nearest remap is hard to find cause there is only small diffs.I have done the experiment before i post it here,it is all the same pixel-wise,but when i find it in source code ,I find something wrong.
here is my experiment ,opencv official remap and custom result:
m_remap_x_16_c2,//CV_16SC2 x y indice
m_remap_y_16_c1);//CV_16UC1 strip indice with x is in lower 5 bits
and I have ensure it that there is no diff in outputs
here i get the fusion mapxy for nearest remap,why there is <16 not >15 when it plus 1.