# MatchGeo Annotation Protocol # Local Feature Matching Keypoint Annotation on Digital Elevation Models > **Version**: 1.1 > **Date**: 2026-07-24 > **Authors**: Sabrina Correa (UFV) > **Dataset**: MatchGeo DEM v1.1 (DOI: 10.5281/zenodo.21229785) > **Standard**: Aligned with OGC TrainingDML-AI (23-008r3 / 24-006r1) > **License**: CC BY 4.0 --- ## Table of Contents 1. [Purpose and Scope](#1-purpose-and-scope) 2. [Prerequisites](#2-prerequisites) 3. [Annotation Class](#3-annotation-class) 4. [Annotation Workflow](#4-annotation-workflow) 5. [Annotation Rules](#5-annotation-rules) 6. [Quality Control](#6-quality-control) 7. [File Format and Metadata](#7-file-format-and-metadata) 8. [Common Pitfalls and Edge Cases](#8-common-pitfalls-and-edge-cases) 9. [Appendix A: Visual Example](#appendix-a-visual-example) 10. [Appendix B: Glossary](#appendix-b-glossary) --- ## 1. Purpose and Scope ### 1.1 Objective This protocol defines the procedure for annotating salient elevation keypoints on 256x256 pixel Digital Elevation Model (DEM) tiles. The annotated keypoints serve as ground truth for training and evaluating **local feature matching algorithms** — computer vision methods that detect and describe distinctive points in images (or elevation surfaces) to establish correspondences across different views, scales, or domains. ### 1.2 What to Annotate Annotators must identify **morphologically salient points** on the DEM surface that would be reliably detected by feature descriptors such as SIFT, SURF, ORB, or learned descriptors (e.g., SuperPoint, R2D2). These points must be: - **Locally distinctive**: The point must stand out from its immediate neighborhood. - **Geometrically stable**: The point must remain detectable under moderate changes in resolution, noise, or viewing angle. - **Repeatable**: The point should be identifiable by another annotator (or the same annotator on a different day) with high spatial consistency. In **urban areas** (e.g., São Paulo, Bonn), the primary salient features are **building corners** — the intersection points of building roof edges where elevation changes abruptly. ### 1.3 What NOT to Annotate Do **not** annotate: - Points in flat or uniformly sloped areas with no local distinctiveness. - Points at tile boundaries (within 5 pixels of the edge). - Points in areas with obvious data artifacts (striping, voids, interpolation errors). - Points in water bodies (lakes, rivers) unless the shoreline intersection is clearly salient. - Points on roads, sidewalks, or other flat man-made surfaces unless they form a clear corner or edge intersection. - **Points where the annotator is not fully confident about the salience.** ### 1.4 Scope of Application This protocol applies, but not limited to: - **GER_BN** (Bonn, Germany) — primary annotated city - **BRA_SP** (São Paulo, Brazil) — secondary annotated city - Any future cities added to the MatchGeo dataset with manual annotations --- ## 2. Prerequisites ### 2.1 Required Software - **QGIS** ≥ 3.28 (Long Term Release) - **Python** ≥ 3.9 with `geopandas`, `rasterio`, `shapely` ### 2.2 Required Data For each tile to annotate: | File | Purpose | |---|---| | `{CITY_CODE}_{row}_{col}.tif` | 256x256 pixel DEM tile (Float32, NoData=-9999) | ### 2.3 Annotator Qualifications Annotators should have: - Basic familiarity with DEM visualization techniques (hillshade, slope). - Experience with QGIS or equivalent GIS software. - Understanding of what makes a point "salient" for computer vision feature detectors. --- ## 3. Annotation Class All annotated keypoints belong to a **single class**: ### `general_interest_point` — Salient Elevation Keypoint > **Definition**: A point on the DEM surface that is locally distinctive and suitable for local feature matching. In urban areas, this is typically a **building corner** (the intersection of roof edges). In natural terrain, this is any point with high local curvature or distinctiveness that would produce a strong response from a feature detector. **Rationale for single class**: The MatchGeo dataset is designed for **local feature matching**, not semantic segmentation or landform classification. The task requires correspondences between geometrically similar points, not semantic labels. A single class simplifies annotation while preserving the geometric information needed for feature matching research. --- ## 4. Annotation Workflow ### 4.1 Pre-Annotation Setup 1. **Load the tile** in QGIS. 2. **Verify CRS**: Ensure the project CRS matches the tile CRS (e.g., `EPSG:25832` for Bonn, `EPSG:31983` for São Paulo). 3. **Chenge visualization to hillshade** as a visual reference (optional but strongly recommended). 4. **Set zoom level**: Work at a scale where individual pixels are visible but the full tile context is retained. 5. **Check for artifacts**: Scan the tile for data quality issues (voids, striping, noise). Skip tiles with >20% artifact coverage. ### 4.2 Annotation Procedure For each tile, follow this sequence: #### Step 1: Global Scan - Pan across the entire tile at moderate zoom. - Identify the dominant features: buildings, vegetation, roads, natural terrain. - Note any artifact regions to avoid. #### Step 2: Systematic Pass - Scan the tile in a systematic pattern (left-to-right, top-to-bottom). - For each candidate point, ask: **"Would a feature detector (SIFT, Harris, SuperPoint) reliably find this point?"** - Place the keypoint at the **precise pixel** of maximum distinctiveness. - **Only annotate if you are fully confident** in the point's salience. When in doubt, skip. #### Step 3: Verification Pass - Toggle hillshade on/off to verify distinctiveness. - Check that no keypoints are within **5 pixels** of the tile edge. - Verify that keypoints are not clustered — minimum spacing of **5 pixels** between any two keypoints. - Review each point: **"If I saw this tile again tomorrow, would I place the point at the same pixel?"** #### Step 4: Save - Save the QGIS project with the annotation shapefile layer. - Export the annotation layer as a **shapefile** or **GeoPackage**. ### 4.3 Post-Processing After annotation, run the MatchGeo conversion script to transform the shapefile into the standardized JSON annotation format. The conversion file is in: ``` scripts/convert_shp2anno.py ``` The script will: 1. Read the shapefile points. 2. Convert geographic coordinates to pixel coordinates (0–255). 3. Extract elevation values from the DEM tile. 4. Generate the TDML-compliant JSON file. --- ## 5. Annotation Rules ### 5.1 Minimum Feature Distinctiveness All annotated features must be resolvable at the tile resolution. The point must have: - **Local curvature**: The point must be a local extremum (maximum or minimum) in at least one direction, OR a point of high curvature (corner, junction). - **Minimum neighborhood**: The distinctiveness must be visible in a 5×5 pixel neighborhood. - **No ambiguity**: The point must have a single, clear location. If the "best" pixel is ambiguous across a 3×3 region, do not annotate. ### 5.2 Edge Proximity - **Default**: No keypoints within 5 pixels of the tile boundary. - **Hard limit**: Never annotate within 2 pixels of the boundary. - **Rationale**: Points near boundaries may be truncated or padded differently during model training, leading to inconsistent feature descriptors. ### 5.3 Spacing - Minimum distance between any two keypoints: **5 pixels**. - **Rationale**: Feature descriptors typically operate on patches of 8×8 to 32×32 pixels. Points closer than 5 pixels would have overlapping descriptor windows, reducing independence. ### 5.4 Urban Areas: Building Corners In urban DEMs (Bonn, São Paulo), the vast majority of salient points are **building corners**: - **What is a building corner?** The intersection of two roof edges, where the elevation surface changes direction abruptly. - **How to identify**: On hillshade, building corners appear as sharp, dark-light transitions at the intersection of two edges. - **Placement**: Place the point at the **intersection pixel** — the exact corner where the two edges meet. - **Avoid**: Points along straight roof edges (not corners), points on flat roof surfaces, points on building shadows (unless the shadow edge coincides with a real corner). ### 5.5 Natural Terrain In natural terrain (if annotated in future cities), salient points include: - **Peaks and summits**: Local maxima with clear prominence. - **Saddles and cols**: Local minima along ridge lines. - **Ridge/valley junctions**: Confluences of multiple ridge or valley lines. - **Cliff corners**: Abrupt changes in slope direction. When in doubt, apply the **feature detector test**: *"Would I select this point tomorrow?"* ### 5.6 Multi-Scale Considerations Annotators should consider how the feature would appear at different resolutions: - A feature visible at 1.0 m resolution should still be detectable (though blurred) at 2.0 m. - Do not annotate features that are **resolution-dependent artifacts** (e.g., single-pixel noise spikes). - When in doubt, check the source data quality or hillshade at multiple sun angles. --- ## 6. Quality Control ### 6.1 Self-Review Checklist Before submitting annotations, the annotator must complete this checklist: - [ ] All keypoints are within the valid tile area (≥5 px from edge). - [ ] No two keypoints are within 5 pixels of each other. - [ ] All keypoints are on clearly salient features (building corners or natural morphological features). - [ ] No keypoints are in obvious artifact areas (voids, striping). - [ ] All keypoints would be repeatable by the same annotator on a different day. - [ ] The annotation shapefile has been exported and converted to JSON. - [ ] The JSON file validates against the MatchGeo Annotation Schema. ### 6.2 Confidence Policy All annotated keypoints are assumed to have **high confidence** (≥0.8). The annotator is instructed to: - **Only annotate points they are fully confident about.** - **Skip ambiguous points.** It is better to have fewer, high-quality annotations than many uncertain ones. - **Do not guess.** If a point might be salient but the annotator is not sure, skip it. For retroactive application to existing annotations (GER_BN, BRA_SP), all keypoints are assigned a default confidence of **0.8**. --- ## 7. File Format and Metadata ### 7.1 QGIS Annotation Layer During annotation, points are stored in a QGIS vector layer (shapefile or GeoPackage): | Field | Type | Description | |---|---|---| | `id` | Integer | Unique keypoint ID within the tile | | `class` | String | Fixed `"general_interest_point"` | | `confidence` | Float | Annotator confidence (0.0–1.0); default 0.8 | ### 7.2 Annotation File Naming ``` {CITY_CODE}_{row}_{col}_annotation.json Example: GER_BN_001_012_annotation.json ``` ### 7.3 JSON Structure Each annotation file conforms to the MatchGeo Keypoint Annotation Schema: ```json { "type": "AI_ObjectLabel", "id": "GER_BN_001_012_annotation", "tileId": "GER_BN_001_012", "cityCode": "GER_BN", "crs": "EPSG:25832", "resolution": 1.0, "tileExtent": { "westBound": 369500.0, "eastBound": 369833.0, "southBound": 5621500.0, "northBound": 5621833.0 }, "keypoints": [ { "id": "kp_001", "pixelX": 312, "pixelY": 282, "geoX": 369812.0, "geoY": 5621782.0, "class": "general_interest_point", "elevation": 158.4, "confidence": 0.8 } ], "labeling": { "labelingMethod": "manual", "annotatorId": "annotator_ufv_01", "annotationTime": "2025-11-14T14:32:00Z", "toolVersion": "qgis-shapefile-conversion", "labelingProtocol": "https://github.com/paeslemesa/matchgeodem/blob/main/docs/annotation_protocol.md" }, "quality": { "sourceDataQuality": "Airborne LiDAR, ground classified, vertical accuracy <0.15m RMSE" } } ``` ### 7.4 Required vs. Optional Fields | Field | Required | Description | |---|---|---| | `type` | ✅ | Fixed `"AI_ObjectLabel"` | | `id` | ✅ | Unique annotation file ID | | `tileId` | ✅ | Corresponding DEM tile ID | | `cityCode` | ✅ | City code (e.g., `"GER_BN"`, `"BRA_SP"`) | | `crs` | ✅ | EPSG code | | `resolution` | ✅ | GSD in meters | | `tileExtent` | ❌ | Bounding box in projected coords | | `keypoints` | ✅ | Array of keypoint objects | | `keypoints[].id` | ✅ | Unique keypoint ID | | `keypoints[].pixelX` | ✅ | X in pixel space (0–332) | | `keypoints[].pixelY` | ✅ | Y in pixel space (0–332) | | `keypoints[].geoX` | ❌ | X in projected CRS | | `keypoints[].geoY` | ❌ | Y in projected CRS | | `keypoints[].class` | ✅ | Fixed `"general_interest_point"` | | `keypoints[].elevation` | ✅ | Elevation at keypoint (m) | | `keypoints[].confidence` | ❌ | Annotator confidence (0–1); default 0.8 | | `labeling` | ✅ | Provenance object | | `labeling.labelingMethod` | ✅ | Fixed `"manual"` | | `labeling.annotatorId` | ✅ | Anonymous annotator ID | | `labeling.annotationTime` | ✅ | ISO 8601 timestamp | | `labeling.toolVersion` | ❌ | `"qgis-shapefile-conversion"` | | `labeling.labelingProtocol` | ❌ | URL to this protocol | | `quality` | ❌ | Quality metrics object | --- ## 8. Common Pitfalls and Edge Cases ### 8.1 Building Corners vs. Roof Edges **Problem**: A long, straight roof edge has many points that look somewhat distinctive. **Solution**: Only annotate **corners** — points where two edges intersect. A point along a straight edge is not locally distinctive in all directions and would not produce a strong corner detector response. ### 8.2 Flat Roofs **Problem**: Large flat-roofed buildings have no corners visible in the DEM. **Solution**: Do not annotate flat roof surfaces. If the building has a parapet or edge wall that creates a corner, annotate that corner. ### 8.3 Vegetation **Problem**: Trees and vegetation create noisy, irregular elevation surfaces. **Solution**: In urban areas, focus on building corners. In natural terrain, avoid annotating on dense vegetation unless a clear morphological feature (e.g., a forest clearing corner) is visible. ### 8.4 Data Artifacts **Problem**: Striping, voids, or interpolation artifacts create spurious elevation features. **Solution**: - Learn to recognize common artifacts: - **Striping**: Parallel lines of alternating high/low elevation (common in satellite DEMs). - **Voids**: Areas with NoData (-9999) or interpolated fill values. - **Noise**: Single-pixel spikes or pits with no surrounding morphological context. - Cross-reference with hillshade. - Skip artifact-affected tiles if >20% of the tile is affected. ### 8.5 Partial Tiles **Problem**: Tiles at the city boundary may be partially empty (NoData). **Solution**: Annotate only the valid data region. Ensure all keypoints are on valid elevation pixels (not NoData). ### 8.6 Multi-Story Buildings **Problem**: Buildings of different heights create complex roof patterns. **Solution**: Annotate the corners of the **roof footprint** — the outermost edges visible in the DEM. Internal roof structures (skylights, HVAC units) are typically too small to be reliable at 1.0 m resolution. --- *Protocol version 1.1 — MatchGeo DEM Annotation. For questions, contact sabrina.correa@ufv.br*