Ejemplo n.º 1
0
        public bool ShowCornerResult(PictureBox display)
        {
            bool reSuccess = false;

            try
            {
                float scalingRatio = ScalingRatio(eFindCorner[CornerLine.Line_1].InputImage, display);
                eFindCorner[CornerLine.Line_1].Base.SetZoom(scalingRatio, scalingRatio);
                eFindCorner[CornerLine.Line_1].Base.SetPan(0, 0);
                eFindCorner[CornerLine.Line_2].Base.SetZoom(scalingRatio, scalingRatio);
                eFindCorner[CornerLine.Line_2].Base.SetPan(0, 0);

                Bitmap bmp = new Bitmap(InputImage.Width, InputImage.Height);
                eFindCorner[CornerLine.Line_1].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.SampledPoints);
                eFindCorner[CornerLine.Line_1].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.Actual);
                eFindCorner[CornerLine.Line_2].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.SampledPoints);
                eFindCorner[CornerLine.Line_2].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.Actual);

                ezPoint ezPoint = new ezPoint();
                GetCornerResults(ref ezPoint);
                EPoint     ePoint = new EPoint((float)ezPoint.x, (float)ezPoint.y);
                ELineGauge line_1 = new ELineGauge();
                ELineGauge line_2 = new ELineGauge();
                //line_1.Attach(eFixture.Base);
                //line_2.Attach(eFixture.Base);

                line_1.SetCenterXY(ePoint.X, ePoint.Y);
                line_2.SetCenterXY(ePoint.X, ePoint.Y);
                line_1.Angle = eFindCorner[CornerLine.Line_1].Position_Angle + eFixture.Angle;
                line_2.Angle = eFindCorner[CornerLine.Line_2].Position_Angle + eFixture.Angle;

                line_1.SetZoom(scalingRatio, scalingRatio);
                line_2.SetZoom(scalingRatio, scalingRatio);
                line_1.SetPan(0, 0);
                line_2.SetPan(0, 0);
                line_1.Draw(Graphics.FromImage(bmp), new ERGBColor(255, 0, 0), EDrawingMode.Actual);
                line_2.Draw(Graphics.FromImage(bmp), new ERGBColor(255, 0, 0), EDrawingMode.Actual);

                if (display.InvokeRequired)
                {
                    display.Invoke(new Action(() => { display.Image = bmp; }));
                }
                else
                {
                    display.Image = bmp;
                }
                reSuccess = true;
            }
            catch (EException exc)
            {
                StackFrame[] stackFrames = new StackTrace(true).GetFrames();
                clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true);
            }
            catch (Exception ex)
            {
                StackFrame[] stackFrames = new StackTrace(true).GetFrames();
                clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true);
            }
            return(reSuccess);
        }
Ejemplo n.º 2
0
        public void GetCornerResults(ref ezPoint corner)
        {
            try
            {
                float result_CenterX_1 = 0;
                float result_CenterY_1 = 0;
                float result_Angle_1   = 0;

                float result_CenterX_2 = 0;
                float result_CenterY_2 = 0;
                float result_Angle_2   = 0;
                FindCorner[CornerLine.Line_1].FindLine(ref result_CenterX_1, ref result_CenterY_1, ref result_Angle_1);
                FindCorner[CornerLine.Line_2].FindLine(ref result_CenterX_2, ref result_CenterY_2, ref result_Angle_2);

                EPoint localSensor_1 = eFixture.GetPoint(new EPoint(result_CenterX_1, result_CenterY_1), CoordinateHook.NotHook);
                EPoint localSensor_2 = eFixture.GetPoint(new EPoint(result_CenterX_2, result_CenterY_2), CoordinateHook.NotHook);

                ezLine line_1 = new ezLine(localSensor_1.X, localSensor_1.Y, result_Angle_1 + eFixture.Angle);
                ezLine line_2 = new ezLine(localSensor_2.X, localSensor_2.Y, result_Angle_2 + eFixture.Angle);

                line[CornerLine.Line_1] = line_1;
                line[CornerLine.Line_2] = line_2;
                corner = new ezPoint(line_1, line_2);
            }
            catch (EException exc)
            {
                StackFrame[] stackFrames = new StackTrace(true).GetFrames();
                clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true);
            }
            catch (Exception ex)
            {
                StackFrame[] stackFrames = new StackTrace(true).GetFrames();
                clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true);
            }
        }
Ejemplo n.º 3
0
 public void GetCornerWordResults(ref ezPoint corner)
 {
     try
     {
         //ezLine line_1 = new ezLine(0, 0, 0);
         //ezLine line_2 = new ezLine(0, 0, 0);
         //GetLineWordResults(CornerLine.Line_1, ref line_1);
         //GetLineWordResults(CornerLine.Line_2, ref line_2);
         //line[CornerLine.Line_1] = line_1;
         //line[CornerLine.Line_2] = line_2;
         //corner = new ezPoint(line_1, line_2);
         ezPoint pixelCorner = new ezPoint();
         GetCornerResults(ref pixelCorner);
         EPoint wordPoint = eCalibration.Fixture.GetPoint(new EPoint((float)pixelCorner.x, (float)pixelCorner.y), CoordinateHook.Hook);
         corner   = new ezPoint();
         corner.x = wordPoint.X;
         corner.y = wordPoint.Y;
     }
     catch (EException exc)
     {
         StackFrame[] stackFrames = new StackTrace(true).GetFrames();
         clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true);
     }
     catch (Exception ex)
     {
         StackFrame[] stackFrames = new StackTrace(true).GetFrames();
         clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true);
     }
 }
Ejemplo n.º 4
0
        private void btnGetCorner_Click(object sender, EventArgs e)
        {
            ezPoint cornerPoint = new ezPoint(line_1, line_2);

            txtCenter_Results_CenterX.Text = cornerPoint.x.ToString("0.000");
            txtCenter_Results_CenterY.Text = cornerPoint.y.ToString("0.000");
        }