Exemple #1
0
 public VideoProcess()
 {
     //laser = new Mrg.LaserDetect();
     laser = new LaserDetect();
     point = new Mrg.Point();
     //point = new AForge.Point();
     cameraList = new ArrayList();
     p = new Preview(this);
     getCamereaList();
 }
Exemple #2
0
        }//closeVideoSource()

        public Bitmap getCurrentImageShotInfo(out Mrg.Point p, out Color c)
        {
            c = this.laserColor;
            p = this.point;
            string tpo = p.ToString();
            string X = p.getX().ToString();
            string Y = p.getY().ToString();
            try
            {
                if (getPoint == 1)
                {
                    WritePoints("shoot" + count.ToString());
                    count++;
                }
                //else
                //{
                //    count = 1;
                //}
            }
            catch (Exception e)
            { 
            }
            return img;
        }
Exemple #3
0
        private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            string y = "";
            string xx = "";
            string yy = "";
            try
            {
                img = (Bitmap)eventArgs.Frame.Clone();
                Graphics dci = Graphics.FromImage(img);
                Pen pe = new Pen(Color.Black, 7);
                dci.DrawLine(pe, 0, 430, img.Width, 430); // Draw yellow horizontal line
                dci.DrawLine(pe, 0, 385, img.Width, 385); // Draw yellow horizontal line
                //dci.DrawLine(pe, 0, 348, img.Width, 348); // Draw yellow horizontal line
                //dci.DrawLine(pe, 0, 318, img.Width, 318); // Draw yellow horizontal line
                //dci.DrawLine(pe, 26, 472, img.Width-50, 64); // Draw yellow horizontal line
                //dci.DrawLine(pe, img.Width-50, 460, img.Width - 500, 42); // Draw yellow horizontal line
                //dci.DrawLine(pe, 0, 260, img.Width, 260); // Draw yellow horizontal line
                //dci.DrawLine(pe, 335, 0, 335, img.Height); // Draw yellow horizontal line
                //dci.DrawLine(pe, xPos, 0, xPos, image.Height); // Draw yellow vertical line

                dci.Dispose();

                point = laser.ProcessFrame(ref img, out laserColor);
                y = point.ToString();
                xx = point.getX().ToString();
                yy = point.getY().ToString();
            }
            catch(Exception e)
            {
            }
            /*if (getPoint == 1)
            {
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"G:\Target\kjhkh\QBD-2011\QBD-2011\WriteLines2.txt", true))
                {
                    file.WriteLine(y);
                }
            }*/
            
             
            try
            {
                if (getPoint == 1)
                {
                    if (!fileDelete)
                    {
                        if (File.Exists(Login.fileName + fileNameEnd + ".txt"))
                        {
                            File.Delete(Login.fileName + fileNameEnd + ".txt");
                        }
                        fileDelete = true;
                    }
                    WritePoints(xx + ":" + yy);
                }
                if (showPreview)
                {
                    p.previewPictureBox.Image = img;
                }
            }
            catch (Exception ne) { }
            //MessageBox.Show(string.Format("w: {0} h: {1}", img.Width.ToString(), img.Height.ToString()));
        }