# Python wrapper for Lourakis' sparse bundle adjustment C library
### Dennis Evangelista
Enjoy! The most recent version can be obtained from [bitbucket](https://bitbucket.org/devangel77b/python-sba) via https or ssh:
```
git clone https://devangel77b@bitbucket.org/devangel77b/python-sba.git
git clone git@bitbucket.org:devangel77b/python-sba.git
```
As **prerequisites**, you will also need to install the sba library as a shared object (libsba.so) (Makefile with shared object target included here) and the sba projections library (libsbaprojs.so):
```
http://www.ics.forth.gr/~lourakis/sba
https://bitbucket.org/devangel77b/libsbaprojs
```
See HOWTO.md for details.
### New in version 1.6.8.2
I think this now works for Python 3. Corrected the cloning recipe now that bitbucket allows git, The bitbucket repo is no longer reliably maintained; for the latest and greatest see [https://argus.web.unc.edu](https://argus.web.unc.edu)
I am no longer in academia because Jenelle Piepmeier and the Department of Weapons, Robotics, and Control Engineering at the US Naval Academy are religiously bigoted creationist nutjobs.
### New in 1.6.8
Dylan Ray updated some things to get it to play nicer with Python 3.
### Typical usage
The main way to use this is as follows
```python
import sba
cameras = sba.Cameras.fromTxt('cams.txt')
points = sba.Points.fromTxt('pts.txt',cameras.ncameras)
newcams, newpts, info = sba.SparseBundleAdjust(cameras,points)
```
If you wish to alter the default and autodetected options, you can
create an Options object and change it, and then pass it to sba:
```python
options = sba.Options.fromInputs(points,cameras)
# can also update options.XXX to appropriate values
newcams,newpts,info = sba.SparseBundleAdjust(cameras,points,options)
```
Hopefully this is cleaner than the original way to call it in C.
### Helpful Hints
Some users have used this package in a workflow combined with the CalTech
Borguet camera calibrations and with data exported from Hedrick's Matlab
dltDV5 / easyWand5 tools. If decomposing someone else's P matrix for use
as a cams.txt, it may help to remember that rotations and translations here
are in the world frame; Rc=R', Tc-R*t (using notation of Hartley and
Zisserman).
When building for a Mac, one user (amin_abouee) noted that the extensions
should be .dylib rather that .so; this can be fixed by altering the lines in both the Makefile and the code, e.g.:
```python
libsba = ctypes.CDLL("libsba.dylib")
```
On rotations: AndyLJones noted the following "SBA works with two sets of rotations. There's the initial rotations, which are fed in as part of the globs argument of `sba_motstr_levmar_x` and family in libsba. These are fixed throughout the optimization. There're also the "local rotations", as Lourakis's readme calls them, which are fed in with the rest of the camera parameters via the p argument to the same function. These are updated at each step. Internally, libsba uses local_rotation * initial_rotation when figuring out the projections." This becomes important if you are working on a known-rotation problem and wish to specify initial rotations. See Issue #16 for more detail.
### Contributors
The original sba C library was written by Manolis Lourakis and is
described in Lourakis, Manolis I A and Antonis A Argyros (2004), "The design
and implementation of a generic sparse bundle adjustment software package
based on the Levenberg-Marquardt algorithm", FOURTH_ICS TR-340.
If using this package in research work, we would appreciate you citing it: D Theriault, N Fuller, B Jackson, E Bluhm, D Evangelista, Z Wu, M Betke, and T Hedrick (2014). A protocol and calibration method for accurate multi-camera field videography. *J exp Biol* **217**:1843-1848. The BibTeX entry is:
```bibtex
@article{Theriault:2014,
author = {Theriault, D and Fuller, N and Jackson, B and Bluhm, E and Evangelista, D and Wu, Z and Betke, M and Hedrick, T},
title = {A protocol and calibration method for accurate multi-camera field videography},
journal = {J exp Biol},
doi={10.1242/jeb.100529},
year = {2014},
volume = {217},
pages = {1843--1848}}
```
### Thanks also to
Manolis Lourakis and Antonis Argyros, Ty Hedrick, Evan Bluhm, my mom and the academy. Version 1.6.5 has bug fixes from Isaac Yeaton and Nick Gravish, and notes on Mac usage from Amin Abouee. Andy Jones helped provide clarification on rotations in known-rotation problems.
Raw data
{
"_id": null,
"home_page": "",
"name": "sba",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "SBA,sparse bundle adjustment,calibration,camera,camera calibration,photogrammetry",
"author": "Dennis Evangelista",
"author_email": "Dennis Evangelista <devangel77b@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/3f/de/dde97fccfb973281f18c832fb70f5d1e38fb532c93b34cf14d8016f37f9c/sba-1.6.8.2.tar.gz",
"platform": null,
"description": "# Python wrapper for Lourakis' sparse bundle adjustment C library \n### Dennis Evangelista \n\nEnjoy! The most recent version can be obtained from [bitbucket](https://bitbucket.org/devangel77b/python-sba) via https or ssh:\n```\ngit clone https://devangel77b@bitbucket.org/devangel77b/python-sba.git\ngit clone git@bitbucket.org:devangel77b/python-sba.git\n```\n\nAs **prerequisites**, you will also need to install the sba library as a shared object (libsba.so) (Makefile with shared object target included here) and the sba projections library (libsbaprojs.so):\n\n```\nhttp://www.ics.forth.gr/~lourakis/sba\nhttps://bitbucket.org/devangel77b/libsbaprojs\n```\n\nSee HOWTO.md for details.\n\n### New in version 1.6.8.2\nI think this now works for Python 3. Corrected the cloning recipe now that bitbucket allows git, The bitbucket repo is no longer reliably maintained; for the latest and greatest see [https://argus.web.unc.edu](https://argus.web.unc.edu)\n\nI am no longer in academia because Jenelle Piepmeier and the Department of Weapons, Robotics, and Control Engineering at the US Naval Academy are religiously bigoted creationist nutjobs. \n\n### New in 1.6.8\n\nDylan Ray updated some things to get it to play nicer with Python 3.\n\n### Typical usage\n\nThe main way to use this is as follows\n\n```python\nimport sba\n\ncameras = sba.Cameras.fromTxt('cams.txt')\npoints = sba.Points.fromTxt('pts.txt',cameras.ncameras)\nnewcams, newpts, info = sba.SparseBundleAdjust(cameras,points)\n```\n\nIf you wish to alter the default and autodetected options, you can\ncreate an Options object and change it, and then pass it to sba:\n```python\noptions = sba.Options.fromInputs(points,cameras)\n# can also update options.XXX to appropriate values\nnewcams,newpts,info = sba.SparseBundleAdjust(cameras,points,options)\n```\n\nHopefully this is cleaner than the original way to call it in C. \n\n### Helpful Hints\n\nSome users have used this package in a workflow combined with the CalTech\nBorguet camera calibrations and with data exported from Hedrick's Matlab \ndltDV5 / easyWand5 tools. If decomposing someone else's P matrix for use\nas a cams.txt, it may help to remember that rotations and translations here \nare in the world frame; Rc=R', Tc-R*t (using notation of Hartley and \nZisserman).\n\nWhen building for a Mac, one user (amin_abouee) noted that the extensions \nshould be .dylib rather that .so; this can be fixed by altering the lines in both the Makefile and the code, e.g.:\n\n```python\nlibsba = ctypes.CDLL(\"libsba.dylib\")\n```\nOn rotations: AndyLJones noted the following \"SBA works with two sets of rotations. There's the initial rotations, which are fed in as part of the globs argument of `sba_motstr_levmar_x` and family in libsba. These are fixed throughout the optimization. There're also the \"local rotations\", as Lourakis's readme calls them, which are fed in with the rest of the camera parameters via the p argument to the same function. These are updated at each step. Internally, libsba uses local_rotation * initial_rotation when figuring out the projections.\" This becomes important if you are working on a known-rotation problem and wish to specify initial rotations. See Issue #16 for more detail. \n\n \n### Contributors\n\nThe original sba C library was written by Manolis Lourakis and is \ndescribed in Lourakis, Manolis I A and Antonis A Argyros (2004), \"The design \nand implementation of a generic sparse bundle adjustment software package \nbased on the Levenberg-Marquardt algorithm\", FOURTH_ICS TR-340.\n\nIf using this package in research work, we would appreciate you citing it: D Theriault, N Fuller, B Jackson, E Bluhm, D Evangelista, Z Wu, M Betke, and T Hedrick (2014). A protocol and calibration method for accurate multi-camera field videography. *J exp Biol* **217**:1843-1848. The BibTeX entry is:\n\n```bibtex\n@article{Theriault:2014,\nauthor = {Theriault, D and Fuller, N and Jackson, B and Bluhm, E and Evangelista, D and Wu, Z and Betke, M and Hedrick, T},\ntitle = {A protocol and calibration method for accurate multi-camera field videography},\njournal = {J exp Biol},\ndoi={10.1242/jeb.100529},\nyear = {2014},\nvolume = {217},\npages = {1843--1848}}\n```\n\n\n### Thanks also to\n\nManolis Lourakis and Antonis Argyros, Ty Hedrick, Evan Bluhm, my mom and the academy. Version 1.6.5 has bug fixes from Isaac Yeaton and Nick Gravish, and notes on Mac usage from Amin Abouee. Andy Jones helped provide clarification on rotations in known-rotation problems.\n\n",
"bugtrack_url": null,
"license": "GNU GPLv3",
"summary": "Python wrapper for Lourakis' sparse bundle adjustment C library",
"version": "1.6.8.2",
"split_keywords": [
"sba",
"sparse bundle adjustment",
"calibration",
"camera",
"camera calibration",
"photogrammetry"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b882bad147d92182bcfae55b63820ede478f34f828c4cb15191f260d33cad3c",
"md5": "7d384123cda790a996550efb66ed7b70",
"sha256": "6e1459d9ba1ebcbde5e563811c2cf424fed1092c932584bda0d837852270bb7a"
},
"downloads": -1,
"filename": "sba-1.6.8.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d384123cda790a996550efb66ed7b70",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 40305,
"upload_time": "2023-01-30T03:18:20",
"upload_time_iso_8601": "2023-01-30T03:18:20.827148Z",
"url": "https://files.pythonhosted.org/packages/3b/88/2bad147d92182bcfae55b63820ede478f34f828c4cb15191f260d33cad3c/sba-1.6.8.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3fdedde97fccfb973281f18c832fb70f5d1e38fb532c93b34cf14d8016f37f9c",
"md5": "ea681a89b7f33cb91e3849f7b840e5d7",
"sha256": "7222bc032a941321d991efbac6fcf52fc40dff0bdfe82e4f4f7fdab5adf3ea38"
},
"downloads": -1,
"filename": "sba-1.6.8.2.tar.gz",
"has_sig": false,
"md5_digest": "ea681a89b7f33cb91e3849f7b840e5d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 38840,
"upload_time": "2023-01-30T03:18:22",
"upload_time_iso_8601": "2023-01-30T03:18:22.976583Z",
"url": "https://files.pythonhosted.org/packages/3f/de/dde97fccfb973281f18c832fb70f5d1e38fb532c93b34cf14d8016f37f9c/sba-1.6.8.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-30 03:18:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "sba"
}