Skip to content

A Python application for processing thermal images and data arrays. This tool allows you to load, visualize, crop, and save both regular images and thermal data arrays while preserving the original DN (Digital Number) values.

Notifications You must be signed in to change notification settings

deedeeharris/Image-Array-Cropper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thermal Image Processing Application

A Python application for processing thermal images and data arrays. This tool allows you to load, visualize, crop, and save both regular images and thermal data arrays while preserving the original DN (Digital Number) values.

Features

  • Multiple File Format Support:

    • Regular images (JPG, PNG, BMP, TIFF)
    • Thermal data arrays (tab-delimited TXT files)
    • Automatic format detection and appropriate handling
  • Visualization:

    • Interactive image display
    • Thermal data visualization using magma colormap
    • Real-time display of data statistics (min, max, mean values)
    • Automatic scaling for better visualization
  • Cropping Tools:

    • Polygon-based region selection
    • Interactive point placement
    • Reset capability for cropping area
  • Export Options:

    1. TIFF Format (Recommended)
      • Preserves original DN values with 32-bit float precision
      • Includes metadata
      • Industry standard for thermal/scientific imaging
    2. NumPy (.npy)
      • Full numerical precision
      • Efficient binary storage
      • Perfect for Python workflows
    3. Text (.txt)
      • Tab-delimited format
      • 6 decimal precision
      • Human-readable
      • Easy import into other software
  • Error Handling & Logging:

    • Comprehensive error messages
    • Detailed logging in app.log
    • Input validation
    • Error recovery options

Installation

  1. Create a virtual environment (recommended):

    python -m venv env_thermal
    source env_thermal/bin/activate  # On Linux/Mac
    env_thermal\Scripts\activate     # On Windows
  2. Install required packages:

    pip install -r requirements.txt

Usage

  1. Start the Application:

    python thermal_app.py
  2. Load Data:

    • Click "Open Image" to load either:
      • A regular image file
      • A thermal data array (.txt file)
  3. Crop Image:

    • Click points to create a polygon around your region of interest
    • Click "Crop" to crop the selected area
    • Click "Reset Polygon" to start over
  4. Save Results:

    • Click "Save Image" for regular images
    • Click "Export Array" for thermal data
    • Choose your preferred export format:
      • TIFF (recommended for preserving DN values)
      • NumPy (.npy)
      • Text (.txt)

File Format Specifications

Thermal Data Text Files

  • Tab-delimited values
  • 2D array format
  • Floating point numbers
  • No headers
  • Example:
    25.150  24.970  24.950
    24.100  24.030  24.010
    24.170  24.240  24.170
    

Error Handling

The application logs all operations and errors to app.log. Check this file if you encounter any issues.

Common error messages and solutions:

  • "Invalid array dimensions": Ensure your text file contains a proper 2D array
  • "Cannot identify image file": Check if your file format is supported
  • "Invalid polygon": Ensure you've created a valid closed polygon

Dependencies

  • numpy: Array operations
  • Pillow: Image processing
  • scipy: Array manipulation
  • matplotlib: Colormap visualization
  • tifffile: TIFF file support

Logging

All operations are logged to app.log with timestamps and detailed information. This includes:

  • File operations
  • Data processing steps
  • Error messages
  • Export operations

About

A Python application for processing thermal images and data arrays. This tool allows you to load, visualize, crop, and save both regular images and thermal data arrays while preserving the original DN (Digital Number) values.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages