//////////////////////// 2020.12.15 - Niblack algoritmus futatása T szálon public void szamitas() { c.Start(); reset(); Bitmap afterNibleck = NiblackAlgorithm.Binarization(VerifiedImage, k, area); pictureBox1.Invoke(new MethodInvoker( delegate() { pictureBox1.Image = afterNibleck; try { if (kBox.Text == "" || areaBox.Text == "") { throw new Exception("Fields not filled!"); } float.TryParse(kBox.Text, out k); Int32.TryParse(areaBox.Text, out area); PoB1.Value = NiblackAlgorithm.GetBar(); pictureBox1.Size = afterNibleck.Size; pictureBox1.Image = afterNibleck; pictureBox1.Show(); flowLayoutPanel1.AutoScroll = true; afterNibleck.Save("AfterNiblack.png"); } catch (Exception er) { MessageBox.Show(er.Message); } })); }
//////////////////////// 2020.12.15 - Progress bar aktualis érték frissitése D szálon public void frissites() { do { PoB1.Invoke(new MethodInvoker( delegate() { PoB1.Value = NiblackAlgorithm.GetBar(); })); Thread.Sleep(10); } while (PoB1.Value < PB1.Width - 1); }