private void button2_Click(object sender, EventArgs e) { zrodlo = new Bitmap(file); EdgeDetection algorithm = new EdgeDetection(zrodlo); algorithm.LoadLut(suwak.Value); //CalcBytes(); if (checkBox1.CheckState == CheckState.Checked) { bool cpp = true; ThreadManager threadsSet = new ThreadManager(trackBar1.Value, cpp, ref algorithm); threadsSet.CreateThreadsSet(); TextBlock.Text = threadsSet.RunThreads(); pictureBox2.Image = algorithm.LoadToOutput(); pictureBox2.Refresh(); } else { bool cpp = false; ThreadManager threadsSet = new ThreadManager(trackBar1.Value, cpp, ref algorithm); threadsSet.CreateThreadsSet(); TextBlock.Text = threadsSet.RunThreads(); pictureBox2.Image = algorithm.LoadToOutput(); pictureBox2.Refresh(); } }
/// <summary> /// Run /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { try { if (isSSE) { if (pictureBox1.Image != null) { img = new Bitmap(file); EdgeDetection algorithm = new EdgeDetection(img); //cpp selected if (checkBox1.CheckState == CheckState.Checked) { Image imageToSave; bool libSelection = true; ThreadManager threadsSet = new ThreadManager(trackBar1.Value, libSelection, ref algorithm); threadsSet.CreateThreadsSet(); label4.Text = "Elapsed time: " + threadsSet.RunThreads() + " ms."; pictureBox2.Image = algorithm.LoadToOutput(); imageToSave = pictureBox2.Image; imageToSave.Save("output.bmp"); pictureBox2.Refresh(); } else if (checkBox2.CheckState == CheckState.Checked) { Image imageToSave; bool libSelection = false; ThreadManager threadsSet = new ThreadManager(trackBar1.Value, libSelection, ref algorithm); threadsSet.CreateThreadsSet(); label4.Text = "Elapsed time: " + threadsSet.RunThreads() + " ms."; pictureBox2.Image = algorithm.LoadToOutput(); imageToSave = pictureBox2.Image; imageToSave.Save("output.bmp"); //imageToSave.Dispose(); pictureBox2.Refresh(); } else { MessageBox.Show("Select library!"); } } else { MessageBox.Show("No file is loaded!"); } } else { MessageBox.Show("Your cpu does not support SSE instructions or Dll files were not loaded properly." + " You will not be able to perform any action."); } } catch (DllNotFoundException dnfe) { MessageBox.Show(dnfe.Message); } }