User Tools

Site Tools


latinet:unicaes:opendronemap:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
latinet:unicaes:opendronemap:start [2023/08/24 23:11] jan.sonntaglatinet:unicaes:opendronemap:start [2023/08/25 02:10] jan.sonntag
Line 1: Line 1:
-OpenDroneMap+====== OpenDroneMap ======
  
-  - Docker and Docker Compose+On this page, we are explaining and documenting the installation and usage of OpenDroneMap (ODM) on a Google Cloud Machine. 
 +The source code of ODM can be found in this GitHub Repo: [[https://github.com/OpenDroneMap/WebODM|GitHub OpenDroneMap]]
  
-Create docker network:+===== Installation ===== 
 +We are installing ODM on Google Machine which is provided by the UNICAES. It is only turned on when needed.
  
 +As some prerequisites: We also configured a DNS entry to point to the static external IP of our Google Cloud Machine, so that we can get an SSL certificate for secure communications. The machine itself has 16 cores and 128GB of RAM with an additional 500GB of persistent storage.
 +
 +==== Install Docker and Docker Compose ====
 +
 +We followed the official documentation:
 +[[https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository|Docker install - Using the repository]]
 +
 +==== Getting WebODM ====
 +
 +Download the git repository:
 <code> <code>
-docker network create nginx-network+git clone https://github.com/OpenDroneMap/WebODM --config core.autocrlf=input --depth 1 
 +cd WebODM
 </code> </code>
  
-<file yml docker-compose.yml> +Then WebODM can be started with the following: 
-version: "3"+<code> 
 +./webodm.sh restart --ssl --hostname webodm.myorg.com 
 +</code>
  
-services: +===== Preparing Drone Images from DJI Mavic 3 Multispectral =====
-  app: +
-    image: 'jc21/nginx-proxy-manager:latest' +
-    container_name: nginx-proxy-manager +
-    restart: always +
-    ports: +
-      # These ports are in format <host-port>:<container-port> +
-      - '80:80' # Public HTTP Port +
-      - '443:443' # Public HTTPS Port +
-      - '81:81' # Admin Web Port +
-      # Add any other Stream port you want to expose +
-      # - '21:21' # FTP+
  
-    # Uncomment the next line if you uncomment anything in the section +After taking the photos with the DJI M3M we need to do some postprocessing to be able to use them in ODM. Therefore it is necessary to split the multispectral from the plain RGB images. Also, the timestamps of the photos need to be matched just in case and the names need to be slightly modified as there were some hick ups in ODM from time to time. 
-    # environment: +We already prepared a script for that: 
-      # Uncomment this if you want to change the location of  +<file sh correct_filenames.sh> 
-      # the SQLite DB file within the container +#!/bin/bash
-      # DB_SQLITE_FILE"/data/database.sqlite"+
  
-      Uncomment this if IPv6 is not enabled on your host +Process images in the specified directory 
-      # DISABLE_IPV6: 'true'+process_images() { 
 +    local target_dir="$1" 
 +     
 +    mkdir "${target_dir}/RGB" 
 +    mkdir "${target_dir}/MS"
  
-    volumes: +    echo "Processing images in$target_dir" 
-      # Make sure this config.json file exists as per instructions above: +     
-      - ./config.json:/app/config/production.json +    for first_image in $(ls "$target_dir" | grep -'DJI_[0-9]{14}_[0-9]{4}_D\.JPG'); do 
-      - data:/data +        echo "Found first image$first_image" 
-      - letsencrypt:/etc/letsencrypt +         
-    networks: +        timestamp=$(echo "$first_image" | sed -E 's/DJI_([0-9]{14})_[0-9]{4}_D\.JPG/\1/') 
-      - nginx-proxy +        echo "Extracted timestamp$timestamp"
-    depends_on: +
-      db-nginx +
-  db-nginx: +
-    image: 'jc21/mariadb-aria:latest' +
-    container_name: nginx-proxy-manager-db +
-    restart: always +
-    environment: +
-      MYSQL_ROOT_PASSWORD: 'npm+
-      MYSQL_DATABASE'npm' +
-      MYSQL_USER: 'npm' +
-      MYSQL_PASSWORD: 'npm' +
-    volumes: +
-      mysql:/var/lib/mysql +
-    networks: +
-      - nginx-proxy +
-volumes: +
-  mysql: +
-  data: +
-  letsencrypt:+
  
-Connect to existing nginx-network: `docker network create nginx-network` +        Extract the number (XXXX) from the first image filename 
-networks: +        number=$(echo "$first_image" | sed -E 's/DJI_[0-9]{14}_([0-9]{4})_D\.JPG/\1/') 
-  nginx-proxy: +        echo "Extracted number$number"
-    externaltrue +
-    name: nginx-network +
-</file> +
-<code> +
-docker compose up -d +
-</code>+
  
 + mv "$target_dir/$first_image" "$target_dir/RGB/DJI-${timestamp}-${number}_D.JPG"
  
-Just in case:+        for ext in "MS_G" "MS_NIR" "MS_R" "MS_RE"; do 
 +            echo "Searching for matching ${ext}.TIF files with number$number" 
 +             
 +            image_to_rename=$(ls "$target_dir" | grep -E "DJI_[0-9]{14}_${number}_${ext}\.TIF" | head -n 1) 
 +             
 +            if [ -n "$image_to_rename" ]; then 
 + new_ext=$(echo "${ext}" | sed 's/_//'
 +                new_name="DJI-${timestamp}-${number}_${new_ext}.TIF" 
 +                echo "Renaming $target_dir/$image_to_rename to $target_dir/$new_name" 
 +                mv "$target_dir/$image_to_rename" "$target_dir/MS/$new_name" 
 +            else 
 +                echo "No matching ${ext}.TIF files found for number: $number" 
 +            fi 
 +        done 
 +    done 
 +}
  
-<file json config.json> +# Check if an argument is provided 
-+if [ $# -ne 1 ]; then 
-  "database": { +    echo "Usage$0 <folder_path>
-    "engine": "mysql", +    exit 1 
-    "host": "nginx-proxy-manager-db", +fi 
-    "name": "npm", + 
-    "user": "npm", +# Call the function to process images 
-    "password": "npm", +process_images "$1"
-    "port": 3306 +
- }+
 </file> </file>
  
 +Just save this file somewhere you will be able to find it later as well.
  
-  - NGINX Manager +We are running this script on Ubuntu. Do make it executable Don´t forget to: 
-  - OpenDroneMap+<code> 
 +sudo chmod +x ./correct_filenames.sh 
 +</code>
  
-[[https://github.com/OpenDroneMap/WebODM/#getting-started|GitHub OpenDroneMap]]+You can then execute the script by giving the folder with pictures inside as an argument. Example: 
 +<code> 
 +./correct_filenames.sh ./pictures 
 +</code>