Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hey, I'm still having some troubles but I don't know where my mistake is. I wrote my programm as pseudo code. I pretty sure my code is correct for census, DSI, hamming and aggregation. In the last 2 parts LR - matching & RL-Matching, where I'm searching for the lowest costs (WTA) in the disparities. Did I understand that correct?

load left_img
load right_img

calculate census_left(left_img)
calculate census_right(right_img)

//CALC DSI

for d=0 to N_Disp
    for y=0 to height
        for x=d to width
            DSI[d].data[y*width + x] = hamming_distance(census_left[y*width + x],            
                                                       census_right[y*width + x - d])
        end
    end
end

//aggregate costs 5+5 Boxfilter

for d=0 to N_Disp
    for y=0 to height
        for x=d to width
            sum_pixel = boxfilter(dsi[d].data[y*width + x],5)
            dsi_aggr[d].data[y*width + x] = sum_of_elems_pixel;
        end
    end
end

//LR - matching
disp_costs[N_Disp]
minIndex=0
min2Index=0
for y=0 to height
    for x=0 to width
        for d=0 to N_Disp
            disp_costs[d] = dsi_aggr[d].data[y*width + x + d]
        end 
        find_minimum(disp_costs,&minIndex,&min2Index)

        dsi_min_lr[y*width + x] = minIndex
        calculate_confidence_map_value(cm.data[y*width + x],dsi_aggr[].data[y*width + x],minIndex,min2Index)
    end
end

//RL - matching
for y=0 to height
    for x=0+N_Disp to width
        for d=0 to N_Disp
            disp_costs[d] = dsi_aggr[d].data[y*width + x - d]
        end 
        find_minimum(disp_costs,&minIndex,&min2Index)

        dsi_min_rl[y*width + x] = minIndex
        calculate_confidence_map_value(cm,dsi_aggr,minIndex,min2Index)
    end
end