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.
-
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:
- TIFF Format (Recommended)
- Preserves original DN values with 32-bit float precision
- Includes metadata
- Industry standard for thermal/scientific imaging
- NumPy (.npy)
- Full numerical precision
- Efficient binary storage
- Perfect for Python workflows
- Text (.txt)
- Tab-delimited format
- 6 decimal precision
- Human-readable
- Easy import into other software
- TIFF Format (Recommended)
-
Error Handling & Logging:
- Comprehensive error messages
- Detailed logging in
app.log - Input validation
- Error recovery options
-
Create a virtual environment (recommended):
python -m venv env_thermal source env_thermal/bin/activate # On Linux/Mac env_thermal\Scripts\activate # On Windows
-
Install required packages:
pip install -r requirements.txt
-
Start the Application:
python thermal_app.py
-
Load Data:
- Click "Open Image" to load either:
- A regular image file
- A thermal data array (.txt file)
- Click "Open Image" to load either:
-
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
-
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)
- 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
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
- numpy: Array operations
- Pillow: Image processing
- scipy: Array manipulation
- matplotlib: Colormap visualization
- tifffile: TIFF file support
All operations are logged to app.log with timestamps and detailed information. This includes:
- File operations
- Data processing steps
- Error messages
- Export operations