private void IcCam_OverlayUpdate(object sender, TIS.Imaging.ICImagingControl.OverlayUpdateEventArgs e) { //// IcCam.LiveStop(); TIS.Imaging.OverlayBitmap ob = IcCam.OverlayBitmapAtPath[PathPositions.Display]; GonImageProcessing gip = new GonImageProcessing(GetLiveImage()); SetOverlay(); //ob.DrawFrameRect(Color.Blue, i, i, i+ 20, i + 20); //i++; gip.CalcCross(); ob.DrawFrameRect(Color.Blue, 0, 0, 40, 40); ob.DrawFrameRect(Color.Blue, (int)gip.X, (int)gip.Y, (int)gip.X + (int)gip.Width, (int)gip.Y + (int)gip.Height); // //IcCam.LiveStart(); }
private void SetOverlay() { IcCam.LiveCaptureContinuous = true; TIS.Imaging.OverlayBitmap ob = IcCam.OverlayBitmapAtPath[PathPositions.Display]; // Enable the overlay bitmap for drawing. ob.Enable = true; // Set magenta as dropout color. ob.DropOutColor = Color.Magenta; // Fill the overlay bitmap with the dropout color. ob.Fill(ob.DropOutColor); ob.FontTransparent = true; ob.DrawText(Color.Red, 10, 10, "Copyright trademark incorporated all rights reserved"); ob.DrawFrameRect(Color.Red, IcCam.Width / 2 - 40, IcCam.Height / 2 - 40, IcCam.Width / 2 + 40, IcCam.Height / 2 + 40); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 - 40, IcCam.Width / 2, 0); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 + 40, IcCam.Width / 2, IcCam.Height); ob.DrawLine(Color.Red, 0, IcCam.Height / 2, IcCam.Width / 2 - 40, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2 + 40, IcCam.Height / 2, IcCam.Width, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2 - 10, IcCam.Height / 2, IcCam.Width / 2 + 10, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 + 10, IcCam.Width / 2, IcCam.Height / 2 - 10); }
private void icImagingControl1_OverlayUpdate(object sender, TIS.Imaging.ICImagingControl.OverlayUpdateEventArgs e) { TIS.Imaging.OverlayBitmap ob = e.overlay; int lineIndex = m_sink.FrameCount % 25; if (lineIndex == 0) { ob.DrawSolidRect(ob.DropOutColor, 10, icImagingControl1.ImageHeight - 70, 62, icImagingControl1.ImageHeight - 9); } /*ob.DrawLine(Color.Black, lineIndex * 2 + 10, * icImagingControl1.ImageHeight - 10, * lineIndex * 2 + 10, * icImagingControl1.ImageHeight - 10 - lineIndex);*/ // Print the current frame number: // Set the background color to the current dropout color // and make the font opaque. ob.FontBackColor = ob.DropOutColor; ob.FontTransparent = false; // Save the current font. Font OldFont = ob.Font; // Draw the text. ob.Font = new Font("Arial", 8); ob.DrawSolidRect(ob.DropOutColor, 0, 0, 1031, 774); if (CoordinatesystemFlag == true) { //DrawCoordinatesystem(icImagingControl1.OverlayBitmapAtPath[PathPositions.Device]); } ob.DrawText(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox1.Text); ob.DrawText(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox2.Text); ob.DrawText(Color.Black, textBox3.Location.X, textBox3.Location.Y, textBox3.Text); ob.DrawText(Color.Black, textBox4.Location.X, textBox4.Location.Y, textBox4.Text); ob.DrawText(Color.Black, textBox5.Location.X, textBox5.Location.Y, textBox5.Text); if ((textBox1.Text == "") || (textBox2.Text == "")) { ob.DrawSolidRect(ob.DropOutColor, 0, 0, 1031, 774); if (CoordinatesystemFlag == true) { //DrawCoordinatesystem(icImagingControl1.OverlayBitmapAtPath[PathPositions.Device]); } } else { if (cycle.Checked == true) { ob.DrawFrameEllipse(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); ob.DrawFrameRect(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); } else { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); if (textBox3.Text != "") { if (segment.Checked == true) { } else if (triangle.Checked == true) { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox3.Location.X, textBox3.Location.Y); ob.DrawLine(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox3.Location.X, textBox3.Location.Y); } else if (quadrilateral.Checked == true && textBox4.Text != "") { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox4.Location.X, textBox4.Location.Y); ob.DrawLine(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox3.Location.X, textBox3.Location.Y); ob.DrawLine(Color.Black, textBox3.Location.X, textBox3.Location.Y, textBox4.Location.X, textBox4.Location.Y); } } } } // Restore the previously used font. ob.Font = OldFont; }