1. A method for estimating free space near a moving object, comprising: acquiring a sequence of images of a scene by a monocular camera system arranged on the moving object, and for each image in the sequence of images: constructing a Markov random field as a one-dimensional graph, wherein each node in the graph corresponds to a discrete variable for a column of pixels in the image; determining features in the image; constructing an energy function on the one-dimensional graph based on the determined features; and using dynamic programming to maximize the energy function to obtain a curve, wherein an area under the curve defines the free space near the object, wherein the free space is used for autonomous navigation of the moving object moving from one location to another, and wherein the steps are performed in a processor connected to the monocular camera system, wherein the energy function comprises a sum of unary and pairwise potential functions, and wherein each potential function is determined using a corresponding feature among the determined features and a corresponding weight parameter learned from a sequence of training images.