Hi,
I don't know whether the title is descriptive enough, but I have been thinking about this issue already several times and it looks like a few more people already asked about this.
However, I am still not sure about what the solution to this problem is or the best way how to deal with it, so sorry for asking again.
The goal is to implement a simple algorithm for dense direct RGB-D frame alignment, similar to projective ICP. The minimization objective is to minimize the photometric error. I.e. given two RGB-D frames (color + aligned depth), estimate/adjust the pose in a way such that the difference between the reference image and the warped current image is as small as possible. (See
https://vision.in.tum.de/_media/spezial/bib/kerl13icra.pdf )
The way I implemented this algorithm with auto differentiation is roughly:
- add a residual for each pixel in the reference frame.
- get intensity value in this reference frame (valRef).
- warp each 3D point in the reference frame (back-projected using it's depth and cam intrinsics) into the current frame using the pose, which are the parameters to be optimized (angle-axis in my case).
- project warped 3D point in current frame to 2D image coordinates.
- lookup intensity value in current frame (valCur) at these 2D coordinates using BiCubicInterpolator.
- residual[0] = valRef - valCur;
(I could also provide with my implemention if this helps)
The point is: in case the 2D lookup coordinates after warping do not project into the current image (or project to an invalid depth value), I do not want the residual to be included in the overall cost (and actually also not in the Jacobian, which is a contradiction to the design of Ceres solver as far as I have understood).
I have seen in another topic, that one could assign a constant penalty to these "invalid" projections.
If I am not wrong, a constant penalty could result in the problem, that the pose will be adjusted in order to make as many residuals project onto valid values, right? But the actual goal is to make only the "valid" projections as compatible as possible. A penalty of zero may be problematic as well (less pixels that project into the other view result in a smaller cost?).
I have stumbled across the same problematic as well in other (more complex) scenarios that involve camera pose estimation. How would you suggest to deal with this scenario?
Thanks a lot and best,
Robert