README.md 1.87 KB
Newer Older
luroth's avatar
luroth committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## Data Preparation

Basic requirements are

- Agisoft project with **aligned cameras** and a generated **DEM** in workspace
- Plot polygon file as **geojson** with the attribute `plot_label`
- Both Agisoft project and geojson need to be in the same *metric* coordinate system

Sample Agisoft project:
![Agisoft project](doc/agisoft_project.png)

Sample geojson:
```python
{"type": "FeatureCollection", 
 "features": [{
    "type": "Feature", 
    "properties": {"plot_label": "FPWW0240067"}, 
    "geometry": {
      "type": "Polygon", 
      "coordinates": [
        [[2693786.207215171, 1256288.427557322], 
        [2693790.4785625925, 1256285.030282317], 
        [2693791.407652783, 1256286.1984147034], 
        [2693787.1363053625, 1256289.5956897107], 
        [2693786.207215171, 1256288.427557322]]]
        }
     }, 
  ...
  }

```
  


## Agisoft Metascan Preparation 
You need to add pandas and numpy to the Agisoft Python installation. To do so, run the following line 
in a windows comand window:

`"C:\Program Files\Agisoft\Metashape Pro\python\python.exe" -m pip install pandas==0.23 numpy`

## Generate image masks

1. Download 3. Select [Agisoft_standalone_project_points.py](Agisoft_standalone_project_points.py)
2. Open Agisoft Metascan
3. Select "Tools" -> "Run Script..." and run the downloaded script
4. The menu "ETHZ CS Plugin" appears.
5. Select "ETHZ CS Plugin" -> "Generate image masks"
6. Select the geojson file with the plot polygons that you prepared
7. Select an empty folder where the masks will be saved
8. Decide whether to use image coordinates (origin is in top left corner, usefull for processing in e.g. Python) or in bottom left corner (usefull for processing in GIS, e.g. QGIS)

If choosing reverse y coordinates, you may check the accuracy of the image mask in e.g. QGIS by drag-and-drop both origin image and generated plot mask:
![Maks](doc/mask_gis_style.png)