Ejemplo n.º 1
0
 private void Calc()
 {
     _data = new Conv[_img.BandsCount];
     for (int i = 0; i < _img.BandsCount; i++)
     {
         _data[i] = new Conv(_img.GetPicData(i + 1), this._kernel);
     }
 }
Ejemplo n.º 2
0
        private void CalcMean()
        {
            // 卷积核书P160
            double[,] kernel =
            {
                {0.125, 0.125, 0.125},
                {0.125, 0, 0.125},
                {0.125, 0.125, 0.125}
            };

            _data = new Conv[_img.BandsCount];
            for (int i = 0; i < _img.BandsCount; i++)
            {
                _data[i] = new Conv(_img.GetPicData(i + 1), kernel);
            }

        }
Ejemplo n.º 3
0
        private void CalcMean()
        {
            // 卷积核书P170-ENVI
            double[,] kernel =
            {
                {0, -1, 0},
                {-1, 4, -1},
                {0, -1, 0}
            };

            _data = new Conv[_img.BandsCount];
            for (int i = 0; i < _img.BandsCount; i++)
            {
                _data[i] = new Conv(_img.GetPicData(i + 1), kernel);
            }

        }
Ejemplo n.º 4
0
        private void CalcY()
        {
            // 卷积核书P169
            double[,] kernel =
            {
                {-1, -2, -1},
                {0, 0, 0},
                {1, 2, 1}
            };

            _dataY = new Conv[_img.BandsCount];
            for (int i = 0; i < _img.BandsCount; i++)
            {
                _dataY[i] = new Conv(_img.GetPicData(i + 1), kernel);
            }

        }
Ejemplo n.º 5
0
        private void CalcX()
        {
            // 卷积核书P169
            double[,] kernel =
            {
                {-1, 0, 1},
                {-2, 0, 2},
                {-1, 0, 1}
            };

            _dataX = new Conv[_img.BandsCount];
            for (int i = 0; i < _img.BandsCount; i++)
            {
                _dataX[i] = new Conv(_img.GetPicData(i + 1), kernel);
            }

        }
Ejemplo n.º 6
0
        private void ButtonCustom_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckImage()) return;

            var a = new RS_Diag.UserDef();
            if (a.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            _loading.Start();

            // 以下很慢……
            var cho = _image[_fChoose.ChoosedFile];
            var knl = a.Kernel;
            RS_Lib.Conv[] c = new Conv[cho.BandsCount];
            for (int i = 0; i < c.Length; i++)
            {
                c[i] = new Conv(cho.GetPicData(i + 1), knl);
            }

            byte[,,] tmp = new byte[cho.BandsCount, cho.Lines, cho.Samples];
            for (int i = 0; i < tmp.GetLength(0); i++)
            {
                var tt = c[i].GetLinearStretch();
                for (int j = 0; j < tmp.GetLength(1); j++)
                {
                    for (int k = 0; k < tmp.GetLength(2); k++)
                    {
                        tmp[i, j, k] = tt[j, k];
                    }
                }
            }

            AddNewPic(tmp, cho.FileName + "-自定义卷积核", false);
            _loading.Abort();
        }