|
|
|
@ -71,6 +71,7 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
stop = num_images; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const |
|
|
|
|
{ |
|
|
|
|
CV_UNUSED(w2); |
|
|
|
@ -78,17 +79,18 @@ namespace cv |
|
|
|
|
{ |
|
|
|
|
if (image[i][rrWidth + jj] > image[i][rWidth + j]) |
|
|
|
|
{ |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] += 1; |
|
|
|
|
} |
|
|
|
|
c[i] = c[i] << 1; |
|
|
|
|
c[i] <<= 1; |
|
|
|
|
if (integralImage[i][rrWidth + jj] > image[i][rWidth + j]) |
|
|
|
|
{ |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] += 1; |
|
|
|
|
} |
|
|
|
|
c[i] = c[i] << 1; |
|
|
|
|
c[i] <<= 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//!Compares pixels from a patch giving high weights to pixels in which
|
|
|
|
|
//!the intensity is higher. The other pixels receive a lower weight
|
|
|
|
|
template <int num_images> |
|
|
|
@ -106,22 +108,21 @@ namespace cv |
|
|
|
|
imageStop = num_images; |
|
|
|
|
t = threshold; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const |
|
|
|
|
{ |
|
|
|
|
CV_UNUSED(w2); |
|
|
|
|
for(int i = 0; i < imageStop; i++) |
|
|
|
|
{ |
|
|
|
|
if (image[i][rrWidth + jj] > image[i][rWidth + j] - t) |
|
|
|
|
if (image[i][rrWidth + jj] > image[i][rWidth + j] + t) |
|
|
|
|
{ |
|
|
|
|
c[i] = c[i] << 1; |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] = c[i] << 1; |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] <<= 2; |
|
|
|
|
c[i] |= 0x11; |
|
|
|
|
} |
|
|
|
|
else if (image[i][rWidth + j] - t < image[i][rrWidth + jj] && image[i][rWidth + j] + t >= image[i][rrWidth + jj]) |
|
|
|
|
else if (image[i][rrWidth + jj] > image[i][rWidth + j] - t) |
|
|
|
|
{ |
|
|
|
|
c[i] = c[i] << 2; |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] <<= 2; |
|
|
|
|
c[i] |= 0x01; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -130,6 +131,7 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//!A madified cs census that compares a pixel with the imediat neightbour starting
|
|
|
|
|
//!from the center
|
|
|
|
|
template<int num_images> |
|
|
|
@ -146,6 +148,7 @@ namespace cv |
|
|
|
|
imageStop = num_images; |
|
|
|
|
n2 = ker; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const |
|
|
|
|
{ |
|
|
|
|
CV_UNUSED(j); |
|
|
|
@ -154,12 +157,13 @@ namespace cv |
|
|
|
|
{ |
|
|
|
|
if (image[i][(rrWidth + jj)] > image[i][(w2 + (jj + n2))]) |
|
|
|
|
{ |
|
|
|
|
c[i] = c[i] + 1; |
|
|
|
|
c[i] += 1; |
|
|
|
|
} |
|
|
|
|
c[i] = c[i] * 2; |
|
|
|
|
c[i] <<= 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//!A kernel in which a pixel is compared with the center of the window
|
|
|
|
|
template<int num_images> |
|
|
|
|
struct CensusKernel |
|
|
|
@ -173,6 +177,7 @@ namespace cv |
|
|
|
|
image[i] = images[i]; |
|
|
|
|
imageStop = num_images; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(int rrWidth,int w2, int rWidth, int jj, int j, int c[num_images]) const |
|
|
|
|
{ |
|
|
|
|
CV_UNUSED(w2); |
|
|
|
@ -187,6 +192,7 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//template clas which efficiently combines the descriptors
|
|
|
|
|
template <int step_start, int step_end, int step_inc,int nr_img, typename Kernel> |
|
|
|
|
class CombinedDescriptor:public ParallelLoopBody |
|
|
|
@ -209,6 +215,7 @@ namespace cv |
|
|
|
|
kernel_ = kernel; |
|
|
|
|
n2_stop = k2Stop; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(const cv::Range &r) const CV_OVERRIDE { |
|
|
|
|
for (int i = r.start; i < r.end ; i++) |
|
|
|
|
{ |
|
|
|
@ -245,6 +252,7 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//!implementation for the star kernel descriptor
|
|
|
|
|
template<int num_images> |
|
|
|
|
class StarKernelCensus:public ParallelLoopBody |
|
|
|
@ -267,6 +275,7 @@ namespace cv |
|
|
|
|
im_num = num_images; |
|
|
|
|
stride_ = (int)img[0].step; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(const cv::Range &r) const CV_OVERRIDE { |
|
|
|
|
for (int i = r.start; i < r.end; i++) |
|
|
|
|
{ |
|
|
|
@ -342,6 +351,7 @@ namespace cv |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//!paralel implementation of the center symetric census
|
|
|
|
|
template <int num_images> |
|
|
|
|
class SymetricCensus:public ParallelLoopBody |
|
|
|
@ -364,6 +374,7 @@ namespace cv |
|
|
|
|
im_num = num_images; |
|
|
|
|
stride_ = (int)img[0].step; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void operator()(const cv::Range &r) const CV_OVERRIDE { |
|
|
|
|
for (int i = r.start; i < r.end ; i++) |
|
|
|
|
{ |
|
|
|
|