Having a camera mounted on my robot and looking upwards, I want to estimate the distance of the ceiling as the robot moves and also the position of landmarks observed on the ceiling (lamps for example). I know this is a structure from motion problem but I was very confused on how to implement it. This case is a much simpler case than bundle adjustment as the intrinsic calibration of the camera is existing, the camera pose changes just in x and y directions, and the observed thing is a planar ceiling. Odometry might also be available but I would like to start solving it without. Do you know any libraries that offer a good and simple API to do such a thing? preferably based on levenberg-marquardt or similar optimization algorithms taking in more than just two observations. (Python bindings would be nice to have)
Not sure if I understood the problem correctly, but I understood that you wish to estimate the height of the observed objects hanging from the ceiling.
You have a mono camera but you can take two images from different positions and use them as a stereo pair. You can use OpenCV to do this more easily: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
Most packages utilize stereo images to calculate distances. StereoVision is a python package that can be used to generate 3d point clouds. Also, this will require the use of odometry information.
In order to utilize information from more than two sequential images, an implementation of extended kalman filter can be utilized. Successive point clouds can be used to update the estimate of the ceiling.