1

タイトルの質問です。最近 GDAL を使用して Terrasar—X データを読み取り、虚数部と実数部を分割しています ソフトウェア NEST のように、私は非常に混乱しています。

        string dataPath = @"E:\SARDATA\SampleData\TerraSar-X\SO_000009564_0002_1\SO_000009564_0002_1\TSX1_SAR__SSC______HS_S_SRA_20090223T204240_20090223T204241\TSX1_SAR__SSC______HS_S_SRA_20090223T204240_20090223T204241.xml";
        Gdal.AllRegister();
        Dataset dataset = Gdal.OpenShared(dataPath, Access.GA_ReadOnly);
        Band band = dataset.GetRasterBand(1);
        int xSize = band.XSize;
        int ySize = band.YSize;
        short[] realArray = new short[xSize * ySize];
        short[] imgArray = new short[xSize * ySize];
        if (band.DataType == DataType.GDT_CInt16)
        {
            short[] tmpArray = new short[2 * xSize * ySize];
            band.ReadRaster(0, 0, xSize, ySize, tmpArray, xSize, ySize, 0, 0);
            for (int i = 0; i < tmpArray.Length;i++ )
            {
                realArray[i] = tmpArray[i / 2];
                imgArray[i] = tmpArray[i / 2 + 1];
            }
            tmpArray = null;
        }
4

1 に答える 1

0

私はあなたの問題に対する解決策を持っていると思います。また、複雑な TerraSAR-X を読み取ろうとしたところ、あなたの答えに出会いました。

複雑なファイル形式は、CInt16 の 2 つの Int16 と CInt32 の 2 つの Int32 をマージします。複雑なデータを正しく読み取るには、Integer を 2 つの short に分割する必要があります。正しい読み方は次のようになります。

    string dataPath = @"E:\SARDATA\SampleData\TerraSar-X\SO_000009564_0002_1\SO_000009564_0002_1\TSX1_SAR__SSC______HS_S_SRA_20090223T204240_20090223T204241\TSX1_SAR__SSC______HS_S_SRA_20090223T204240_20090223T204241.xml";
    Gdal.AllRegister();
    Dataset dataset = Gdal.OpenShared(dataPath, Access.GA_ReadOnly);
    Band band = dataset.GetRasterBand(1);
    int xSize = band.XSize;
    int ySize = band.YSize;
    short[] realArray = new short[xSize * ySize];
    short[] imgArray = new short[xSize * ySize];
    if (band.DataType == DataType.GDT_CInt16)
    {
        short[] tmpArray = new short[xSize * ySize];
        band.ReadRaster(0, 0, xSize, ySize, tmpArray, xSize, ySize, 0, 0);
        for (int i = 0; i < tmpArray.Length;i++ )
        {
            int value = tmpArray[i];
            realArray[i] = (short)(value>>16);
            imgArray[i] =  (short)(value & 0xffff);
        }
        tmpArray = null;
    }
于 2015-06-08T17:18:11.697 に答える