Do RRC with histogram LUT, ineffective!
This commit is contained in:
@@ -15,6 +15,8 @@ import (
|
||||
var (
|
||||
params producer.Params
|
||||
saveStrip bool
|
||||
doRRC bool
|
||||
lutDir string
|
||||
)
|
||||
|
||||
var procCmd = &cobra.Command{
|
||||
@@ -44,7 +46,9 @@ var procCmd = &cobra.Command{
|
||||
godal.RegisterAll()
|
||||
os.MkdirAll(params.OutputDir, 0755)
|
||||
|
||||
reg.DoRRC()
|
||||
if doRRC {
|
||||
reg.DoRRC(lutDir)
|
||||
}
|
||||
|
||||
if err := reg.DoPhaseCorrelation(); err != nil {
|
||||
logrus.Fatal(err)
|
||||
@@ -93,6 +97,8 @@ func init() {
|
||||
procCmd.Flags().BoolVarP(¶ms.SubScenes, "sub-scenes", "", false, "process sub-scenes")
|
||||
procCmd.Flags().BoolVarP(&saveStrip, "save-strip", "", false, "save original and registered images as GDAL GTiff")
|
||||
procCmd.Flags().StringVarP(¶msXML, "params", "x", "", "params xml file path")
|
||||
procCmd.Flags().StringVarP(&lutDir, "lut", "l", "data/lut", "LUT directory")
|
||||
procCmd.Flags().BoolVarP(&doRRC, "rrc", "", false, "do RRC")
|
||||
}
|
||||
|
||||
func initParams() producer.Params {
|
||||
|
||||
@@ -2,14 +2,15 @@ package producer
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"starwiz.cn/sjy01/image-proc/pkg/rrc"
|
||||
)
|
||||
|
||||
func (r *Registrator) DoRRC() error {
|
||||
logrus.Println("try to do RRC...")
|
||||
lutPAN, err := rrc.LoadLUT("data/rrc/B0.LUT", 9344)
|
||||
func (r *Registrator) DoRRC(lutDir string) error {
|
||||
logrus.Printf("try to do RRC [%s]...", lutDir)
|
||||
lutPAN, err := rrc.LoadLUT(filepath.Join(lutDir, "B0.LUT"), 9344)
|
||||
if err != nil {
|
||||
logrus.Error("load pan gray table failed")
|
||||
return err
|
||||
@@ -23,7 +24,7 @@ func (r *Registrator) DoRRC() error {
|
||||
}
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
lutMSS, err := rrc.LoadLUT(fmt.Sprintf("data/rrc/B%d.LUT", i+1), 2336)
|
||||
lutMSS, err := rrc.LoadLUT(filepath.Join(lutDir, fmt.Sprintf("B%d.LUT", i+1)), 2336)
|
||||
if err != nil {
|
||||
logrus.Error("load mss gray table failed")
|
||||
return err
|
||||
|
||||
@@ -97,7 +97,6 @@ func (rrc *RRC) StatisticalPAN(dsfile string) error {
|
||||
log.Println("sum PAN histogram...")
|
||||
rrc.Histograms[0].sum([]*ProbeHistogram{&hist})
|
||||
hist.free()
|
||||
printMemStats()
|
||||
runtime.GC()
|
||||
printMemStats()
|
||||
|
||||
@@ -177,7 +176,6 @@ func (rrc *RRC) StatisticalMSS(dsfile string) error {
|
||||
log.Println("sum MSS histogram...")
|
||||
rrc.Histograms[i+1].sum([]*ProbeHistogram{&hist})
|
||||
hist.free()
|
||||
printMemStats()
|
||||
runtime.GC()
|
||||
printMemStats()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user