public GetExteriorAngleDegree ( |
||
otherLine | The other line | |
리턴 | double |
public void TestAngle(/*LineSegment2D HorizontalMiddleLine*/) { Image<Bgr, Byte> imgBackground = new Image<Bgr, byte>("C:\\Users\\kevin\\Downloads\\gridBackground2.jpg"); LineSegment2D line1 = new LineSegment2D(new Point(100, 0), new Point(200, 150)); LineSegment2D line2 = new LineSegment2D(new Point(200, 150), new Point(150, 300)); imgBackground.Draw(line1, new Bgr(Color.Red), 1); imgBackground.Draw(line2, new Bgr(Color.Blue), 1); Double angle = 0; angle = (line1.GetExteriorAngleDegree(line2));//* (180.0 / Math.PI) ); MCvFont f = new MCvFont(FONT.CV_FONT_HERSHEY_COMPLEX, 0.6, 0.6); imgBackground.Draw(angle.ToString(), ref f, new Point(50, 50), new Bgr(0, 0, 0)); //ibTestAngle.Image = imgBackground; }
private void DrawLines(List<System.Drawing.PointF> markersF, Image<Bgr, byte> outImg1, bool captureAngles) { LineSegment2D line1 = new LineSegment2D(new System.Drawing.Point((int)markersF[0].X, (int)markersF[0].Y), new System.Drawing.Point((int)markersF[1].X, (int)markersF[1].Y)); LineSegment2D line2 = new LineSegment2D(new System.Drawing.Point((int)markersF[1].X, (int)markersF[1].Y), new System.Drawing.Point((int)markersF[2].X, (int)markersF[2].Y)); outImg1.Draw(line1, new Bgr(System.Drawing.Color.Red), 1); outImg1.Draw(line2, new Bgr(System.Drawing.Color.Red), 1); double angleEmgu = line1.GetExteriorAngleDegree(line2); double angle = findAngle(markersF); // double angle = angleEmgu; MCvFont f = new MCvFont(FONT.CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0); outImg1.Draw(((int)angle).ToString(), ref f, new System.Drawing.Point((int)markersF[1].X, (int)markersF[1].Y), new Bgr(121, 116, 40)); if(captureAngles) angles.Add(angle); //========================== activar un BOOL para empezar a capturar lo angulos y desactivarlo al presionarlo nuevamente //========================== luego guardar la lista de angulos y mostrarlo en la grafica //tbxResults.AppendText("line.AddPoint(" + (countFrames * 1.0).ToString() + "," + Math.Abs(angle).ToString() + ");"); tbxResults.AppendText(Math.Abs(angle).ToString() + ","); tbxResults.AppendText(Environment.NewLine); /* ListBoxItem item = new ListBoxItem(); item.Content = "AddPoint(" + (countFrames * 1.0).ToString() + "," + angle.ToString() + ");"; listResults.Items.Add(item); */ countFrames++; }