// calcute angle*************** public void computeAngle() { sobelx(); sobely(); angleIMG = new double[imgsx.Width, imgsx.Height]; try { for(int i=10 ; i<=200 ; i++) { for (int j = 10; j <= 150; j++) { if (Oy(i, j) != 0.0) { angleIMG[i, j] = Math.Atan(Ox(i, j) / Oy(i, j)) / 2 + Math.PI / 2; textBox1.Text += Math.Abs(angleIMG[i, j]).ToString(); } else { angleIMG[i, j] = 0.0; } } textBox1.Text = "\n"; } } catch (Exception e1) { MessageBox.Show(e1.Message); } //get Ox(i,j)**************** public double Ox(int i, int j) { double wx=0.0; for (int u = i - 1; u <= i + 1; u++) { for (int v = i - 1; v <= i + 1; v++) { Color cw = imgsx.GetPixel(u, v); Color cw1 = imgsy.GetPixel(u, v); wx =wx+ 2*( cw.R * cw1.R); } } return wx; } //get Oy(i,j)**************** public double Oy(int i, int j) { double wy = 0.0; for (int u = i - 1; u <= i + 1; u++) { for (int v = i - 1; v <= i + 1; v++) { Color cw=imgsx.GetPixel(u, v); Color cw1=imgsy.GetPixel(u, v); wy =wy+ Math.Pow (cw.R,2 )- Math.Pow(cw1.R,2); } } return wy; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)