diff --git a/cameralib/__init__.py b/cameralib/__init__.py index 19bbb6c..8ce3a6b 100644 --- a/cameralib/__init__.py +++ b/cameralib/__init__.py @@ -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) @@ -18,7 +20,7 @@ Samples: -------- - * `Create Task`_ + * `Hello World`_ * `Get Node Info`_ Getting Help / Reporting Issues: @@ -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: diff --git a/cameralib/projector.py b/cameralib/projector.py index c08b281..a2689d6 100644 --- a/cameralib/projector.py +++ b/cameralib/projector.py @@ -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): @@ -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, diff --git a/examples/hello_world.py b/examples/hello_world.py new file mode 100644 index 0000000..4c64de1 --- /dev/null +++ b/examples/hello_world.py @@ -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)])) \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6bcb10f --- /dev/null +++ b/setup.py @@ -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="pt@uav4geo.com", + 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 +) \ No newline at end of file