A computer-implemented method for rendering a target image Î i of a virtual target camera based on a source image I i captured by a real source camera, the source camera comprising a camera-head and a rigid endoscope with lens cut β, the lens cut being the angle between the optical and mechanical axes of the endoscope, that rotates in azimuth around a mechanical axis that intersects the image in a point Q, for which the focal length f, radial distortion ξ, and principal point O at a certain azimuth α 0 are known, the method comprising: finding a location of the principal point O i in the source image I i with azimuth α i by rotating O around Q by an angular displacement in azimuth δ i = α i - α 0; updating a camera model c s of the source camera that maps points x in a canonical image into points u in a pixel image according to the focal length f, radial distortion ξ, and location of the principal point O i; determining a 3D location of a vertical plane Π i that contains the mechanical axis and the optical axis of the source camera, by finding and back-projecting into 3D space a line n i where Π i intersects the source image I i; defining a 3D motion m between the target and source cameras as a rotation by an angle γ = β̂ - β around a direction n i that is normal to the vertical plane Π i i, such that x = m (x̂; γ, n i), with x̂ being a point in the canonical image of the target camera and β̂ being the lens cut of the target camera; computing a focal length f̂ and a location of the principal point Ô i for the target camera and deriving a camera model c t that maps the points x̂ in the canonical image of the target image into points û in a pixel image of the target image according to the focal length f̂ and location of the principal point Ô i; and generating the target image Î i by mapping a plurality of pixels û in Î i into a point u in the source image I i with a mapping function w that is a composition of the camera model c s of the source camera, the 3D motion m, and an inverse of a camera model c t of the target camera. finding a location of the principal point O i in the source image I i with azimuth α i by rotating O around Q by an angular displacement in azimuth δ i = α i - α 0; updating a camera model c s of the source camera that maps points x in a canonical image into points u in a pixel image according to the focal length f, radial distortion ξ, and location of the principal point O i; determining a 3D location of a vertical plane Π i that contains the mechanical axis and the optical axis of the source camera, by finding and back-projecting into 3D space a line n i where Π i intersects the source image I i; defining a 3D motion m between the target and source cameras as a rotation by an angle γ = β̂ - β around a direction n i that is normal to the vertical plane Π i i, such that x = m (x̂; γ, n i), with x̂ being a point in the canonical image of the target camera and β̂ being the lens cut of the target camera; computing a focal length f̂ and a location of the principal point Ô i for the target camera and deriving a camera model c t that maps the points x̂ in the canonical image of the target image into points û in a pixel image of the target image according to the focal length f̂ and location of the principal point Ô i; and generating the target image Î i by mapping a plurality of pixels û in Î i into a point u in the source image I i with a mapping function w that is a composition of the camera model c s of the source camera, the 3D motion m, and an inverse of a camera model c t of the target camera.