Пример #1
0
        /// <summary>
        /// 对比度拉伸
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonConSt_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckImage())
            {
                return;
            }

            var cho = _image[_fChoose.ChoosedFile];
            var a   = new RS_Diag.ContrastStr(cho);

            if (a.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            double lV = a.LeftValue,
                   rV = a.RightValue;
            var ind   = a.BandList;

            RS_Lib.ContrastStretch[] st = new ContrastStretch[ind.Length];

            for (int i = 0; i < ind.Length; i++)
            {
                st[i] = new ContrastStretch(cho, ind[i] + 1, lV, rV);
            }

            byte[,,] res = new byte[ind.Length, cho.Lines, cho.Samples];

            for (int i = 0; i < ind.Length; i++)
            {
                for (int j = 0; j < cho.Lines; j++)
                {
                    for (int k = 0; k < cho.Samples; k++)
                    {
                        res[i, j, k] = st[i].StretchedImg[j, k];
                    }
                }
            }

            AddNewPic(res, cho.FileName + "-对比度拉伸结果", false);
        }
Пример #2
0
        /// <summary>
        /// 对比度拉伸
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonConSt_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckImage()) return;

            var cho = _image[_fChoose.ChoosedFile];
            var a = new RS_Diag.ContrastStr(cho);
            if (a.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            double lV = a.LeftValue,
                rV = a.RightValue;
            var ind = a.BandList;
            RS_Lib.ContrastStretch[] st = new ContrastStretch[ind.Length];

            for (int i = 0; i < ind.Length; i++)
            {
                st[i] = new ContrastStretch(cho, ind[i] + 1, lV, rV);
            }

            byte[,,] res = new byte[ind.Length, cho.Lines, cho.Samples];

            for (int i = 0; i < ind.Length; i++)
            {
                for (int j = 0; j < cho.Lines; j++)
                {
                    for (int k = 0; k < cho.Samples; k++)
                    {
                        res[i, j, k] = st[i].StretchedImg[j, k];
                    }
                }
            }

            AddNewPic(res, cho.FileName + "-对比度拉伸结果", false);
        }