1

I have code, which for the sake of argument, looks like the code here:

bestMatchIndex = sortedIndeces(1, 1);

% Convert the 1-based index of this block back into an offset.
% This is the final disparity value produced by basic block matching.
d = bestMatchIndex + mind - 1;

% Calculate a sub-pixel estimate of the disparity by interpolating.
% Sub-pixel estimation requires a block to the left and right, so we 
% skip it if the best matching block is at either edge of the search
% window.
if ((bestMatchIndex == 1) || (bestMatchIndex == numBlocks))
    % Skip sub-pixel estimation and store the initial disparity value.
    DbasicSubpixel(m, n) = d;
else
    % Grab the SAD values at the closest matching block (C2) and it's 
    % immediate neighbors (C1 and C3).
    C1 = blockDiffs(bestMatchIndex - 1);
    C2 = blockDiffs(bestMatchIndex);
    C3 = blockDiffs(bestMatchIndex + 1);

    % Adjust the disparity by some fraction.
    % We're estimating the subpixel location of the true best match.
    DbasicSubpixel(m, n) = d - (0.5 * (C3 - C1) / (C1 - (2*C2) + C3));
end

Now, I also want to calculate an inverse disparity, to eliminate points at infinity, but I cannot find a suitable algorithm. Can anyone describe how it should be done?

My research has suggested that instead of comparing L(x, y) with R(x..x+n, y) it should be comparing L(x, y) with R(x-n..x, y), but am I correct?

(My actual situation is C++ code with a buggy inverse disparity calculation which I cannot find a reference for to discover how the code should be.)

Ken Y-N
  • 111
  • 2
  • 1
    Hi and welcome to the site. Can you edit the question and explain a bit more about the context, what the algorithm is and what you're trying to accomplish? Currently I can't make heads or tails of it. :) – Nathan Reed Aug 25 '16 at 02:10

0 Answers0