public Tuple <string> ins(Image <Bgr, byte> imgcopy_7) { Tuple <int, int, double, double, int, int, int> obi = matrix.maximin_2(imgcopy_7); double Max_2 = obi.Item4; double Min_2 = obi.Item3; Tuple <int, int, int> cho = matrix.choice(imgcopy_7); int iron_1 = cho.Item1; int szar_1 = cho.Item2; int rain_1 = cho.Item3; Tuple <int, int, double, double> obi_3_1 = form1.change(); double Min_2_1 = ((obi_3_1.Item1 - obi_3_1.Item4) / obi_3_1.Item3); double Max_2_1 = ((obi_3_1.Item2 - obi_3_1.Item4) / obi_3_1.Item3); Tuple <double, double> obi_4 = counturs.contour_1(obi_3_1.Item1, obi_3_1.Item2, imgcopy_7, iron_1, szar_1, rain_1); double carea_2 = obi_4.Item1; double len_2 = obi_4.Item2; string inscript = ""; if ((Max_2 >= Min_2) && carea_2 >= 10) { inscript = "Wykryta"; } else if ((!(Max_2 >= Min_2)) || carea_2 <= 10) { inscript = "Nie wykryta"; } return(Tuple.Create(inscript)); }
private void button1_Click(object sender, EventArgs e) { Tuple <string, string> changeback2 = changeback(); form1.textBox1.Text = changeback2.Item2; form1.textBox2.Text = changeback2.Item1; form1.change(); form1.Main_Contour(); this.Close(); }
public void report(Image <Bgr, byte> Image, Image <Bgr, byte> Image_1) { // z konturami List <Image <Bgr, byte> > pic_4_1 = form1.pic_2(Image_1); List <Image <Bgr, byte> > imageBoxList_1 = pic_4_1; // z bez konturów List <Image <Bgr, byte> > pic_4 = form1.pic(Image); List <Image <Bgr, byte> > imageBoxList_1_1 = pic_4; PictureBox[] pictureBoxs = new PictureBox[9]; pictureBoxs[0] = imageBox2; pictureBoxs[1] = imageBox3; pictureBoxs[2] = imageBox4; pictureBoxs[3] = imageBox5; pictureBoxs[4] = imageBox6; pictureBoxs[5] = imageBox7; pictureBoxs[6] = imageBox8; pictureBoxs[7] = imageBox9; pictureBoxs[8] = imageBox10; for (int i = 0; i < 9; i++) { pictureBoxs[i].Image = imageBoxList_1[i].Bitmap; } for (int i = 0; i < 9; i++) { Tuple <int, int, double, double, int, int, int> obi = matrix.maximin_2(imageBoxList_1_1[i]); pod_area[i] = obi.Item7; Max_2[i] = obi.Item4; Min_2[i] = obi.Item3; Tuple <double, int, double, int> obi_1 = matrix.med_ave(imageBoxList_1_1[i]); ava_area[i] = obi_1.Item4; Tuple <double, int, double, int> obi_2 = matrix.med_ave(imageBoxList_1_1[i]); med_area[i] = obi_2.Item2; Tuple <int> obi_3 = matrix.maximin(imageBoxList_1_1[i]); pro_area[i] = obi_3.Item1; Tuple <int, int, int> cho = matrix.choice(imageBoxList_1_1[i]); int[] iron_1 = new int[9]; iron_1[i] = cho.Item1; int[] szar_1 = new int[9]; szar_1[i] = cho.Item2; int[] rain_1 = new int[9]; rain_1[i] = cho.Item3; Tuple <int, int, double, double> obi_3_1 = form1.change(); double[] Min_2_1 = new double[9]; Min_2_1[i] = ((obi_3_1.Item1 - obi_3_1.Item4) / obi_3_1.Item3); Tuple <double, double> obi_4 = contours.contour_1(obi_3_1.Item1, obi_3_1.Item2, imageBoxList_1_1[i], iron_1[i], szar_1[i], rain_1[i]); con_area[i] = obi_4.Item1; if ((Max_2[i] >= Min_2[i]) && con_area[i] >= 10) { inscript[i] = "Wykryto"; } else if ((!(Max_2[i] >= Min_2[i])) || con_area[i] <= 10) { inscript[i] = "Brak"; } } label1.Text = "Pole I: " + pro_area[0]; label2.Text = "Pole II: " + con_area[0]; label3.Text = "Pole III: " + med_area[0]; label4.Text = "Pole IV: " + ava_area[0]; label5.Text = "Pole V: " + pod_area[0]; label6.Text = "Max.Temperatura: " + Max_2[0]; label7.Text = "Status zmiany: " + inscript[0]; label8.Text = "Pole I: " + pro_area[1]; label9.Text = "Pole II: " + con_area[1]; label10.Text = "Pole III: " + med_area[1]; label11.Text = "Pole IV: " + ava_area[1]; label12.Text = "Pole V: " + pod_area[1]; label13.Text = "Max.Temperatura: " + Max_2[1]; label14.Text = "Status zmiany: " + inscript[1]; label15.Text = "Pole I: " + pro_area[2]; label16.Text = "Pole II: " + con_area[2]; label17.Text = "Pole III: " + med_area[2]; label18.Text = "Pole IV: " + ava_area[2]; label19.Text = "Pole V: " + pod_area[2]; label20.Text = "Max.Temperatura: " + Max_2[2]; label21.Text = "Status zmiany: " + inscript[2]; label22.Text = "Pole I: " + pro_area[3]; label23.Text = "Pole II: " + con_area[3]; label24.Text = "Pole III: " + med_area[3]; label25.Text = "Pole IV: " + ava_area[3]; label26.Text = "Pole V: " + pod_area[3]; label27.Text = "Max.Temperatura: " + Max_2[3]; label28.Text = "Status zmiany: " + inscript[3]; label29.Text = "Pole I: " + pro_area[4]; label30.Text = "Pole II: " + con_area[4]; label31.Text = "Pole III: " + med_area[4]; label32.Text = "Pole IV: " + ava_area[4]; label33.Text = "Pole V: " + pod_area[4]; label34.Text = "Max.Temperatura: " + Max_2[4]; label35.Text = "Status zmiany: " + inscript[4]; label36.Text = "Pole I: " + pro_area[5]; label37.Text = "Pole II: " + con_area[5]; label38.Text = "Pole III: " + med_area[5]; label39.Text = "Pole IV: " + ava_area[5]; label40.Text = "Pole V: " + pod_area[5]; label41.Text = "Max.Temperatura: " + Max_2[5]; label42.Text = "Status zmiany: " + inscript[5]; label43.Text = "Pole I: " + pro_area[6]; label44.Text = "Pole II: " + con_area[6]; label45.Text = "Pole III: " + med_area[6]; label46.Text = "Pole IV: " + ava_area[6]; label47.Text = "Pole V: " + pod_area[6]; label48.Text = "Max.Temperatura: " + Max_2[6]; label49.Text = "Status zmiany: " + inscript[6]; label50.Text = "Pole I: " + pro_area[7]; label51.Text = "Pole II: " + con_area[7]; label52.Text = "Pole III: " + med_area[7]; label53.Text = "Pole IV: " + ava_area[7]; label54.Text = "Pole V: " + pod_area[7]; label55.Text = "Max.Temperatura: " + Max_2[7]; label56.Text = "Status zmiany: " + inscript[7]; label57.Text = "Pole I: " + pro_area[8]; label58.Text = "Pole II: " + con_area[8]; label59.Text = "Pole III: " + med_area[8]; label60.Text = "Pole IV: " + ava_area[8]; label61.Text = "Pole V: " + pod_area[8]; label62.Text = "Max.Temperatura: " + Max_2[8]; label63.Text = "Status zmiany: " + inscript[8]; }
public Tuple <int[, ], double[, ], double[, ], double[, ], int[], double[]> close(Image <Bgr, byte> imgInput) { Tuple <int, int, double, double> obi_3_1 = form1.change(); int width = imgInput.Width; int height = imgInput.Height; int[,] imgInput2 = new int[height, width]; int[] number = new int[width * height]; double[] temp = new double[width * height]; double[,] b = new double[height, width]; double[,] g = new double[height, width]; double[,] r = new double[height, width]; Bgr color; int c = 0; int rain = choice(imgInput).Item3; int iron = choice(imgInput).Item1; int szar = choice(imgInput).Item2; if (choice(imgInput).Item1 == 1) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { color = imgInput[y, x]; b[y, x] = color.Blue; g[y, x] = color.Green; r[y, x] = color.Red; imgInput2[y, x] = Convert.ToInt32(0.299 * r[y, x] + 0.585 * g[y, x] + 0.114 * b[y, x]); number[c] = imgInput2[y, x]; temp[c] = Math.Round(((number[c] - obi_3_1.Item4) / obi_3_1.Item3), 2); c++; } } } else if (choice(imgInput).Item3 == 1) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { color = imgInput[y, x]; b[y, x] = color.Blue; g[y, x] = color.Green; r[y, x] = color.Red; imgInput2[y, x] = Convert.ToInt32(1.035 * r[y, x] - 0.447 * g[y, x] + 0 * b[y, x]); number[c] = imgInput2[y, x]; temp[c] = Math.Round(((number[c] - obi_3_1.Item4) / obi_3_1.Item3), 2); c++; } } } else if (choice(imgInput).Item2 == 1) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { color = imgInput[y, x]; b[y, x] = color.Blue; g[y, x] = color.Green; r[y, x] = color.Red; imgInput2[y, x] = Convert.ToInt32(b[y, x]); number[c] = imgInput2[y, x]; temp[c] = Math.Round(((number[c] - obi_3_1.Item4) / obi_3_1.Item3), 2); c++; } } } return(Tuple.Create(imgInput2, b, g, r, number, temp)); }