A Case Study on SAM-Based Classification of Algal Blooms in Taihu Lake
Background Introduction
Satellite remote sensing technology plays an important role in monitoring water quality in inland water bodies.Wide-ranging, relatively fast, low-costThe inversion of key water quality parameters is possible. However, inland water quality monitoring also places high demands on satellite remote sensing technology: small water bodies require high spatial resolution; rapidly changing water quality requires high temporal resolution; and complex and variable optical properties of water bodies require high spectral resolution. Therefore, satellite data that simultaneously meets high spatial, high temporal, and high spectral resolution has significant advantages in inland water monitoring.
Spectral Angle Mapper (SAM) is a physics-based spectral classification method that uses n-dimensional angles to match pixels with reference spectra. The algorithm determines spectral similarity between two spectra by calculating the angles between them and treating them as vectors in a space with a dimension equal to the number of bands. The endmember spectra used by SAM can come from ASCII files or spectral libraries, or endmembers can be directly extracted from the image (as the average spectrum of the region of interest). The smaller the angle, the more likely they belong to the same category. It is a supervised classification method widely used in hyperspectral remote sensing.
Methods and Principles
This case study uses hyperspectral images of the Taihu Lake region taken by Xiguang-1 05 satellite (Tianxianpei) on June 18, 2025, to conduct SAM classification, and analyzes the spatial distribution of algal blooms based on the classification results.

Table 1. Data Introduction
The specific operating procedure is as follows:
1. Data Preprocessing
(1) Radiation calibration:For the original DN value data, radiometric correction is performed using the radiometric calibration coefficients provided by radiance to obtain the apparent radiance data. This can be done using the Radiometric Calibration tool in ENVI.
(2) Atmospheric correction:Atmospheric correction is performed using atmospheric correction tools based on 6S or MODTRAN models to obtain surface reflectance data, such as the FLAASH atmospheric correction tool in ENVI.
(3) Spectral smoothing:In ENVI, the Savitzky-Golay (SG) algorithm is used to smooth the surface reflectance data, which reduces spectral noise and improves the reliability of subsequent classification. You can use the Savitzky-Golay Filter extension tool in the App Store of ENVI or the built-in THOR Spectral Smoothing tool.
(4) Image registration (optional):After processing, perform georeferencing on the base map. This georeferencing can be done in ENVI, QGIS, or ArcGIS. Google Imagery is recommended as the reference map.
(5) Water body mask:By calculating the normalized water index from the surface reflectance, and selecting an appropriate threshold based on the histogram of the calculation results, the Taihu Lake region is extracted.
(6) ROI sample selection:Click on the surface reflectance data, use the ROI selection tool to select an appropriate amount of water body and algal bloom sample data, and summarize and statistically view the spectral curves. Use the Option->Compute ROI Separability function to calculate the Jeffries-Matusita and Transformed Divergence parameters. A parameter value greater than 1.9 indicates good sample separability; a value less than 1.8 requires reselecting samples.
(7) Spectral angle SAM matching:Select the Spectral Angle Mapper Classification tool:
(a) Filtered surface reflectance data of Taihu Lake was selected as input data, and NDWI binarization results were selected as mask data to eliminate images of non-water bodies.

NDWI mask
(b) Select the samples to be classified, click Apply to enter the parameter settings panel, and set the spectral angle threshold (default is 0.1 radians). A larger threshold results in a wider classification range; a smaller threshold results in higher classification accuracy.
Set Maximum Angle: Sets the maximum spectral angle threshold (0~1.0), in radians. You can set a single threshold or set individual thresholds for each category.
Output Rule Images: Whether to output a rule file. The rule file is an image file generated with spectral angles as pixel values. Choosing to output it can be used for classification by density segmentation, or it can be used as a reference for obtaining a threshold.
1. Spectral index calculation
(1) I AM
Water body extent was extracted using the spectral index method. Specifically, the Normalized Difference Water Index (NDWI) was calculated based on the surface reflectance image processed by FLASH. Then, based on the histogram of the NDWI image, a threshold was set to complete the water body extraction. The calculation formula is as follows:

The water mask of Taihu Lake was extracted by calculating NDWI and used for subsequent classification operations.
Results Display

Figure 1 True-color composite imageXiguang No. 1 05 (A Perfect Match) 20250618
Comparison of spectral curves in the Taihu Lake region before and after SG filtering (reflectivity increased by 10,000 times, Xiguang-1 05 satellite (Tianxianpei), 20250406)


Figure 2 Comparison of spectral curves before and after SG filtering
The following results were obtained from the water body extraction and index calculation performed on the XG05 data:

Figure 3 Distribution map of SAM algal bloom Xiguang No. 1 05 (A Perfect Match) 20250618
The above results show that algal blooms are severe in the western Taihu Lake area, with higher chlorophyll a concentrations near the blooms. This is because the western part of Taihu Lake is where rivers flow into the lake, bringing in large amounts of nutrients, leading to vigorous algal growth and thus causing cyanobacterial blooms and increased chlorophyll a concentrations. The central and eastern Taihu Lake areas are less affected, resulting in better water quality than the western Taihu Lake. Aquatic plants grow in the eastern part of the lake, and the chlorophyll a concentration is lower. The central lake area is a large-scale algal bloom distribution area, and once an algal bloom occurs in the central lake area in summer, it covers a large area. In contrast, algal blooms rarely occur in the southwestern lake area, and almost no algal blooms occur in the eastern Taihu Lake area, indicating that the environment in the eastern Taihu Lake area is better.
By setting different spectral angle threshold parameters, SAM is highly sensitive to parameters, resulting in noise amplification and angle distortion in the band. At the same time, systematic bias occurs when pure endmembers are difficult to obtain or the threshold is set improperly, ultimately causing "salt and pepper" misclassification and large-scale missed detection. In the future, it can be coupled with methods such as dimensionality reduction, spatial constraints, and deep learning to significantly improve classification accuracy while maintaining physical interpretability.

