From the given matrices A and B I need to compute a new matrix C. Matrix A represents image pixels and C is a horizontally shifted version of A. The tricky part: this shift is defined per pixel by the values in the disparity matrix B. For exampe: While pixel (1,1) needs to be shifted 0.1 units to the right, pixel (1,2) needs to be shifted 0.5 units to the left.
I implemented this as backward-mapping, where for each pixel in C I compute the required source position in A (which is simply my current pixel's location minus the corresponding offset in B). Since non-integer shifts are allowed, I need to interpolate the new pixel value.
Doing this in Matlab, of course, takes quite some time as images get larger. Is there any built-in function I can utilize for this task?