From f206fc4af831225839a8ffcc80e2a2e8f45b595d Mon Sep 17 00:00:00 2001 From: Aleksandra Badaczewska Date: Tue, 12 Sep 2023 13:23:02 -0500 Subject: [PATCH] added section for creating conda env for geospatial analysis --- .../OpenDroneMap/03-ODM-georeferencing.md | 83 +++++++++++++++---- 1 file changed, 66 insertions(+), 17 deletions(-) diff --git a/IntroPhotogrammetry/OpenDroneMap/03-ODM-georeferencing.md b/IntroPhotogrammetry/OpenDroneMap/03-ODM-georeferencing.md index 48bee61..76b5e3b 100644 --- a/IntroPhotogrammetry/OpenDroneMap/03-ODM-georeferencing.md +++ b/IntroPhotogrammetry/OpenDroneMap/03-ODM-georeferencing.md @@ -237,15 +237,13 @@ Expected format of the GCP_reference.txt is 4-columns: ArUco_ID x y z **5. Georeferencing:** Knowing the real-world coordinates of each ArUco marker, the captured images can be georeferenced (assigned to a specific location in a spatial reference system). This ensures that the imagery aligns accurately with geographic coordinates. -## Find-GCP python utility: installation +# Create env for geospatial analysis -**[Find-GCP](https://github.com/zsiki/Find-GCP)** is a Python tool leveraging the OpenCV library, designed to detect ArUco Ground Control Points in imagery and generate the corresponding GCP file required for photogrammetric programs such as Open Drone Map. The GitHub repo contains a few small utilities useful in Land Surveying Tasks: +Creating a Conda environment for geospatial analyses streamlines your workflow by isolating installations and dependencies specific to selected geospatial tools. This offers the advantage of consistency, compatibility and convenience, beneficial for both High-Performance Computing (HPC) and local machines. -* [aruco_make.py](https://github.com/zsiki/Find-GCP#aruco_makepy) - generates aruco marker images using different standard dictionaries -* [gcp_find.py](https://github.com/zsiki/Find-GCP#gcp_findpy) - identifies Ground Control Points (GCP) in imagery -* [gcp_check.py](https://github.com/zsiki/Find-GCP#gcp_checkpy) - helps the visual check of the found GCPs by `gcp_find.py` +Isolating installations and dependencies ensures that you can **effortlessly integrate ready-made packages and Python utilities**, such as those for marker detection in imagery for further analysis with ODM. With a **one-time setup of a unified "geospatial" environment**, you can seamlessly utilize a suite of tools from various GitHub repositories, significantly streamlining your daily tasks. -**INSTALLATION:** +*Give it a shot! It's an investment that pays off!* **A. On SCINet HPC: Atlas** (via ssh in CLI terminal or via OOD in JupyterLab Terminal app) 1. check available **conda** modules and load selected one: @@ -265,7 +263,57 @@ Expected format of the GCP_reference.txt is 4-columns: ArUco_ID x y z ``` pip install opencv-python opencv-contrib-python Pillow numpy matplotlib ``` - 5. clone the Find-GCP repo from GitHub: + This command installs a foundational set of dependencies crucial for the Python utilities detailed below (sourced from GitHub repos). With these dependencies in place and the environment activated, these tools are set to operate immediately post-cloning, eliminating the need of further setup.

