Search code examples
google-project-tango

Google Tango: Aligning Depth and Color Frames


I would like to align a (synchronous) depth/color frame pair, using the Google Tango tablet, such that, assuming that both frames have the same resolution, each pixel in the depth frame corresponds to the same pixel in the color frame, i.e., I would like to achieve a retinotopic mapping. How can this be achieved using the latest C API (Hilbert Release Version 1.6)? Any help on this will be greatly appreciated.


Solution

  • Generating simple crude UV coordinates to map tango point cloud points back onto source image (texture coordinates) - see comments above for more details, we've messed this thread up but good :-( (Language is C#, classes are .Net) Field of view calculate FOV horizontal (true) or vertical (false)

    public PointF PictureUV(Vector3D imagePlaneLocation)
            {
                // u is a function of x where y is 0
                double u = Math.Atan2(imagePlaneLocation.X, imagePlaneLocation.Z);
                u += (FieldOfView(true) / 2.0);
                u = u/FieldOfView(true);
                double v = Math.Atan2(imagePlaneLocation.Y, imagePlaneLocation.Z);
                v += (FieldOfView() / 2.0);
                v = v / FieldOfView();
    
                return new PointF((float)u, (float)(1.0 - v));
            }