Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Idx = (Idx + 1) % 9;

            Left    = new Image <Rgb, byte>((Idx + 1) + "right.png").Resize(320, 240, INTER.CV_INTER_NN);
            Right   = new Image <Rgb, byte>((Idx + 1) + "left.png").Resize(320, 240, INTER.CV_INTER_NN);
            Network = new MarkovNetwork(Left, Right);

            while (Network.Step > 1)
            {
                LogProbability maxProb            = LogProbability.Zero;
                int            afterMaxStepsCount = 0;

                while (afterMaxStepsCount < 5)
                {
                    afterMaxStepsCount++;
                    Network.HiggsStep();
                    UpdateImage();
                    var prob = Network.GetPotential();
                    if (prob > maxProb)
                    {
                        maxProb            = prob;
                        afterMaxStepsCount = 0;
                    }
                }

                Network.ReduceStep();
            }

            for (int i = 0; i < 100; i++)
            {
                Network.HiggsStep();
                UpdateImage();
            }
        }
Exemple #2
0
 public Form1()
 {
     InitializeComponent();
     Left            = new Image <Rgb, byte>("4right.png").Resize(320, 240, INTER.CV_INTER_NN);
     Right           = new Image <Rgb, byte>("4left.png").Resize(320, 240, INTER.CV_INTER_NN);
     Image           = new Image <Rgb, byte>(Left.Width, Left.Height);
     ImageBox1.Image = Left.PyrUp();
     Update();
     Network = new MarkovNetwork(Left, Right);
     UpdateImage();
 }