Thermal infrared matrix analysis toolkit for MoonBit.
moon run cmd/mainlet matrix = @thermal.parse_temperature_matrix(
#|31.2, 33.5, 35.1
#|30.9, 48.8, 36.2
#|29.8, 45.3, 34.4
)
let report = matrix.inspect_threshold(threshold=40.0)
let frame = matrix.colorize(palette=@thermal.Ironbow)
println(report.to_markdown())
println(frame.to_ppm_ascii())moon run cmd/main
moon run --target native cmd/benchmarkroot package
├── matrix / types validated data model and safe access
├── parse / export text and portable PPM/PBM/CSV representations
├── palette pseudocolor conversion
├── mask / regions binary morphology and connected components
├── hotspots / analytics local peaks, histograms, anomalies
├── calibration / quality input correction and quality classification
├── filters / spatial smoothing, kernels, gradients, convolution
├── temporal / tracking frame deltas, trends, and region trajectories
└── lookup_tables deterministic 2048-entry edge-deployment LUTsmoon fmt --check
moon check --deny-warn
moon info
moon test --deny-warn
moon build --target nativepub(all) suberror ThermalError {
InvalidDimensions(width~ : Int, height~ : Int, values~ : Int)
EmptyMatrix
OutOfBounds(x~ : Int, y~ : Int, width~ : Int, height~ : Int)
RaggedRows(expected~ : Int, actual~ : Int, row~ : Int)
ParseNumber(token~ : String, row~ : Int, col~ : Int)
} derive(Eq, ToJson, Debug)pub(all) struct Anomaly {
point : ThermalPoint
value : Double
z_score : Double
} derive(Eq, ToJson, Debug)pub(all) struct BoundaryPixel {
point : ThermalPoint
value : Double
normal_x : Int
normal_y : Int
} derive(Eq, ToJson, Debug)fn Calibration::new(emissivity~ : Double, reflected_temperature~ : Double, ambient_temperature~ : Double, gain? : Double, offset? : Double) -> Calibrationpub(all) struct CalibrationReport {
before : ThermalStats
after : ThermalStats
calibration : Calibration
} derive(Eq, ToJson, Debug)pub(all) struct Hotspot {
point : ThermalPoint
temperature : Double
contrast : Double
} derive(Eq, ToJson, Debug)pub(all) struct InspectionReport {
frame_width : Int
frame_height : Int
threshold : Double
stats : ThermalStats
hotspots : Array[Hotspot]
regions : Array[ThermalRegion]
} derive(Eq, ToJson, Debug)fn ThermalMask::new(width~ : Int, height~ : Int, cells~ : Array[Bool]) -> ThermalMask raise ThermalErrorfn ThermalMatrix::adaptive_mask(matrix : ThermalMatrix, mode : ThresholdMode) -> ThermalMask raise ThermalErrorfn ThermalMatrix::anomalies(matrix : ThermalMatrix, z_limit? : Double) -> Array[Anomaly] raise ThermalErrorfn ThermalMatrix::boundary(matrix : ThermalMatrix, mask : ThermalMask) -> Array[BoundaryPixel] raise ThermalErrorfn ThermalMatrix::calibration_report(matrix : ThermalMatrix, calibration : Calibration) -> CalibrationReport raise ThermalErrorfn ThermalMatrix::colorize(matrix : ThermalMatrix, palette? : Palette, range? : TemperatureRange) -> ColorFrame raise ThermalErrorfn ThermalMatrix::colorize_lut(matrix : ThermalMatrix, palette? : Palette, range? : TemperatureRange) -> ColorFramefn ThermalMatrix::column_signal(matrix : ThermalMatrix, x : Int) -> Array[Double] raise ThermalErrorfn ThermalMatrix::correct_emissivity(matrix : ThermalMatrix, calibration : Calibration) -> ThermalMatrixfn ThermalMatrix::crop(matrix : ThermalMatrix, origin~ : ThermalPoint, width~ : Int, height~ : Int) -> ThermalMatrix raise ThermalErrorfn ThermalMatrix::detect_hotspots(matrix : ThermalMatrix, min_temp~ : Double, radius? : Int, min_contrast? : Double, limit? : Int) -> Array[Hotspot]fn ThermalMatrix::filter(matrix : ThermalMatrix, radius? : Int, kind? : FilterKind) -> ThermalMatrixfn ThermalMatrix::histogram(matrix : ThermalMatrix, bins~ : Int) -> Array[HistogramBin] raise ThermalErrorfn ThermalMatrix::inspect_threshold(matrix : ThermalMatrix, threshold~ : Double, hotspot_limit? : Int) -> InspectionReport raise ThermalErrorfn ThermalMatrix::line_profile(matrix : ThermalMatrix, start~ : ThermalPoint, end~ : ThermalPoint) -> Array[ProfileSample] raise ThermalErrorfn ThermalMatrix::masked_values(matrix : ThermalMatrix, mask : ThermalMask) -> Array[Double] raise ThermalErrorfn ThermalMatrix::new(width~ : Int, height~ : Int, values~ : Array[Double]) -> ThermalMatrix raise ThermalErrorfn ThermalMatrix::region_adjacency(matrix : ThermalMatrix, regions : Array[ThermalRegion]) -> Array[Array[Int]]fn ThermalMatrix::rescale(matrix : ThermalMatrix, width~ : Int, height~ : Int) -> ThermalMatrix raise ThermalErrorfn ThermalMatrix::roi_column_profile(matrix : ThermalMatrix, roi : ThermalRoi) -> Array[Double] raise ThermalErrorfn ThermalMatrix::roi_mean_profile(matrix : ThermalMatrix, roi : ThermalRoi) -> Array[Double] raise ThermalErrorfn ThermalMatrix::roi_stats(matrix : ThermalMatrix, roi : ThermalRoi) -> ThermalStats raise ThermalErrorfn ThermalMatrix::sharpen(matrix : ThermalMatrix, amount? : Double) -> ThermalMatrix raise ThermalErrorfn ThermalMatrix::threshold_mask(matrix : ThermalMatrix, min_temp~ : Double, max_temp? : Double) -> ThermalMaskfn ThermalMatrix::threshold_regions(matrix : ThermalMatrix, min_temp~ : Double, max_temp? : Double) -> Array[ThermalRegion]fn ThermalMatrix::threshold_value(matrix : ThermalMatrix, mode : ThresholdMode) -> Double raise ThermalErrorfn ThermalMatrix::track_frame_sequence(frames : Array[ThermalMatrix], threshold~ : Double, config? : TrackingConfig) -> Array[ThermalTrack]fn ThermalMatrix::weighted_mean(matrix : ThermalMatrix, weights : ThermalMatrix) -> Double raise ThermalErrorpub(all) struct ThermalRegion {
id : Int
pixels : Array[ThermalPoint]
min_x : Int
min_y : Int
max_x : Int
max_y : Int
min_temp : Double
max_temp : Double
average_temp : Double
peak : ThermalPoint
} derive(Eq, ToJson, Debug)pub(all) struct ThermalRoi {
origin : ThermalPoint
width : Int
height : Int
} derive(Eq, ToJson, Debug)fn ThermalRoi::new(origin~ : ThermalPoint, width~ : Int, height~ : Int) -> ThermalRoi raise ThermalErrorpub(all) struct ThermalTrack {
id : Int
observations : Array[TrackObservation]
active : Bool
} derive(Eq, ToJson, Debug)pub(all) struct TrackObservation {
frame : Int
point : ThermalPoint
temperature : Double
area : Int
} derive(Eq, ToJson, Debug)fn find_peaks(values : Array[Double], minimum_prominence? : Double, minimum_distance? : Int) -> Array[SignalPeak]fn track_regions(frames : Array[Array[ThermalRegion]], config? : TrackingConfig) -> Array[ThermalTrack]Install
Download zipThermal infrared matrix analysis toolkit for MoonBit.