Files
iris_format/doc/高光谱数据文件格式规范文档.md

193 lines
7.7 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 高光谱数据文件格式规范文档(.iris)
## 1. 文件概述
本规范定义了一种用于存储高光谱数据及相关信息的二进制文件格式。该格式采用模块化设计,支持灵活扩展,能够高效存储高光谱数据、元数据、预览图像等多种信息。
通用定义
```c++
struct IRIS_Time_Struct
{
int8_t timezone; // 时区
uint16_t year; // 年
uint8_t month; // 月
uint8_t day; // 日
uint8_t hour; // 时
uint8_t minute; // 分
uint8_t second; // 秒
uint16_t millisecond; // 毫秒
};
```
## 2.根文件结构
数去分为4个区域分别是 高光谱数据SpectralData、高光谱元数据(SpectralInfo)、其他信息(Other)、图片信息(Image)
| 高光谱数据 | 高光谱元数据 | 其他信息 | 图片信息 |
| ---------- | ------------ | -------- | -------- |
每块区域的存储结构如下:
| 数据区标识4字节 | 数据区长度8字节 | 数据内容N字节 |
| ---------- | ---------- | --------- |
其中四块数据区域标识如下
| SpectralData | 0x 00 ff 00 ff |
| ------------ | -------------- |
| SpectralInfo | 0x ff 00 ff 00 |
| Other | 0x f0 f0 f0 f0 |
| Image | 0x0f 0f 0f 0f |
当某个区域没有数据时标识不能少 此时数据内容长度为0
## 2.1 高光谱元数据SpectralInfo
info数据采取如下格式进行存储
| info数量2字节n | info1数据长度(2字节) | info1类型(1字节 ) | info1数据nn字节 | .... | ... | infon数据长度 | infon类型 | infon数据 |
| ------------------ | -------------------- | ----------------- | ------------------- | ---- | ---- | ------------- | --------- | --------- |
其中info数据类型有如下
| 值 | 类型 | 说明 |
| ---- | --------- | ------------------------------------------ |
| 0x00 | json | info数据为json字符串二进制存储 |
| 0x01 | string | info数据为字符串二进制存储 字符串以逗号分隔keyvalue |
| 0x02 | key:value | 其中info第一个是key的字节数 然后以该字节读取key 以剩余字节读取value |
| 0x03 | 波长数组 | 前20个字节是sensor_id 其他字节是float数组 波长数组 |
| 其他待定 | | |
元数据必须包含如下信息
1、元信息必须包含后续所有光谱数据对应的光谱设备 以sensor_id标识
3、 波长信息 如果提供的是波长系数 则用json保存 存储结构是 sensor_id--wevainfo--a[0],a[1],a[2],a[3] 如果是波长数组 则用0x03保存 json中可以用IS_Weave_ARR来标识波长信息在0x03中
4、元数据还应包含环境数据 Environment 信息 至少包含日期Date和Time 信息
多json分散存储
```json
{
"info_type": "devinfo",
"sensor_id": "is30002",
"bandnum": 2048,
"wave_coeff": {
"a1": 0.0,
"a2": 0.0,
"a3": 400,
"a4": 1.0
}
}
```
一个json包含所有
```json
{
"info_type": "infolist", // infolist 标识该json存储了多个info
"info_number":3, // 必须
"info_list": [
{
"info_type": "devinfo", // info类型为设备信息 // 必须
"sensor_id": "is30002", // 必须
"bandnum": 2048, // 必须
"wave_coeff": {
"a1": 0.0, // 必须
"a2": 0.0, // 必须
"a3": 400, // 必须
"a4": 1.0 // 必须
}
},
{
"info_type": "environment", // info类型为环境信息 必须
"date": "2000-01-00 00:00:00", // 必须
//下面可选
"humidity":90.0,
"temperature":35.0 ,
"gps":{
"latitude":115.01,
"longitude": 39.01,
"altitude": 100.0
}
},
{
"info_type": "devinfo", // 0 for device info
"sensor_id": "is20001",
"bandnum": 512,
"wave_coeff": {
"a1": 0,
"a2": 0.0,
"a3":390,
"a4": 4
}
}
]
}
```
##2.2 高光谱数据
| 光谱数据数量2字节 | 光谱数据1 | 光谱数据2 | 光谱数据3 | .... | .... | .... | 光谱数据n |
| --------------------- | --------- | --------- | --------- | ---- | ---- | ---- | --------- |
{HH3: 地物DN 白板DN DARK_DN,flat_ref,califile}
{HH3califlie: califile,DN,lampvalue}
光谱数据格式如下
| 项目 | 字节 | 类型 | 说明 |
| ------------------ | -------------------------- | ---------------- | ------------------------------------------------------------ |
| name | 100 | string | basename_number_type字符串 \0结尾 |
| Sensor_id | 50 | string | 字符串 \0结尾 |
| 光纤_id | 1 | uint8 | |
| Date | sizeofIRIS_Time_Struct | IRIS_Time_Struct | 采集日期 |
| 曝光时间 (shutter) | 8 | double | 毫秒 |
| gain | 4 | float | db |
| 数据类型 | 1 | uint8 | 数据类型 见下一个表 |
| 数据长度 | 1 | uint8 | 每一个像素数据长度 N |
| 地物类型 | 1 | uint8 | 0 dn 1 rad 2 ref 3 irad 4 califile 5 flat_ref 6 dark_dn 6 flat_dn |
| 波段数量 | 2 | uint16 | 波段数 Bandnum |
| 数据有效标识 | 1 | uint8 | 0 数据有效 |
| 光谱数据 | N*Bandnum | 数据类型决定 | |
数据类型如下
| 编码值 | 数据类型 | 描述 |
| ---- | ------- | ------------------------- |
| 0x10 | uint8 | 无符号8位整型 (0-255) |
| 0x11 | int16 | 有符号16位整型 (-32,768~32,767) |
| 0x12 | uint16 | 无符号16位整型 (0-65,535) |
| 0x13 | int32 | 有符号32位整型 |
| 0x14 | uint32 | 无符号32位整型 |
| 0x20 | float32 | IEEE 754单精度浮点 |
| 0x21 | float64 | IEEE 754双精度浮点 |
## 2.3 Other
该部分数据与2.1结构一致
## 2.4 图像信息
图像部分数据如下
| 图像个数(2 字节)n | 图像数据1 | 图像数据2 | ... | 图像数据n |
| ----------------- | --------- | --------- | ---- | --------- |
每个图像数据
| 项目 | 字节 | 类型 | 说明 |
| --------- | ------------------------ | ---------------- | ------------------------------- |
| 数据长度 | 8 | uint64 | 除了改项以外其他部分的长度 |
| name | 100 | string | 字符串 \0结尾 |
| Time | sizeof(IRIS_Time_Struct) | IRIS_Time_Struct | 采集时间 |
| type | 1 | uint8 | 0 jpg 1 png 2 tiff 3 data。。。 |
| imagedata | 数据长度 | | 图像数据 |