1. A method comprising: obtaining, by a computing system, a first image of a scene and a disparity loss function, wherein the first image comprises a plurality of pixels that have respective pixel locations in the first image and respective colors, wherein the disparity loss function corresponds to a given pixel in the first image and indicates variation in similarity between the color of the given pixel in the first image and a set of pixels in a second image of the scene, wherein the set of pixels in the second image have respective pixel locations in the second image corresponding to the pixel location, in the first image, of the given pixel; associating, by the computing system, the pixels of the first image with respective vertices in a vertex space, wherein the vertex space represents spatial and color dimensions; determining, by the computing system for a given vertex in the vertex space that is associated with the given pixel, a vertex disparity value based on the disparity loss function; and generating, by the computing system, a disparity image, wherein the disparity image comprises pixels, wherein a pixel in the disparity image describes a distance between a pixel location of the given pixel and a pixel location of a further pixel in the second image, wherein the given pixel and the further pixel both represent an element in the scene, and wherein generating the disparity image comprises using the determined vertex disparity value to determine the pixel in the disparity image.