libSGM
libSGM copied to clipboard
Census transformation
Hello,
I have a question regarding census transformation when reading your code. Why aren't you comparing the intensity of neighboring pixels with the center?
Best regards.
Here is the code in census_transform.cu
// Compute and store
const int x = x0 + tid, y = y0 + i;
if(half_kw <= x && x < width - half_kw && half_kh <= y && y < height - half_kh){
const int smem_x = tid;
const int smem_y = (half_kh + i) % SMEM_BUFFER_SIZE;
feature_type f = 0;
for(int dy = -half_kh; dy < 0; ++dy){
const int smem_y1 = (smem_y + dy + SMEM_BUFFER_SIZE) % SMEM_BUFFER_SIZE;
const int smem_y2 = (smem_y - dy + SMEM_BUFFER_SIZE) % SMEM_BUFFER_SIZE;
for(int dx = -half_kw; dx <= half_kw; ++dx){
const int smem_x1 = smem_x + dx;
const int smem_x2 = smem_x - dx;
const auto a = smem_lines[smem_y1][smem_x1];
const auto b = smem_lines[smem_y2][smem_x2];
f = (f << 1) | (a > b);
}
}
for(int dx = -half_kw; dx < 0; ++dx){
const int smem_x1 = smem_x + dx;
const int smem_x2 = smem_x - dx;
const auto a = smem_lines[smem_y][smem_x1];
const auto b = smem_lines[smem_y][smem_x2];
f = (f << 1) | (a > b);
}
dest[x + y * width] = f;
}
Hi, @Apeiria
Thank you for your question.
We are actually using Center-Symmetric Census Transform
.
It compares only center-symmetric pairs of pixels.
For more information, please refer to this paper. https://www.mi.fu-berlin.de/inf/groups/ag-ki/publications/Semi-Global_Matching/caip2013rsp_fu.pdf
Regards,
Hi, @Apeiria
Thank you for your question. We are actually using
Center-Symmetric Census Transform
. It compares only center-symmetric pairs of pixels.For more information, please refer to this paper. https://www.mi.fu-berlin.de/inf/groups/ag-ki/publications/Semi-Global_Matching/caip2013rsp_fu.pdf
Regards,
Thank you!