different enhancement method for different sensor type
This commit is contained in:
@@ -36,7 +36,7 @@ var fusCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
godal.RegisterAll()
|
godal.RegisterAll()
|
||||||
producer.GTiffToJPG(filepath.Join(outputDir, fusedTiff), filepath.Join(outputDir, id+".jpg"), true)
|
producer.GTiffToJPG(filepath.Join(outputDir, fusedTiff), filepath.Join(outputDir, id+".jpg"), "FUS", true)
|
||||||
|
|
||||||
var report producer.Report
|
var report producer.Report
|
||||||
report.Satellite = "SJY01"
|
report.Satellite = "SJY01"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ type RadiationConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BrowserImgConfig struct {
|
type BrowserImgConfig struct {
|
||||||
Enhancement string `yaml:"enhancement" mapstructure:"enhancement"`
|
Enhancement map[string]string `yaml:"enhancement" mapstructure:"enhancement"`
|
||||||
CumulativeCutLower float64 `yaml:"cumulative_cut_lower" mapstructure:"cumulative_cut_lower"`
|
CumulativeCutLower float64 `yaml:"cumulative_cut_lower" mapstructure:"cumulative_cut_lower"`
|
||||||
CumulativeCutUpper float64 `yaml:"cumulative_cut_upper" mapstructure:"cumulative_cut_upper"`
|
CumulativeCutUpper float64 `yaml:"cumulative_cut_upper" mapstructure:"cumulative_cut_upper"`
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,11 @@ func init() {
|
|||||||
HFBandStopWidth: 24,
|
HFBandStopWidth: 24,
|
||||||
},
|
},
|
||||||
BrowserImg: BrowserImgConfig{
|
BrowserImg: BrowserImgConfig{
|
||||||
Enhancement: "StretchToCumulativeCutMinMax",
|
Enhancement: map[string]string{
|
||||||
|
"MSS": "StretchToCumulativeCutMinMax",
|
||||||
|
"PAN": "StretchToMinimumMaximum",
|
||||||
|
"FUS": "StretchToCumulativeCutMinMax",
|
||||||
|
},
|
||||||
CumulativeCutLower: 0.01,
|
CumulativeCutLower: 0.01,
|
||||||
CumulativeCutUpper: 0.99,
|
CumulativeCutUpper: 0.99,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,21 +20,21 @@ func TestGTiffToJPG(t *testing.T) {
|
|||||||
godal.RegisterAll()
|
godal.RegisterAll()
|
||||||
tiff := "../data/051622/006/MSS/SJY01_MSS_20240516_101236_051622_096_006.tiff"
|
tiff := "../data/051622/006/MSS/SJY01_MSS_20240516_101236_051622_096_006.tiff"
|
||||||
jpg := "../data/051622/006/MSS/SJY01_MSS_20240516_101236_051622_096_006.jpg"
|
jpg := "../data/051622/006/MSS/SJY01_MSS_20240516_101236_051622_096_006.jpg"
|
||||||
err := GTiffToJPG(tiff, jpg, false)
|
err := GTiffToJPG(tiff, jpg, "MSS", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tiff = "../data/051622/006/PAN/SJY01_PAN_20240516_101236_051622_096_006.tiff"
|
tiff = "../data/051622/006/PAN/SJY01_PAN_20240516_101236_051622_096_006.tiff"
|
||||||
jpg = "../data/051622/006/PAN/SJY01_PAN_20240516_101236_051622_096_006.jpg"
|
jpg = "../data/051622/006/PAN/SJY01_PAN_20240516_101236_051622_096_006.jpg"
|
||||||
err = GTiffToJPG(tiff, jpg, false)
|
err = GTiffToJPG(tiff, jpg, "PAN", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tiff = "../data/051622/006/FUS/SJY01_FUS_20240516_101236_051622_096_006.tiff"
|
tiff = "../data/051622/006/FUS/SJY01_FUS_20240516_101236_051622_096_006.tiff"
|
||||||
jpg = "../data/051622/006/FUS/SJY01_FUS_20240516_101236_051622_096_006.jpg"
|
jpg = "../data/051622/006/FUS/SJY01_FUS_20240516_101236_051622_096_006.jpg"
|
||||||
err = GTiffToJPG(tiff, jpg, true)
|
err = GTiffToJPG(tiff, jpg, "FUS", true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"starwiz.cn/sjy01/image-proc/pkg/config"
|
"starwiz.cn/sjy01/image-proc/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
|
func GTiffToJPG(ftiff, fjpg, sensor string, reversed bool) error {
|
||||||
// 打开 TIFF 文件
|
// 打开 TIFF 文件
|
||||||
ds, err := godal.Open(ftiff)
|
ds, err := godal.Open(ftiff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -58,8 +58,12 @@ func GTiffToJPG(ftiff, fjpg string, reversed bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
channels := gocv.Split(img)
|
channels := gocv.Split(img)
|
||||||
|
enhancement, ok := config.GCONFIG.BrowserImg.Enhancement[sensor]
|
||||||
|
if !ok {
|
||||||
|
enhancement = "NoEnhancement"
|
||||||
|
}
|
||||||
for i, ch := range channels {
|
for i, ch := range channels {
|
||||||
switch config.GCONFIG.BrowserImg.Enhancement {
|
switch enhancement {
|
||||||
case StretchToCumulativeCutMinMax:
|
case StretchToCumulativeCutMinMax:
|
||||||
channels[i] = cumulativeCountCutEnhancement(ch,
|
channels[i] = cumulativeCountCutEnhancement(ch,
|
||||||
config.GCONFIG.BrowserImg.CumulativeCutLower,
|
config.GCONFIG.BrowserImg.CumulativeCutLower,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
|||||||
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
||||||
r.writeProductMeta(scene.Meta, metaFile)
|
r.writeProductMeta(scene.Meta, metaFile)
|
||||||
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
||||||
GTiffToJPG(scene.Tiff, jpg, false)
|
GTiffToJPG(scene.Tiff, jpg, "PAN", false)
|
||||||
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
||||||
Name: scene.SceneId,
|
Name: scene.SceneId,
|
||||||
TiffData: scene.Tiff,
|
TiffData: scene.Tiff,
|
||||||
@@ -219,7 +219,7 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
|||||||
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
||||||
r.writeProductMeta(scene.Meta, metaFile)
|
r.writeProductMeta(scene.Meta, metaFile)
|
||||||
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
||||||
GTiffToJPG(scene.Tiff, jpg, false)
|
GTiffToJPG(scene.Tiff, jpg, "MSS", false)
|
||||||
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
||||||
Name: scene.SceneId,
|
Name: scene.SceneId,
|
||||||
TiffData: scene.Tiff,
|
TiffData: scene.Tiff,
|
||||||
@@ -240,7 +240,7 @@ func (r *Registrator) DoScenePansharpen(panScenes []*Scene, mssScenes []*Scene)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jpg := strings.Replace(fusedTiff, ".tiff", ".jpg", 1)
|
jpg := strings.Replace(fusedTiff, ".tiff", ".jpg", 1)
|
||||||
GTiffToJPG(fusedTiff, jpg, true)
|
GTiffToJPG(fusedTiff, jpg, "FUS", true)
|
||||||
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
||||||
TiffData: fusedTiff,
|
TiffData: fusedTiff,
|
||||||
Name: strings.TrimSuffix(filepath.Base(fusedTiff), ".tiff"),
|
Name: strings.TrimSuffix(filepath.Base(fusedTiff), ".tiff"),
|
||||||
|
|||||||
Reference in New Issue
Block a user