optimization

This commit is contained in:
nuknal
2024-10-24 14:09:20 +08:00
parent 414450c6e6
commit d16a5bd9c0
8 changed files with 77 additions and 73 deletions

43
cmd/test.go Normal file
View File

@@ -0,0 +1,43 @@
package main
import (
"strconv"
"github.com/airbusgeo/godal"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gocv.io/x/gocv"
"starwiz.cn/sjy01/image-proc/pkg/producer"
"starwiz.cn/sjy01/image-proc/pkg/utils"
)
var (
input0 string
)
var testCmd = &cobra.Command{
Use: "test",
Short: "test command",
Long: `test command`,
Run: func(cmd *cobra.Command, args []string) {
godal.RegisterAll()
input0_mat, err := utils.ReadTifftoMat(input0)
if err != nil {
logrus.Error(err)
return
}
mv := gocv.Split(*input0_mat)
for i := 0; i < len(mv); i++ {
out := producer.FindEdges(mv[i])
utils.SavePanToGDALGTiff(out, 0, 0, "data/temp/out_"+strconv.Itoa(i)+".tif", 1.3)
}
},
}
func init() {
rootCmd.AddCommand(testCmd)
testCmd.Flags().StringVarP(&input0, "input0", "i", "/Users/lan/workspace/sjy01/image-proc/data/002438/L1A/ROI_7000_10500/MSS/SJY01_MSS_20241014_121246_002438_018_ROI_7000_10500_L1A.tiff", "input0")
}