Animated Territorial Data Extractor (ATDE)
- ATDE is an end-to-end computer vision pipeline that quantitatively extracts territorial control data from animated historical map videos using HSV-based segmentation and temporal alignment.
- The system refines territorial masks with Direct-Neighbor Filtering and normalization routines, achieving over 95% pixel-level accuracy in suitable conditions.
- It processes videos rapidly for educational demos and comparative analyses, and can integrate with photogrammetric methods to enhance geospatial data extraction.
The Animated Territorial Data Extractor (ATDE) is an end-to-end computer vision pipeline designed for quantitative extraction of territorial control data from rasterized animated historical map videos. ATDE operates without the need for pre-existing GIS shapefiles and is suitable for educational demonstrations, preliminary territorial dynamic analysis, and comparative studies using time-series pixel-count data. Its key innovations include HSV-based color segmentation, adaptive temporal alignment, Direct-Neighbor Filtering (DNF) for local connectivity, and normalization routines for cross-video quantitative comparison. The approach is exemplified by large-scale analyses of Chinese dynastic history, producing year-by-year pixel counts of controlled territory from popular map animations (Alshamy et al., 22 Nov 2025). Related frameworks in photogrammetric segmentation augment ATDE’s potential for heterogeneous simulation data extraction and semantic mapping (Chen et al., 2020).
1. System Architecture and Workflow
ATDE operates as a linear pipeline comprised of three major modules:
- Video Pre-processing: Ingests raw MP4 animations, applies spatial cropping (eliminating legends and labels), and computes a temporal alignment mapping such that each output frame uniquely represents a specific calendar year. This is achieved via “delta encoding” and frame clock analysis, yielding a monotonic, year-indexed sequence of frames (Alshamy et al., 22 Nov 2025).
- Color-Based Territory Extraction: Processes each temporally aligned frame. RGB images are converted to HSV (hue-saturation-value) space; seed colors are thresholded to generate binary territorial masks. Optionally, RGB-channel filtering distinguishes similar hues. DNF further refines masks by enforcing neighbor support.
- Time-Series Assembly and Normalization: Aggregates per-frame pixel counts into , applies cross-video scale normalization using invariant water features, and outputs plots and normalized datasets for downstream analysis and visualization.
2. Pre-processing: Temporal and Spatial Alignment
Temporal alignment in ATDE exploits recurrent digit changes in a designated “clock region” of each frame. The frame-to-frame change score,
quantifies pixel-wise changes. Threshold (e.g., ) identifies change points corresponding to year increments, ensuring exactly one representative frame per year. Cross-video scale normalization addresses inconsistent zoom or crop between videos by computing the scale factor
where is the water pixel count in a user-defined bounding box for dynasty , and the reference dynasty. Territorial pixel counts are normalized by . This procedure aligns extracted trajectories for comparative cross-dynasty analyses (Alshamy et al., 22 Nov 2025).
3. Color Segmentation and RGB Channel Filtering
Territorial pixel extraction proceeds by HSV color segmentation. Given RGB seed colors for each dynasty, conversion to HSV yields . For each seed, bounds are defined by configurable hyperparameters:
- Hue tolerance:
- Saturation:
- Value:
A pixel with matches if
for any . Multiple territorial hues are combined with cv2.inRange and bitwise OR operations. When needed, RGB-channel restrictions (e.g., ) further differentiate territorial colors from visually similar ocean or background pixels (Alshamy et al., 22 Nov 2025).
4. Direct-Neighbor Filtering (DNF) and Mask Refinement
Post-segmentation, DNF suppresses isolated and noisy pixels by enforcing local connectivity. For each pixel in the binary mask , the number of contiguous “territorial” neighbors (using a kernel: ) is computed. Filtering is applied as follows:
where denotes the eight immediate neighbors and is the minimum required (default ) (Alshamy et al., 22 Nov 2025).
5. Time-Series Pixel Count Aggregation and Comparative Analysis
For each year-indexed frame, ATDE computes the aggregate territorial pixel count via
scaled and normalized for cross-video comparison: $p'_y = \frac{p_y}{\sigma_d}, \quad p_{\max} = \max_{d, y} p'_y^{(d)}$ Producing final trajectories: These curves enable analysis of territorial evolution, expansion, contraction, and inter-dynasty comparative dynamics. Year-by-year results align with established historical periodizations, as demonstrated for ten major Chinese dynasties (Alshamy et al., 22 Nov 2025).
6. Accuracy, Limitations, and Application Scope
On animations with consistent flat coloring and minimal artifacts, the pipeline achieves >95% pixel-level correspondence with manual annotations. Principal error sources include inaccuracies in visual boundaries within source videos, hue overlap and compression artifacts, and sensitivity to the temporal change threshold . ATDE processes a 1920×1080, 1000-frame video in under five minutes on commodity CPUs. It is unsuitable for animations with overlapping territories, gradient fills, dynamic legends, or cases demanding precise GIS area estimates. The pipeline’s output supports rapid exploration, comparative studies, and pedagogical utility, but is not a replacement for authoritative geospatial datasets (Alshamy et al., 22 Nov 2025).
7. Extensions, Related Methods, and Integration Prospects
ATDE’s methodology can be augmented with photogrammetric and semantic segmentation frameworks to broaden its applicability. Chen et al. (Chen et al., 2020) provide a pipeline involving U-Net voxel segmentation, multi-class semantic labeling, and integration with simulation engines. Techniques such as region growing, graph-cut energy minimization, and GPU-accelerated inference may be adapted for real-time or large-scale ATDE deployments. Cross-referencing extracted territorial pixel masks with geo-typical object databases or integrating output as WMS/WFS spatial layers are plausible extensions. The systematic normalization and mask refinement procedures of ATDE establish a reproducible paradigm for extracting dynamic territorial datasets, which could be synchronized with semantic terrain data for distributed simulation or GIS/CBR frameworks—a plausible implication is enhanced interoperability between animated historic visualizations and modern geospatial analysis pipelines (Alshamy et al., 22 Nov 2025, Chen et al., 2020).