Skip to content

Commit

Permalink
Add setup.py, example
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Sep 12, 2024
1 parent 49f021b commit 2c3b5f7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cameralib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
Quickstart:
-----------
Make sure that your ODM project has an elevation model available (pass the ``--dsm`` option when processing a dataset), then:
>>> from cameralib import Projector
>>> p = Projector("/dataset/brighton")
>>> p.world2cams(46.8423725961765, -91.99395518749954)
Expand All @@ -18,7 +20,7 @@
Samples:
--------
* `Create Task`_
* `Hello World`_
* `Get Node Info`_
Getting Help / Reporting Issues:
Expand All @@ -36,7 +38,7 @@
.. _OpenDroneMap:
https://www.opendronemap.org
.. _Create Task:
https://github.com/OpenDroneMap/CameraLib/blob/main/examples/create_task.py
https://github.com/OpenDroneMap/CameraLib/blob/main/examples/hello_world.py
.. _Get Node Info:
https://github.com/OpenDroneMap/CameraLib/blob/main/examples/get_node_info.py
.. _report it:
Expand Down
4 changes: 2 additions & 2 deletions cameralib/projector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Projector:
project_path (str): Path to ODM project
z_sample_window (int): Size of the window to use when sampling elevation values
z_sample_strategy (str): Strategy to use when sampling elevation values. Can be one of: ['minimum', 'maximum', 'average', 'median']
z_sample_target (str): Elevation raster to use for sampling elevation. One of: ['dsm', 'dtm']
raycast_resolution_multiplier (float): Value that affects the ray sampling resolution. Lower values can lead to slightly more precise results, but increase processing time.
"""
def __init__(self, project_path, z_sample_window=1, z_sample_strategy='median', z_sample_target='dsm', raycast_resolution_multiplier=0.7071):
Expand Down Expand Up @@ -196,8 +197,7 @@ def world2cams(self, longitude, latitude, normalized=False):
'x': float # The x-coordinate in camera space
'y': float # The y-coordinate in camera space
},
...
}
]
"""
Xa, Ya, Za = get_utm_xyz(self.dem_path, longitude, latitude,
Expand Down
5 changes: 5 additions & 0 deletions examples/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from cameralib import Projector

p = Projector("/data/drone/brighton_camlib")
print(p.world2cams(46.8423725961765, -91.99395518749954))
print(p.cam2world("DJI_0028.JPG", [(3576.52, 898.97)]))
27 changes: 27 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import setuptools
import sys
import os

with open("README.md", "r") as fh:
long_description = fh.read()

with open('requirements.txt') as f:
required = f.read().splitlines()

setuptools.setup(
name="cameralib",
version="1.0.0",
author="OpenDroneMap Contributors",
author_email="[email protected]",
description="Camera library for ODM",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/OpenDroneMap/CameraLib",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: AGPL-3.0-or-later License",
"Operating System :: OS Independent",
],
install_requires=required
)

0 comments on commit 2c3b5f7

Please sign in to comment.