A graphical user interface (GUI) application that analyzes TIFF images using PCA (Principal Component Analysis).
- TIFF Image Support: Load multi-band and single-band TIFF files
- PCA Analysis: Perform principal component analysis on image bands
- Visualization:
- Original image preview (RGB/grayscale)
- First principal component (PC1) map
- Value visualization with color scale
- Statistics Table: For each component:
- Explained variance (Eigenvalue)
- Variance ratio (%)
- Standard deviation
- Python 3.7+
- Virtual environment (recommended)
- Clone or download the project
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # Windows- Install required libraries:
pip install numpy scikit-learn pillow matplotlib tifffileStart the application:
python main.py- When the application opens, click the "Load TIFF Image" button
- Select a TIFF file (.tif or .tiff)
- PCA analysis is performed automatically
- Results are displayed visually and in a table:
- Left panel: Original image
- Right panel: PC1 component
- Bottom table: Statistics for each component
- TIFF (.tif, .tiff)
- Single-band (grayscale) images
- Multi-band (multi-band/hyperspectral) images
- Image is flattened (H×W×C → (H×W)×C)
- Maximum 10 components are calculated
- First component (highest variance) is visualized
- Statistics for all components are displayed in the table
- tkinter: GUI framework
- numpy: Numerical operations
- scikit-learn: PCA algorithm
- PIL/Pillow: Image processing
- matplotlib: Data visualization
- tifffile: Advanced TIFF file support
PCA/
├── main.py # Main application file
├── README.md # This file
└── venv/ # Virtual environment (optional)
This error may be caused by PIL's limitations with certain TIFF formats. The code automatically switches to using the tifffile library in such cases.
PCA provides limited information on single-band images. It is recommended to use multi-band images.
This project was developed for educational purposes.
You can open pull requests for suggestions and improvements.