暂时使用星下点坐标作为图像左上角坐标
This commit is contained in:
46
pkg/auxilary/aux.go
Normal file
46
pkg/auxilary/aux.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package auxilary
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// 卫星时间起点 北京时间 2000-01-01 20:00:00
|
||||
var (
|
||||
ReferenceTime2000 = 946728000
|
||||
)
|
||||
|
||||
func ExtractAux(auxfile string) ([]*AuxFrameHead, []*AuxFocalBox, []*AuxPlatform, error) {
|
||||
data, err := os.ReadFile(auxfile)
|
||||
if err != nil {
|
||||
log.Println("read aux data from", auxfile, "error:", err.Error())
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
var afh []*AuxFrameHead
|
||||
var afb []*AuxFocalBox
|
||||
var aps []*AuxPlatform
|
||||
|
||||
for i := 0; i < len(data); i += 24 + 128 + 512 {
|
||||
if i+24+128+512 > len(data) {
|
||||
break
|
||||
}
|
||||
var head AuxFrameHead
|
||||
head.Decode(data[i : i+24])
|
||||
afh = append(afh, &head)
|
||||
|
||||
var box AuxFocalBox
|
||||
box.Decode(data[i+24 : i+24+128])
|
||||
afb = append(afb, &box)
|
||||
|
||||
var plat AuxPlatform
|
||||
plat.Decode(data[i+24+128 : i+24+128+512])
|
||||
aps = append(aps, &plat)
|
||||
}
|
||||
|
||||
log.Printf("extract %d aux frame heads, %d aux focal boxes, %d aux platforms from %s",
|
||||
len(afh), len(afb), len(aps), auxfile)
|
||||
|
||||
return afh, afb, aps, err
|
||||
}
|
||||
Reference in New Issue
Block a user