-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaceScoreCalculation.py
More file actions
19 lines (13 loc) · 894 Bytes
/
Copy pathaceScoreCalculation.py
File metadata and controls
19 lines (13 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import numpy as np
#The Adaptive Cosine Estimator (ACE) algorithm is a popular method used in hyperspectral image processing for target detection.
#It determines the presence of a specific material within a hyperspectral image by calculating the normalized correlation between the spectrum of each pixel and a known target spectrum.
def aceScoreCalculation(spectrumValA1, spectrumValA2, spectrumValB1, spectrumValB2):
# Define the pixel spectrum and target spectrum
pixel_spectrum = np.array([spectrumValA1, spectrumValA2])
target_spectrum = np.array([spectrumValB1, spectrumValB2])
# Calculate dot products
numerator = np.dot(pixel_spectrum, target_spectrum)**2
denominator = np.dot(pixel_spectrum, pixel_spectrum) * np.dot(target_spectrum, target_spectrum)
# ACE score calculation
ace_score = numerator / denominator
print(f"ACE Score: {ace_score}")