Bundle Adjustment

Hi, I am not sure if this question relates to OpenCV or not but can someone point me in the right direction for implementing Bundle Adjustment. I am working on a SFM implementation and I have to recalculate camera projection matrices after adding new views to the reconstruction.