save Tmat in binary format

This commit is contained in:
nuknal
2024-06-15 03:04:50 +08:00
parent 4a2fc805c9
commit 0c17fee9c7
6 changed files with 245 additions and 90 deletions

View File

@@ -9,7 +9,7 @@ import (
func (r *Registrator) DoRRC() error {
logrus.Println("try to do RRC...")
tablePAN, err := rrc.LoadGrayTableMatrix("data/rrc/pan_gray_table.dat")
lutPAN, err := rrc.LoadLUT("data/rrc/B0.LUT", 9344)
if err != nil {
logrus.Error("load pan gray table failed")
return err
@@ -17,13 +17,13 @@ func (r *Registrator) DoRRC() error {
for y := 0; y < r.PanImage.Rows(); y++ {
for x := 0; x < r.PanImage.Cols(); x++ {
newGray := tablePAN.At(x, int(uint16(r.PanImage.GetShortAt(y, x))))
newGray := lutPAN[x][int(uint16(r.PanImage.GetShortAt(y, x)))]
r.PanImage.SetShortAt(y, x, int16(newGray))
}
}
for i := 0; i < 4; i++ {
tableMSS, err := rrc.LoadGrayTableMatrix(fmt.Sprintf("data/rrc/mss%d_gray_table.dat", i+1))
lutMSS, err := rrc.LoadLUT(fmt.Sprintf("data/rrc/B%d.LUT", i+1), 2336)
if err != nil {
logrus.Error("load mss gray table failed")
return err
@@ -31,7 +31,7 @@ func (r *Registrator) DoRRC() error {
for y := 0; y < r.MssImages[i].Rows(); y++ {
for x := 0; x < r.MssImages[i].Cols(); x++ {
newGray := tableMSS.At(x, int(uint16(r.MssImages[i].GetShortAt(y, x))))
newGray := lutMSS[x][int(uint16(r.MssImages[i].GetShortAt(y, x)))]
r.MssImages[i].SetShortAt(y, x, int16(newGray))
}
}