Example #1
0
        //---------------------------------------------------------------------------------------------------------------------
        public RealMatrix[] GetCorrectedInterferograms(RealMatrix[] interferograms, double[] gammaValues)
        {
            int width  = interferograms[0].ColumnCount;
            int height = interferograms[0].RowCount;

            RealMatrix[] gammaCorrectedInterferograms = new RealMatrix[interferograms.Length];
            for (int index = 0; index < gammaCorrectedInterferograms.Length; index++)
            {
                gammaCorrectedInterferograms[index] = new RealMatrix(height, width);
            }

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    double[] intensities               = MatricesManager.GeValuesFromMatrices(y, x, interferograms);
                    int      cyclingShiftsCount        = 0;
                    double[] intensitiesByCyclingShift =
                        ArrayOperator.GetArrayByCyclingShiftWithMinimumValueInOrigin(intensities, out cyclingShiftsCount);

                    int    optimalGammaValueIndex = this.GetOptimalGammaValueIndex(intensitiesByCyclingShift, gammaValues);
                    double gamma = gammaValues[optimalGammaValueIndex];

                    double[] gammaCorrectedIntensities = ArrayOperator.GetValuesInPower(intensities, gamma);

                    double[] resultValues =
                        ArrayOperator.GetArrayByReverseCyclingShift(gammaCorrectedIntensities, cyclingShiftsCount);
                    MatricesManager.SetValuesInMatrices(gammaCorrectedInterferograms, resultValues, y, x);
                }
            }

            return(gammaCorrectedInterferograms);
        }