使用定姿四元数计算图像位置
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package producer
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"image"
|
||||
"os"
|
||||
@@ -8,6 +9,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/airbusgeo/godal"
|
||||
"github.com/paulmach/orb"
|
||||
"github.com/paulmach/orb/geojson"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gocv.io/x/gocv"
|
||||
)
|
||||
@@ -32,11 +35,11 @@ func (s *Scene) Cleanup() {
|
||||
|
||||
// 对 PAN 和 配准后的MSS 在 Y 方向进行分景,景之间有25%的重叠
|
||||
// 默认分景大小:
|
||||
// MSS 2336 * 2336
|
||||
// PAN 9344 * 9344
|
||||
// MSS 2336 * 2336 - 1764
|
||||
// PAN 9344 * 9344 - 7056
|
||||
func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err error) {
|
||||
hPAN := (9344 - 2336)
|
||||
hPANOverlap := 2336
|
||||
hPAN := (7056 - 1764)
|
||||
hPANOverlap := 1764
|
||||
panScenesCnt := r.PanHeight / hPAN
|
||||
|
||||
for i := 0; i < panScenesCnt; i++ {
|
||||
@@ -99,6 +102,7 @@ func (r *Registrator) SubScenes() (panScenes []*Scene, mssScenes []*Scene, err e
|
||||
}
|
||||
|
||||
func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) error {
|
||||
var fc geojson.FeatureCollection
|
||||
for i, scene := range panScenes {
|
||||
dir := filepath.Join(r.Params.OutputDir, fmt.Sprintf("%03d", i+1), "PAN")
|
||||
os.MkdirAll(dir, 0755)
|
||||
@@ -128,8 +132,23 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
||||
MetaData: metaFile,
|
||||
BrowserData: jpg,
|
||||
})
|
||||
|
||||
feature := geojson.NewFeature(orb.Polygon{
|
||||
{
|
||||
{scene.Meta.Corners.UpperLeft.Longitude, scene.Meta.Corners.UpperLeft.Latitude},
|
||||
{scene.Meta.Corners.UpperRight.Longitude, scene.Meta.Corners.UpperRight.Latitude},
|
||||
{scene.Meta.Corners.LowerRight.Longitude, scene.Meta.Corners.LowerRight.Latitude},
|
||||
{scene.Meta.Corners.LowerLeft.Longitude, scene.Meta.Corners.LowerLeft.Latitude},
|
||||
{scene.Meta.Corners.UpperLeft.Longitude, scene.Meta.Corners.UpperLeft.Latitude},
|
||||
},
|
||||
})
|
||||
fc.Features = append(fc.Features, feature)
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(fc)
|
||||
// 输出 GeoJSON 数据
|
||||
fmt.Println(string(data))
|
||||
|
||||
for i, scene := range mssScenes {
|
||||
dir := filepath.Join(r.Params.OutputDir, fmt.Sprintf("%03d", i+1), "MSS")
|
||||
os.MkdirAll(dir, 0755)
|
||||
|
||||
Reference in New Issue
Block a user