This repository implements the RGB-Phasor framework, a simple and reproducible method to map RGB images into phasor space and extract meaningful spectral information from standard microscopy images.
Originally conceived for the upcoming RGB-Phasor paper, this project demonstrates how phasor analysis—traditionally used in hyperspectral imaging and FLIM—can be applied to standard RGB images for segmentation, unmixing, and quantitative analysis.
Phasor analysis transforms pixel intensities into a geometric representation in (G, S) Fourier space.
For RGB images, the three color channels are treated as a discrete spectrum, allowing:
- Spectral visualization
- Unsupervised segmentation via clustering
- Spectral unmixing from a single RGB snapshot
- Quantitative metrics (entropy, dispersion, histograms)
Example of the simulated RGB color wheel and its phasor map:
Simulated RGB color wheel → phasor transformation → cursor selection → clustering → spectral unmixing.
The framework was validated across three major microscopy modalities:
RGB autofluorescence images (nevus vs melanoma) show measurable spectral heterogeneity in phasor space.
RGB H&E images of lung tissue can be segmented in phasor space to quantify tissue/airspace structure.
Phasor-based unmixing separates overlapping fluorophores (e.g., DAPI, Laminin-488, NucRed) from a single RGB image.
Fluorescence unmixing example:
Fig. (A) Original RGB image of the sample. (B–D) Individual blue, green, and red channels extracted from the RGB image. (E) Histograms of pixel intensity distributions for each channel shown in (B–D). (F) Phasor plot of the RGB image, illustrating the distribution of pixels and the selected cursor positions used to define spectral regions. (G) Pseudocolor representation generated by assigning pixel clusters from the phasor plot in (F) to their corresponding regions in the image. The scale bar represents 50 um.
Fig. (A–C) Unmixed fractions for the blue, green, and red components. (D–F) Intensity maps of the unmixed blue, green, and red channels. (G) Original RGB image. (H) Reconstructed unmixed RGB image with a dashed white line indicating the region selected for intensity profiling. (I) Intensity profiles of the unmixed RGB channels along the line drawn in (H), showing the spatial distribution and relative overlap of the components. The scale bar represents 50 um.
├── src # Source code for the paper
└── tools.py # Core helper functions
└── tools4.py # Fluorescence-specific utilities
└── simulations.py # Simulations for the RGB Phasor method
└── part_brightfield.py # Brigh fields analysis with Phasors
└── autofluorescence.py # Autofluorescence analysis with phasors
└── part4.py # RGB Phasor unmixing with fluorescence
├── docs/ # Website + tutorials
│ └──tutorials # Tutorials for simulations and RGB Phasor Unmixing
- Load RGB images
- Convert RGB → BGR (phasor convention)
- Compute phasor coordinates (G, S) with
phasor_from_signal - Estimate pure components or use phasor cursors
- Apply:
- Clustering (k-means, GMM)
- Spectral unmixing (
phasor_component_fit)
- Visualize:
- Phasor histograms
- Fraction maps
- Pseudocolor segmentations
- Photon-based unmixed RGB images
Necessary dependencies:
numpy
matplotlib
scikit-image
scikit-learn
phasorpy
tifffileInstall requirements with:
pip install -r requirements.txt💡 Notes & Tips • Thresholds depend on illumination/staining; tune them for each dataset. • phasor_component_fit enables single-image spectral unmixing. • Extend the method with entropy, PCA, superpixels, or deep learning. • Web documentation will be published upon paper submission.
📄 License
MIT License
If you use this work, please cite:
Schuty, B., García, M. J., Khuon, S., & Malacrida, L. (2026).
Phasor analysis of RGB camera data enables fluorescence microscopy unmixing and brightfield segmentation in a commercial microscope.
Sensing and Bio-Sensing Research, 101014.
https://doi.org/10.1016/j.sbsr.2026.101014
Schuty, B., & Malacrida, L. (2026). RGB Phasors: Computational Framework for RGB-Based Phasor Analysis in Biomedical Imaging. Zenodo. https://doi.org/10.5281/zenodo.18635340