+ In the future, if you seek to augment this environment with more packages, you can effortlessly do so at any point using either `conda install` or `pip install` commands. + + 5. deactivate this environment *(if you no longer intend to use it for this session)*: + ``` + conda deactivate + ``` + +**B. On your local machine (alternatively):**
+* If you already have the Conda environment manager installed, skip step 1 and proceed with the instructions outlined above. + * **NOTE:** On a local machine you will use `conda activate geospatial` instead of `source` command. + + +* For those unfamiliar with Conda, it's a valuable tool for computational tasks, and you can learn how to use it through the practical tutorials in the DataScience workbook: [Conda on Linux](https://datascience.101workbook.org/03-SetUpComputingMachine/03C-tutorial-installations-on-linux#conda), [Conda on macOS](https://datascience.101workbook.org/03-SetUpComputingMachine/03A-tutorial-installations-on-mac#-install-conda), [Python Setup on your computing machine](https://datascience.101workbook.org/04-DevelopmentEnvironment/02A-python-setup-locally#conda). + + +* If you choose not to use Conda, you can jump directly to step 4 in the guide, though this is not recommended because the necessary libraries will install system-wide, rather than in an isolated environment. + + + +## **geo_utils** python utility: installation + +**[geo_utils](https://github.com/ISUgenomics/geo_utils)** is an evolving collection of Python utilities tailored for geospatial analysis, developed at ISU as a part of the virtual research support for the USDA scientist. These utilities are designed to complement photogrammetry analysis using ODM software, enhancing the robustness of processing pipelines especially when calculations are executed on an HPC cluster. The GitHub repo contains a few small utilities useful in Land Surveying Tasks: + +* [gcp_to_aruco_mapper.py](https://github.com/ISUgenomics/geo_utils/tree/main#gcp-to-aruco-mapper) - maps custom GCP IDs to corresponding ArUco marker IDs in imagery based on the distance between GCP coordinates and image GPS + +* [gcp_images_picker.py](https://github.com/ISUgenomics/geo_utils/tree/main#gcp-images-picker) - automatically selects the representative images for each GCP, minimizing manual inspection + + + +## **Find-GCP** python utility: installation + +**[Find-GCP](https://github.com/zsiki/Find-GCP)** is a Python tool leveraging the OpenCV library, designed to detect ArUco Ground Control Points in imagery and generate the corresponding GCP file required for photogrammetric programs such as Open Drone Map. The GitHub repo contains a few small utilities useful in Land Surveying Tasks: + +* [aruco_make.py](https://github.com/zsiki/Find-GCP#aruco_makepy) - generates aruco marker images using different standard dictionaries +* [gcp_find.py](https://github.com/zsiki/Find-GCP#gcp_findpy) - identifies Ground Control Points (GCP) in imagery +* [gcp_check.py](https://github.com/zsiki/Find-GCP#gcp_checkpy) - helps the visual check of the found GCPs by `gcp_find.py` + +**INSTALLATION:** + +**A. On SCINet HPC: Atlas** (via ssh in CLI terminal or via OOD in JupyterLab Terminal app) + 1. check available **conda** modules and load selected one: + ``` + module avail conda + module load miniconda/4.12.0 + ``` + 2. activate your `geospatial` environment: + ``` + source activate geospatial + ``` + 3. clone the Find-GCP repo from GitHub: ``` git clone https://github.com/zsiki/Find-GCP.git ``` @@ -274,15 +322,16 @@ Expected format of the GCP_reference.txt is 4-columns: ArUco_ID x y z cd Find-GCP ls ``` - ![find_gcp_repo](../assets/images/find_gcp_repo.png) -**B. On your local machine (alternatively):**
-* If you already have the Conda environment manager installed, skip step 1 and proceed with the instructions outlined above. -* For those unfamiliar with Conda, it's a valuable tool for computational tasks, and you can learn how to use it through the practical tutorials in the DataScience workbook: [Conda on Linux](https://datascience.101workbook.org/03-SetUpComputingMachine/03C-tutorial-installations-on-linux#conda), [Conda on macOS](https://datascience.101workbook.org/03-SetUpComputingMachine/03A-tutorial-installations-on-mac#-install-conda), [Python Setup on your computing machine](https://datascience.101workbook.org/04-DevelopmentEnvironment/02A-python-setup-locally#conda). -* If you choose not to use Conda, you can jump directly to step 4 in the guide, though this is not recommended because the necessary libraries will install system-wide, rather than in an isolated environment. + 4. install required libraries: + ``` + pip install opencv-python opencv-contrib-python Pillow numpy matplotlib + ``` + + -## Automatic generation of ArUco codes +## **Automatic generation of ArUco codes** *ArUco markers provide known reference points in the imagery, enhancing the accuracy of photogrammetric analysis. This ensures that data derived from the imagery correctly corresponds to actual locations on the ground.* @@ -409,7 +458,7 @@ Finally, you can use the free online
ArUco markers generator: