Пример #1
0
        private void button21_Click(object sender, EventArgs e)
        {
            ANNWrapper.LoadBPParameters(Application.StartupPath + "\\" + textParas.Text);

            string fileName = Application.StartupPath + "\\" + textSubsystemBMP.Text;
            Bitmap bmp      = new Bitmap(fileName);
            IntPtr hBmp     = bmp.GetHbitmap();

            bool needRevert = false;

            ANNWrapper.SaveBlockToBMP4(hBmp, int.Parse(textLeft.Text),
                                       int.Parse(textTop.Text),
                                       int.Parse(textRight.Text),
                                       int.Parse(textBottom.Text),
                                       Application.StartupPath + "\\" + textInputBMP.Text,
                                       Int32.Parse(textInputInt.Text),
                                       needRevert);

            string ret = "";

            if (NumberParse_1(Application.StartupPath + "\\" + textInputBMP.Text, out ret))
            {
                MessageBox.Show(ret);
            }
            else
            {
                MessageBox.Show("Numeral Parser Error!");
            }
            DeleteObject(hBmp);
        }
Пример #2
0
        private void GossNoiseBMPs(DirectoryInfo Dir, int dest)
        {
            double dblGossU = double.Parse(textGossU.Text);
            double dblGossA = double.Parse(textGossA.Text);

            try
            {
                string gridFile = Dir.FullName + "\\Grid.text";

                FileInfo fGrid = new FileInfo(gridFile);
                fGrid.Delete(); fGrid = null;

                foreach (FileInfo f in Dir.GetFiles("*.bmp"))
                {
                    if (f.FullName.Contains("goss_"))
                    {
                        continue;
                    }
                    Bitmap oldBMP = new Bitmap(f.FullName);
                    Bitmap newBMP = goss_noise(oldBMP, dblGossU, dblGossA);
                    IntPtr hBmp   = newBMP.GetHbitmap();
                    ANNWrapper.SaveBlockToBMP4(hBmp, 0, 0, newBMP.Width, newBMP.Height, Dir.FullName + "\\goss_" + f.Name, Int32.Parse(textInputInt.Text), false);
                    DeleteObject(hBmp);

                    oldBMP.Dispose();
                    newBMP.Dispose();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }