You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Python利用热校准参数将MicaSense热成像图转为温度值?

从MicaSense Altum-PT热成像DN值计算温度的Python实现

参数对应关系

你提取的6个校准参数[1, 316.8, 1192951.5, 1509.95947265625, 1, 13831.46484375]对应FLIR Boson传感器的校准变量:

  • K1, B1, R1 = 1, 316.8, 1192951.5(场景辐射计算参数)
  • K2, B2, R2 = 1509.95947265625, 1, 13831.46484375(传感器自身辐射计算参数)

温度计算逻辑

  1. 从原始16位DN值计算场景辐射与传感器辐射
  2. 扣除传感器自身辐射得到校正后的有效辐射
  3. 通过普朗克逆公式将辐射值转换为温度(单位:开尔文,可转为摄氏度)

Python代码实现

import numpy as np
import tifffile as tf

# 1. 定义校准参数
cal_params = [1, 316.8, 1192951.5, 1509.95947265625, 1, 13831.46484375]
K1, B1, R1, K2, B2, R2 = cal_params

# 2. 普朗克公式常数(适配FLIR Boson 10μm波段)
h = 6.62607015e-34  # 普朗克常数
c = 299792458       # 光速
k = 1.380649e-23    # 玻尔兹曼常数
lambda_ = 10.0e-6   # Boson中心波长(10μm)
c1 = 2 * h * c**2   # 第一辐射常数

# 3. 读取16位灰度TIFF图像
thermal_tif_path = "你的热成像文件路径.tif"
dn_array = tf.imread(thermal_tif_path).astype(np.float64)

# 4. 计算辐射值
scene_radiance = (dn_array - B1) / K1 + R1
sensor_radiance = (dn_array - B2) / K2 + R2
corrected_radiance = scene_radiance - sensor_radiance

# 处理异常值(避免对数计算报错)
corrected_radiance[corrected_radiance <= 0] = np.finfo(np.float64).eps

# 5. 计算温度(开尔文转摄氏度)
temp_kelvin = (h * c) / (k * lambda_ * np.log((c1 / (lambda_**5 * corrected_radiance)) + 1))
temp_celsius = temp_kelvin - 273.15

# 可选:保存温度图像为TIFF(32位浮点)
tf.imwrite("温度结果.tif", temp_celsius.astype(np.float32))

# 输出示例像素温度
print(f"示例像素DN值{dn_array[0,0]}对应的温度:{temp_celsius[0,0]:.2f}℃")

说明

  • 确保安装依赖库:pip install numpy tifffile
  • 如果使用PIL读取图像,可替换为from PIL import Image; dn_array = np.array(Image.open(thermal_tif_path)).astype(np.float64)
  • 若需要调整辐射率校正,可在计算corrected_radiance后加入辐射率系数(默认辐射率设为1.0,若实际场景辐射率不同,需乘以对应系数)

内容的提问来源于stack exchange,提问作者Abbas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 02:35:09