Пример #1
0
 public void SetAngle(double Angle, Size FOV, bool Reload = true)
 {
     this.Angle = Angle;
     if (this.ProcessingGerberImage != null)
     {
         this.ProcessingGerberImage.Dispose();
         this.ProcessingGerberImage = null;
     }
     this.ProcessingGerberImage = ImageProcessingUtils.ImageRotation(this.OrgGerberImage.Copy(), new Point(this.OrgGerberImage.Width / 2, this.OrgGerberImage.Height / 2), this.Angle * Math.PI / 180.0);
     if (Reload)
     {
         this.UpdatePadItems();
         this.ResetMark();
     }
 }
Пример #2
0
 public static void PreCapture(Model mModel, string ID, string SavePath, int Index, Image <Bgr, byte> Img, Image <Gray, byte> ImgGerber, Rectangle ROI, Rectangle ROIGerber)
 {
     lock (mModel)
     {
     }
     using (Image <Bgr, byte> imgRotated = ImageProcessingUtils.ImageRotation(Img, new Point(Img.Width / 2, Img.Height / 2), -mModel.AngleAxisCamera * Math.PI / 180.0))
         using (Image <Bgr, byte> imgUndis = new Image <Bgr, byte>(imgRotated.Size))
         {
             CvInvoke.Undistort(imgRotated, imgUndis, mCalibImage.CameraMatrix, mCalibImage.DistCoeffs, mCalibImage.NewCameraMatrix);
             imgUndis.ROI = ROI;
             string fileName = string.Format("{0}//Image_{1}_ROI({2}_{3}_{4}_{5})_ROI_GERBER({6}_{7}_{8},{9}).png",
                                             SavePath, Index + 1, ROI.X, ROI.Y, ROI.Width, ROI.Height,
                                             ROIGerber.X, ROIGerber.Y, ROIGerber.Width, ROIGerber.Height);
             CvInvoke.Imwrite(fileName, imgUndis);
         }
 }
Пример #3
0
        private void cbFOV_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!mLoaded)
            {
                return;
            }
            if (mMark == null)
            {
                CaptureMark();
            }
            int id = -1;

            this.Dispatcher.Invoke(() =>
            {
                id = cbFOV.SelectedIndex;
            });

            if (cbFOV.SelectedIndex > -1)
            {
                System.Drawing.Point fov = mAnchorFOV[id];
                int x = fov.X;
                int y = fov.Y;

                bool lightStrobe = !Convert.ToBoolean(mParam.LIGHT_MODE);
                if (mImage != null)
                {
                    mImage.Dispose();
                    mImage = null;
                }
                mLog.Info(string.Format("{0}, Position Name : {1},  X = {2}, Y = {3}", "Moving TOP Axis", "FOV " + (id + 1).ToString(), x, y));
                using (Image <Bgr, byte> image = VI.CaptureImage.CaptureFOV(mPlcComm, mCamera, fov, 1000))
                {
                    mImage = ImageProcessingUtils.ImageRotation(image, new System.Drawing.Point(image.Width / 2, image.Height / 2), -mModel.AngleAxisCamera * Math.PI / 180.0).Copy();
                    mImage = ImageProcessingUtils.ImageTransformation(mImage, mMarkAdjust.X, mMarkAdjust.Y);
                    ShowDetail();
                }
            }
        }
Пример #4
0
 public Image <Gray, byte> RotateImage(Image <Gray, byte> ImgInput, double Angle)
 {
     return(ImageProcessingUtils.ImageRotation(ImgInput, new Point(ImgInput.Width / 2, ImgInput.Height / 2), Angle));
 }