Skip to content

dompm/spherical_distortion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spherical Distortion

Lens distortion using the spherical distortion model

Setup

pip install git+https://github.com/dompm/spherical_distortion.git

Usage

from sphericaldistortion import crop_panorama, distort, undistort

Crop from a 360 panorama

crop = crop_panorama('data/pano.jpg', # panorama or path to panorama
                     height=900, # height of the cropped image
                     width=1200, # width of the cropped image
                     f=830, # focal length in pixels
                     xi=0.75, # distortion parameter
                     az=0, # azimuth of the camera in radians
                     el=-0.35, # elevation of the camera in radians
                     roll=0 # roll of the camera in radians
                     )
Pano Result

Apply distortion

distorted_image = distort('data/straight_crop.jpg', # image or path to image
                          f=320, # focal length in pixels
                          xi=0.75 # distortion parameter
                          )
Input Result

Undistort image

undistorted_image = undistort('data/distorted_crop.jpg', # image or path to image
                              f=830, # focal lenght in pixels
                              xi=0.75 # distortion parameter
                              )
Input Result

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages