How ytkz11/aerialpicturecorrection works
Main Components
• Input Module: Represent the entry point where the UAV-acquired aerial images (and associated metadata like height, focal length, sensor pixel size) are received. Files like AerialCorrection.py and photo_point_location.py indicate that the project handles image input and geospatial data extraction.
• Preprocessing & Correction Pipeline:
• Image Expansion: A module that “expands” or pads the original image (with zero values) to prepare it for rotation.
• Rotation: A dedicated component that rotates the expanded image based on the yaw angle. The README explains that this is done to avoid information loss, which clarifies that implementation avoids a direct rotation of the original image.
• Cropping: Once rotated, only the useful parts of the image are retained by cropping out the padded regions.
• Geospatial Computation:
• Calculation of spatial resolution using the formula: spatial resolution = (pixel size x height)/focal length.
• Coordinate Conversion: Convert the meter-based resolution to degrees, then compute the upper-left corner’s longitude and latitude using the given formulas.
• Affine Transformation Module:
• TIF Synthesis Module:
• Leverage the GDAL library to combine the geospatial affine parameters with the processed image, thereby generating the final georeferenced TIF.
• Image Stitching (optional/additional): The UAV-Image-stitching directory contains multiple scripts (e.g., AutomaticPanoramicImageStitching.py, UAV-image-stitching.py) that appear designed to handle image stitching operations. This may either be a separate pipeline or integrated into the overall process for broad area coverage.
Relationships and Data Flow
• Flow starts with the Input Module feeding raw images and metadata into the preprocessing pipeline.
• The Preprocessing & Correction Pipeline flows sequentially: Image Expansion → Rotation (with emphasis on avoiding loss by using an expanded image) → Cropping.
• The output from the preprocessing phase is fed into the Geospatial Computation component where spatial resolution and coordinate conversion logic is applied.
• Next, the Affine Transformation Module uses geospatial info to compute parameters for TIF generation.
• Finally, the TIF Synthesis Module integrates the corrected image with its georeferencing data via GDAL to produce the final output.
• Optionally, the Image Stitching components may run in parallel or as a subsequent module to create larger composite images from multiple UAV shots.
Architectural Patterns and Important Design Principles
• Pipeline/Sequential Processing: Clearly show distinct sequential stages (expansion → rotation → cropping → geospatial computations → georeferencing) to reflect the step-by-step processing flow.
• Modular Design: Each processing stage can be represented as a separate module/component; this modularization aids in clarity, maintainability, and unit testing.
• Clear Separation of Concerns: Data input, image processing (including computer vision elements like homography and SIFT in the stitching scripts), geospatial computations, and GIS output are segregated.
Relevant Technologies and Frameworks
• OpenCV: Indicated by the image operations (expansion, rotation, cropping) and mentions within the README.
• GDAL: Used for creating the synthetized georeferenced TIF format images.
• Python: Entire project is implemented in Python, as suggested by the multiple .py files.
• (Possibly) Numpy: Likely used for numerical operations and pixel/array manipulations, indicated by files like two_npy_file_to_stitching.py.