示例#1
1
        //CONSTRUCTOR
        public LiveDisplayUpdater(ImageBox video_display)
            : base(video_display)
        {
            Debug.WriteLine("display updater starting");

            this.video_display      = video_display;
            WORK_DONE               = false;
        }
示例#2
0
        //CONSTRUCTOR
        public DisplayUpdaterThread(ImageBox video_display)
            : base()
        {
            Debug.WriteLine("display updater starting");

            this.video_display           = video_display;
        }
示例#3
0
        /// <summary>
        /// Constructor.  The image provided will be automatically displayed when the form is shown.
        /// </summary>
        /// <param name="image">The image to be displayed when the window is shown.</param>
        public FormImageEdit( SourceImage image )
        {
            InitializeComponent();

            //setup the window and variables
            sourceImage = image;
            labelFileNameData.Text = sourceImage.name;
            this.Text += " ( " + sourceImage.name + " ) ";
            sourceImageOrganizer = SourceImageOrganizer.getInstance();

            //setup the ImageBox and the picture it will display
            imageBox1 = new ImageBox();
            imageBox1.Image = new Image<Bgr, byte>(sourceImage.path);
            imageBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;
            imageBox1.MouseDown += new MouseEventHandler(imageBox1_MouseDown);
            imageBox1.MouseUp += new MouseEventHandler(imageBox1_MouseUp);

            //setup the image panel, add the image
            //this is necessary for scroll bars
            panelImagePanel.AutoScroll = true;
            panelImagePanel.Controls.Add(imageBox1);

            showHistogram();
        }
 public void addImage( string imageId, string imageType, Emgu.CV.Image<Emgu.CV.Structure.Gray, byte> image )
 {
     ensureImageBoxNamesUpdated( imageType );
     ImageBox ib = new ImageBox();
     ib.Image = image;
     ib.Width = 100;
     ib.Height = 100;
     ib.SizeMode = PictureBoxSizeMode.Zoom;
     ib.HorizontalScrollBar.Visible = false;
     ib.VerticalScrollBar.Visible = false;
     if ( _imageBoxNames[ 0 ].CompareTo( imageType ) == 0 )
     {
         flowPanel1.Controls.Add( ib );
         return;
     }
     if ( _imageBoxNames[ 1 ].CompareTo( imageType ) == 0 )
     {
         flowPanel2.Controls.Add( ib );
         return;
     }
     if ( _imageBoxNames[ 2 ].CompareTo( imageType ) == 0 )
     {
         flowPanel3.Controls.Add( ib );
     }
     return;
 }
示例#5
0
        public Sandbox(ImageBox imageBox, String source, String detector, TextBox textBox)
        {
            _imageBox = imageBox;
            _textBox = textBox;

            AssignCaptureSource(source, detector);
        }
        public frmPruebaMano()
        {
            InitializeComponent();

            detector = new AdaptiveSkinDetector(1, AdaptiveSkinDetector.MorphingMethod.NONE);

            YCrCb_min = new Ycc(0, 131, 80);
            YCrCb_max = new Ycc(255, 185, 135);

            imgCaja = new ImageBox();
            imgCaja.Height = 306;
            imgCaja.Width = 430;
            imgCaja.Location = new System.Drawing.Point(12, 42);
            imgCaja.SizeMode = PictureBoxSizeMode.StretchImage;

            imgCaja2 = new ImageBox();
            imgCaja2.Height = 306;
            imgCaja2.Width = 430;
            imgCaja2.Location = new System.Drawing.Point(478, 42);
            imgCaja2.SizeMode = PictureBoxSizeMode.StretchImage;

            imgCaja.BorderStyle = BorderStyle.FixedSingle;
            imgCaja2.BorderStyle = BorderStyle.FixedSingle;

            this.Controls.Add(imgCaja);
            this.Controls.Add(imgCaja2);

            imgCaja.Show();
        }
示例#7
0
        //CONSTRUCTOR
        public ReviewDisplayUpdater(ImageBox video_display)
            : base(video_display)
        {
            Debug.WriteLine("Review display updater starting");
            WORK_DONE                                           = false;

            time_elapsed_in_seconds_global                      = 0;

            if (Singleton.CURRENT_VIDEO_FILE != null)
            {
                //TO FIND THE MILLISECONDS THAT HAVE TO ELAPSE BEFORE MOVING  THE SLIDER,I DIVIDED THE
                //VIDEO_LENGTH BY 100 WHICH IS THE TOTAL PERCENTAGE OF A SLIDER
                double milliseconds_between_moving_slider = (((Singleton.CURRENT_VIDEO_FILE.video_length_in_millisecs)) / (double)100);

                //TO GET SECS DIVIDE BY 1000 : 1 SEC                = 1000MSC
                seconds_btn_moving_slider = milliseconds_between_moving_slider / 1000;

                //SET A TIMER THAT FIRES AFTER THE INTERVAL SO WE CAN MOVE THE SLIDER
                timer = new System.Timers.Timer(milliseconds_between_moving_slider);

                //BOOL SET WHENEVER TIMER FIRES
                time_interval_has_elapsed = false;

                //SET TIMER HANDLERS
                timer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimeExpired);

                //SET VIDEO LENGTH TIME BEFORE THE VIDEO STARTS PLAYING
                Label total_time = (Label)Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.total_time);

                total_time.Text = "" + Singleton.CURRENT_VIDEO_FILE.video_length_string;

                //ENABLE TIMER
                timer.Enabled = true;
            }
        }
示例#8
0
        public void ConfigureBoxSelections(ImageBox imageBox)
        {
            imageBox.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;
            imageBox.MouseDown += imageBoxTracking_MouseDown;
            imageBox.MouseUp += imageBoxTracking_MouseUp;
            imageBox.MouseMove += imageBoxTracking_MouseMove;

            _imageBox = imageBox;
        }
        /// <summary>
        /// Draws trangulated poly
        /// </summary>
        /// <param name="img">Image we're drawing to</param>
        /// <param name="trisList">Triangles list</param>
        /// <param name="imgBox">Box we're inserting image to</param>
        public void drawTris(Image <Gray, Byte> img, Triangle2DF[] trisList, ref Emgu.CV.UI.ImageBox imgBox)
        {
            //Draw the Delaunay triangulation
            foreach (Triangle2DF tri in trisList)
            {
                img.Draw(tri, new Gray(128.0f), 2);
            }

            imgBox.Image = img;
        }
        /// <summary>
        /// Draws trangulated poly to colored Bgr image in green
        /// </summary>
        /// <param name="img">Image we're drawing to</param>
        /// <param name="trisList">Triangles list</param>
        /// <param name="imgBox">Box we're inserting image to</param>
        public void drawTris(Image <Bgr, Byte> img, Triangle2DF[] trisList, ref Emgu.CV.UI.ImageBox imgBox)
        {
            //Draw the Delaunay triangulation
            foreach (Triangle2DF tri in trisList)
            {
                img.Draw(tri, new Bgr(Color.DarkOliveGreen), 1);
            }

            imgBox.Image = img;
        }
示例#11
0
		void InitializeComponent()
		{
			//clear controls in case init is called multiple times
			Controls.Clear();

			//add imagebox
			FImageBox = new ImageBox();

			//add to controls
			Controls.Add(FImageBox);
		}
示例#12
0
 /// <summary>
 /// Constructor of ScanEngine
 /// </summary>
 /// <param name="ip"></param>
 public ScanEngine(iProcess ip, ImageBox img_box)
 {
     this.img_box = img_box;
     rawImages = new List<Image<Bgr, byte>>();
     textImages = new List<Image<Bgr, byte>>();
     this.iproc = ip;
     this.nxt = new Nxt();
     bgWorker.WorkerReportsProgress = true;
     bgWorker.WorkerSupportsCancellation = true;
     bgWorker.DoWork += new DoWorkEventHandler(bw_DoWork);
     bgWorker.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
     bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
 }
示例#13
0
        public Form1()
        {
            InitializeComponent();

            im1           = imageBox1;
            im2           = imageBox2;
            shapes        = new List <ShapeColorObject>();
            trackedshapes = new List <ShapeColorObject>();
            chosenshapes  = new List <ShapeColorObject>();
            //im1.SizeMode = PictureBoxSizeMode.Zoom;
            //im2.SizeMode = PictureBoxSizeMode.Zoom;
            listBox1.MultiColumn = true;
            font = new MCvFont(Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_PLAIN, 1, 1);
        }
示例#14
0
        void CheckInPage_Loaded(object sender, RoutedEventArgs e)
        {
            full_tesseract = new TesseractProcessor();
            bool succeed = full_tesseract.Init(m_path, m_lang, 3);

            if (!succeed)
            {
                System.Windows.MessageBox.Show("Lỗi thư viện Tesseract. Chương trình cần kết thúc.");
            }
            full_tesseract.SetVariable("tessedit_char_whitelist", "ACDFHKLMNPRSTVXY1234567890").ToString();

            ch_tesseract = new TesseractProcessor();
            succeed      = ch_tesseract.Init(m_path, m_lang, 3);
            if (!succeed)
            {
                System.Windows.MessageBox.Show("Lỗi thư viện Tesseract. Chương trình cần kết thúc.");
            }
            ch_tesseract.SetVariable("tessedit_char_whitelist", "ACDEFHKLMNPRSTUVXY").ToString();

            num_tesseract = new TesseractProcessor();
            succeed       = num_tesseract.Init(m_path, m_lang, 3);
            if (!succeed)
            {
                System.Windows.MessageBox.Show("Lỗi thư viện Tesseract. Chương trình cần kết thúc.");
            }
            num_tesseract.SetVariable("tessedit_char_whitelist", "1234567890").ToString();

            System.Environment.CurrentDirectory = System.IO.Path.GetFullPath(m_path);
            for (int i = 0; i < box.Length; i++)
            {
                box[i] = new PictureBox();
            }
            string folder = System.AppDomain.CurrentDomain.BaseDirectory + "\\ImageTest";

            foreach (string fileName in Directory.GetFiles(folder, "*.bmp", SearchOption.TopDirectoryOnly))
            {
                lstimages.Add(System.IO.Path.GetFullPath(fileName));
            }
            foreach (string fileName in Directory.GetFiles(folder, "*.jpg", SearchOption.TopDirectoryOnly))
            {
                lstimages.Add(System.IO.Path.GetFullPath(fileName));
            }

            pic1 = (hostPic1.Child as System.Windows.Forms.PictureBox);
            pic2 = (hostPic2.Child as System.Windows.Forms.PictureBox);
            img1 = (hostImg1.Child as Emgu.CV.UI.ImageBox);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\MainWindow.xaml"
                ((EmgucvApp.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.originImage = ((Emgu.CV.UI.ImageBox)(target));
                return;

            case 3:
                this.sampleImage = ((Emgu.CV.UI.ImageBox)(target));
                return;

            case 4:
                this.infoShow = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.startCamera = ((System.Windows.Controls.Button)(target));

            #line 35 "..\..\MainWindow.xaml"
                this.startCamera.Click += new System.Windows.RoutedEventHandler(this.StartCamera_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.collectionSample = ((System.Windows.Controls.Button)(target));

            #line 36 "..\..\MainWindow.xaml"
                this.collectionSample.Click += new System.Windows.RoutedEventHandler(this.CollectionSample_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        private void AddLabelAndImage(ref Point startPoint, String labelText, IImage image)
        {
            Label label = new Label();
             panel1.Controls.Add(label);
             label.Text = labelText;
             label.Width = 100;
             label.Height = 30;
             label.Location = startPoint;
             startPoint.Y += label.Height;

             ImageBox box = new ImageBox();
             panel1.Controls.Add(box);
             box.ClientSize = image.Size;
             box.Image = image;
             box.Location = startPoint;
             startPoint.Y += box.Height + 10;
        }
示例#17
0
        public void Init(Emgu.CV.UI.ImageBox ibOriginal, Emgu.CV.UI.ImageBox ibDetected /*, EventHandler<Interface.CameraStatusChangedEventArgs> esemeny*/)
        {
            try
            {
                //CameraStatusChanged += esemeny;
                calOk                                      = false;
                newGame                                    = true;
                this.ibOriginal                            = ibOriginal;
                this.ibDetected                            = ibDetected;
                calib                                      = new Calibrator(40, 43, 429);
                captureInProgress                          = true;
                detectGrid                                 = true;
                detectXO                                   = true;
                rotate                                     = false;
                processor                                  = new ImageProcessor();
                processor.equalizeHist                     = false;
                processor.finder.maxRotateAngle            = Math.PI;
                processor.minContourArea                   = 10;
                processor.minContourLength                 = 15;
                processor.finder.maxACFDescriptorDeviation = 4;
                processor.finder.minACF                    = 0.96;
                processor.finder.minICF                    = 0.85;
                processor.blur                             = true;
                processor.noiseFilter                      = false;
                processor.cannyThreshold                   = 50;
                processor.adaptiveThresholdBlockSize       = 4;
                processor.adaptiveThresholdParameter       = 1.5;
                processor.templates.Clear();
                TemplateGenerator.GenerateChars(processor, new char[] { 'X', 'O' }, new System.Drawing.Font(new FontFamily("Consolas"), 100, FontStyle.Regular));

                status   = CameraStatus.Online;
                statusOk = false;

                capture = new Capture();
                capture.ImageGrabbed += ProcessFrame2;
                OnCameraStatusChanged(CameraStatus.Online);
                prevPiece = false;
                nextPiece = false;
            }
            catch (Exception ex)
            {
                OnCameraStatusChanged(CameraStatus.Offline);
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.CapturedImageBox = ((Emgu.CV.UI.ImageBox)(target));
                return;

            case 2:
                this.button1 = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\CameraWindow.xaml"
                this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((GazeTrackerUI.TrackerViewer.VideoImageControl)(target));
                return;

            case 2:
                this.GridImage = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.windowsFormsHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
                return;

            case 4:
                this.pictureBox = ((Emgu.CV.UI.ImageBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#20
0
		void InitializeComponent()
		{
			this.FImageBox = new Emgu.CV.UI.ImageBox();
			((System.ComponentModel.ISupportInitialize)(this.FImageBox)).BeginInit();
			this.SuspendLayout();
			// 
			// FImageBox
			// 
			this.FImageBox.Location = new System.Drawing.Point(0, 0);
			this.FImageBox.Name = "FImageBox";
			this.FImageBox.Size = this.Size;
			this.FImageBox.TabIndex = 2;
			this.FImageBox.TabStop = false;
			// 
			// ImageViewNode
			// 
			this.Controls.Add(this.FImageBox);
			this.Name = "ImageViewNode";
			this.Size = new System.Drawing.Size(531, 344);
			this.Resize += new System.EventHandler(this.ImageViewNode_Resize);
			((System.ComponentModel.ISupportInitialize)(this.FImageBox)).EndInit();
			this.ResumeLayout(false);
		}
示例#21
0
文件: Photos.cs 项目: neonmax/cdap
        public void FillBoxByFace(ImageBox image)
        {
            //Get a gray frame from capture device
            gray = grabber.QueryGrayFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);

            //Face Detector
            MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(face,1.2,10,Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,new Size(20, 20));

            //Action for each element detected
            foreach (MCvAvgComp f in facesDetected[0])
            {
                TrainedFace = currentFrame.Copy(f.rect).Convert<Gray, byte>();
                break;
            }

            //resize face detected image for force to compare the same size with the
            //test image with cubic interpolation type method
            TrainedFace = result.Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
            //trainingImages.Add(TrainedFace);
            //labels.Add(textBox1.Text);

            //Show face added in gray scale
            image.Image = TrainedFace;
        }
示例#22
0
 private void showImage(ImageBox pic, IImage img)
 {
     int zoom = 16;
     pic.Size = new Size(img.Size.Width * zoom / 10, img.Size.Height * zoom / 10);
     pic.Image = img;
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.UserControl = ((GazeTrackerUI.TrackerViewer.VideoImageControl)(target));
     return;
     case 2:
     this.GridImage = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.windowsFormsHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
     return;
     case 4:
     this.pictureBox = ((Emgu.CV.UI.ImageBox)(target));
     return;
     }
     this._contentLoaded = true;
 }
示例#24
0
        private void networkByteStreamToMatFrame(object sock)
        {
            Socket socket = (Socket)sock;

            byte[] extaLeftOver = { };

            bool done         = false;
            int  lastfilesize = 0;

            SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : Streaming Started..\r\n");

            displayControl dc = (displayControl)_manageDispCtrl.getAvailableDisplayNotInUse();

            if (dc == null)
            {
                SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : All screens occupied cannot add more connections. **ERROR** ..\r\n");
                return;
            }
            _cibox = (dc)._cibox;
            _manageDispCtrl.setDisplayIndexInUSe(_cibox);

            SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : delegated to screen  [" + dc.id + "]..\r\n");

            //ImageBox im3 = ((displayControl)_manageDispCtrl.getAvailableDisplayNotInUse())._cibox;

            //_manageDispCtrl.setDisplayIndexInUSe(im3);

            //ImageBox im4 = ((displayControl)_manageDispCtrl.getAvailableDisplayNotInUse())._cibox;

            //_manageDispCtrl.setDisplayIndexInUSe(im4);

            while (!done)
            {
                Dictionary <string, string> headers = new Dictionary <string, string>();

                if (extaLeftOver.Length == 0)
                {
                    try
                    {
                        socket.Receive(header);
                    }
                    catch (ObjectDisposedException ode)
                    {
                        done = true;
                    }
                    catch (SocketException se)
                    {
                        if (se.ErrorCode == 10054)
                        {
                            socket.Close();
                        }

                        done = true;
                    }
                }
                else
                {
                    byte[] headerExtracted = SubArray(extaLeftOver, 0, 1024); // assuming constant hearder size 1024
                    byte[] streamBuffer    = SubArray(extaLeftOver, 1024, extaLeftOver.Length - 1024);
                }

                //SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : Header received..\r\n");

                string headerStr = Encoding.ASCII.GetString(header);


                string[] splitted = headerStr.Split(new string[] { "\r\n" }, StringSplitOptions.None);

                foreach (string s in splitted)
                {
                    if (s.Contains(":"))
                    {
                        headers.Add(s.Substring(0, s.IndexOf(":")), s.Substring(s.IndexOf(":") + 1));
                    }
                }


                try
                {
                    int filesize = Convert.ToInt32(headers["Content-length"]);
                    //Get filesize from header

                    if (filesize != lastfilesize)
                    {
                        SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : Updated file size = " + filesize + "..\r\n");
                        Array.Resize(ref buffer, filesize);
                    }


                    lastfilesize = filesize;

                    byte[] temp = { };

                    int recvsize = 0;
                    while (recvsize < filesize)
                    {
                        int size = socket.Receive(buffer, SocketFlags.None);
                        if (size > filesize - recvsize)
                        {
                            int wastedBytes = (size - (filesize - recvsize));
                            //SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : Data Wasted = " + wastedBytes + "....\r\n");

                            size         = filesize - recvsize;
                            extaLeftOver = SubArray(buffer, size - 1, wastedBytes);
                        }

                        temp      = temp.Concat(buffer.Take(size)).ToArray();
                        recvsize += size;
                    }


                    _cibox.Image = _camMemSerialDeserial.Deserialize <matFrameWrapper>(temp).MyProperty;

                    string ackString = "DONE";
                    byte[] ackFrame  = new byte[ackString.Length];
                    Array.Copy(Encoding.ASCII.GetBytes(ackString), ackFrame, Encoding.ASCII.GetBytes(ackString).Length);

                    socket.Send(ackFrame);
                }
                catch (Exception e)
                {
                    continue;
                }
            }

            SetText("Server[" + Thread.CurrentThread.ManagedThreadId + "] : Streaming Stopped..\r\n");
            _manageDispCtrl.ResetDisplayIndexInUSe(_cibox);
        }
示例#25
0
 private void showSplit()
 {
     this.Invoke(new SimpleHandler(() => {
         splitter1.Controls.Clear();
         foreach (var split in splitted_chars.Reverse<Image<Gray, Byte>>()) {
             if (split.Width > splitter1.SplitPosition) {
                 splitter1.SplitPosition = split.Width;
             }
             var box = new ImageBox();
             box.Dock = DockStyle.Top;
             box.Height = split.Height + 2;
             box.Image = split;
             splitter1.Controls.Add(box);
         }
     }));
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.CapturedImageBox = ((Emgu.CV.UI.ImageBox)(target));
     return;
     case 2:
     this.button1 = ((System.Windows.Controls.Button)(target));
     
     #line 23 "..\..\CameraWindow.xaml"
     this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
示例#27
0
 private void ShowEye(Image<Bgr, byte> eye, ImageBox imageBox)
 {
     imageBox.Width = eye.ROI.Width * 2;
     imageBox.Height = eye.ROI.Height * 2;
     imageBox.Image = eye;
 }
示例#28
0
        /// <summary>
        /// Initialize the class preferences
        /// </summary>
        /// <param name="image"></param>
        /// <param name="imageBox1"></param>
        /// <returns></returns>
        public Image<Gray, Byte> init(Image<Bgr, Byte>  image, ImageBox imageBox1)
        {
            // First turn the color depth to 8bits
            Image<Gray, Byte> greyImage;
            greyImage = image.Convert<Gray, Byte>().PyrUp().PyrDown();

            // Value for which the colour depth of each single pixel is taken into
            // consideration. (Now <= than 255 are taken into consideration)
            Gray maxDepthColor = new Gray(255);
            Image<Gray, Byte> testImage = greyImage;
            int thresholdValue = 25;
            int increaseStep = 5;
            // Threshold value
            Gray thresholdGray = new Gray(35);
            // Blocksize of the chuncks getting check to determine
            // average gray value each pixel.
            int blocksize = 77;
            // Apply the thresholding
            testImage = greyImage.ThresholdAdaptive(maxDepthColor, Emgu.CV.CvEnum.ADAPTIVE_THRESHOLD_TYPE.CV_ADAPTIVE_THRESH_GAUSSIAN_C, Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY_INV, blocksize, thresholdGray);
            // Get the height and assume the tyres are on the lower part
            increaseStep += 5;

            int halfHeight = greyImage.Height / 2;
            int halfWidth = greyImage.Width / 2;

            this.Width = image.Width;
            this.Height = image.Height;

            greyImage.Dispose();
            return testImage;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 103 "..\..\SequenceCaptureMainWindow.xaml"
                ((System.Windows.Shapes.Rectangle)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.DragWindow);

            #line default
            #line hidden
                return;

            case 2:
                this.GridTop = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:

            #line 113 "..\..\SequenceCaptureMainWindow.xaml"
                ((System.Windows.Controls.Label)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.DragWindow);

            #line default
            #line hidden
                return;

            case 4:
                this.X = ((System.Windows.Controls.Label)(target));

            #line 121 "..\..\SequenceCaptureMainWindow.xaml"
                this.X.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.AppClose);

            #line default
            #line hidden
                return;

            case 5:
                this._ = ((System.Windows.Controls.Label)(target));

            #line 122 "..\..\SequenceCaptureMainWindow.xaml"
                this._.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.AppMinimize);

            #line default
            #line hidden
                return;

            case 6:
                this.GridCameraImage = ((System.Windows.Controls.Grid)(target));
                return;

            case 7:
                this.windowsFormsHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
                return;

            case 8:
                this.imageBoxCapturedFrame = ((Emgu.CV.UI.ImageBox)(target));
                return;

            case 9:
                this.GridSessions = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.GridSaveImagesProgress = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.progressBarSaveImages = ((System.Windows.Controls.ProgressBar)(target));
                return;

            case 12:
                this.GridUsername = ((System.Windows.Controls.Grid)(target));
                return;

            case 13:
                this.TextBoxUsername = ((System.Windows.Controls.TextBox)(target));
                return;

            case 14:
                this.GridDeviceName = ((System.Windows.Controls.Grid)(target));
                return;

            case 15:
                this.TextBoxDevice = ((System.Windows.Controls.TextBox)(target));
                return;

            case 16:
                this.GridIRSources = ((System.Windows.Controls.Grid)(target));
                return;

            case 17:
                this.RadioIR0 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 18:
                this.RadioIR1 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 19:
                this.RadioIR2 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 20:
                this.RadioIR3 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 21:
                this.RadioIR4 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 22:
                this.RadioIR5 = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 23:
                this.GridLens = ((System.Windows.Controls.Grid)(target));
                return;

            case 24:
                this.TextBoxLens = ((System.Windows.Controls.TextBox)(target));
                return;

            case 25:
                this.GridLensParameters = ((System.Windows.Controls.Grid)(target));
                return;

            case 26:
                this.GridLensMM = ((System.Windows.Controls.Grid)(target));
                return;

            case 27:
                this.TextBoxLensMM = ((System.Windows.Controls.TextBox)(target));
                return;

            case 28:
                this.GridLensIris = ((System.Windows.Controls.Grid)(target));
                return;

            case 29:
                this.TextBoxLensIris = ((System.Windows.Controls.TextBox)(target));
                return;

            case 30:
                this.RadioCameraViewBinocular = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 31:
                this.RadioCameraViewMonocular = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 32:
                this.RadioCameraViewHeadmounted = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 33:
                this.TextBoxNotes = ((System.Windows.Controls.TextBox)(target));
                return;

            case 34:
                this.GridShareData = ((System.Windows.Controls.Grid)(target));
                return;

            case 35:
                this.CheckBoxShareData = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 36:
                this.BtnRun = ((GazeGUI.ButtonGlass)(target));

            #line 226 "..\..\SequenceCaptureMainWindow.xaml"
                this.BtnRun.ButtonAction += new System.Windows.RoutedEventHandler(this.RunCapture);

            #line default
            #line hidden
                return;

            case 37:
                this.GridShowSyncUI = ((System.Windows.Controls.Grid)(target));
                return;

            case 38:
                this.CheckBoxShowSyncUI = ((System.Windows.Controls.CheckBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#30
0
 private void ShowBitMapEye(Image<Gray, byte> eye, ImageBox imageBox)
 {
     imageBox.Width = eye.ROI.Width * 2;
     imageBox.Height = eye.ROI.Height * 2;
     imageBox.Image = eye;
 }
        /*******************************************************
        * calcBackgroundAvg(()
        * 
        * Calculates background avrege color in LUV, backgr based on binary segmentation
        * 
        * input: original image (Bgr), min values vector, threshold for segmentation
        * output: image avrege color in LUV
        * ******************************************************/
        //   private Image<Gray, Byte> toBin
        // ne pozabi na invert
        private Luv calcBackgroundAvg(Image<Bgr, Byte> refImage, float thresh, ref ImageBox imageBox)
        {
            // to binary
            Image<Gray, Byte> binImage = refImage.Convert<Gray, Byte>().PyrDown().PyrUp().ThresholdBinary(new Gray(thresh), new Gray(255));

            // to luv
            Image<Luv, float> luvImage = refImage.Convert<Luv, float>();

            // show bin img
            if (imageBox != null)
                imageBox.Image = binImage;

            int pixCount = 0; // stevec pikslov
            double ch1 = 0.0f;
            double ch2 = 0.0f;
            double ch3 = 0.0f;

            for (int i = 0; i < binImage.Width; i++)
            {
                for (int j = 0; j < binImage.Height; j++)
                {
                    // piksel predstavlja ozadje? (bel)
                    if (binImage[j, i].Intensity == 255)
                    {
                        pixCount++;

                        ch1 += luvImage[j, i].X;
                        ch2 += luvImage[j, i].X;
                        ch3 += luvImage[j, i].X;
                    }
                }
            }

            ch1 /= (double)pixCount;
            ch2 /= (double)pixCount;
            ch3 /= (double)pixCount;

            MessageBox.Show(ch1.ToString() + " " + ch2.ToString() + " " + ch3.ToString());

            return new Luv(ch1, ch2, ch3);

        }
示例#32
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ImagePropertyDialog(ImageBox imageBox)
 {
     InitializeComponent();
     imagePropertyControl.ImageBox = imageBox;
 }
示例#33
0
 public static DisplayUpdaterThread CreateLiveDisplayUpdaterThread(ImageBox image_box)
 {
     live_display_updater = new LiveDisplayUpdater(image_box);
     live_display_updater.StartWorking();
     return live_display_updater;
 }
示例#34
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ImagePropertyDialog(ImageBox imageBox)
 {
    InitializeComponent();
    imagePropertyControl.ImageBox = imageBox;
 }
示例#35
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PropertyDialog(ImageBox imageBox)
 {
    InitializeComponent();
    _imageBox = imageBox;
    imageProperty1.ImageBox = _imageBox;
 }
示例#36
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 17 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                ((SPI_AOI.Views.ModelManagement.GerberTools)(target)).Initialized += new System.EventHandler(this.Window_Initialized);

            #line default
            #line hidden

            #line 18 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                ((SPI_AOI.Views.ModelManagement.GerberTools)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);

            #line default
            #line hidden

            #line 19 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                ((SPI_AOI.Views.ModelManagement.GerberTools)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden

            #line 20 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                ((SPI_AOI.Views.ModelManagement.GerberTools)(target)).KeyUp += new System.Windows.Input.KeyEventHandler(this.Window_KeyUp);

            #line default
            #line hidden
                return;

            case 2:
                this.chbHighlightPadLinked = ((System.Windows.Controls.MenuItem)(target));

            #line 50 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.chbHighlightPadLinked.Click += new System.Windows.RoutedEventHandler(this.chbHighlightPadLinked_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.chbShowLinkLine = ((System.Windows.Controls.MenuItem)(target));

            #line 51 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.chbShowLinkLine.Click += new System.Windows.RoutedEventHandler(this.chbShowLinkLine_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.chbShowComponentCenter = ((System.Windows.Controls.MenuItem)(target));

            #line 52 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.chbShowComponentCenter.Click += new System.Windows.RoutedEventHandler(this.chbShowComponentCenter_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.chbShowComponentName = ((System.Windows.Controls.MenuItem)(target));

            #line 53 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.chbShowComponentName.Click += new System.Windows.RoutedEventHandler(this.chbShowComponentName_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.toolBarMain = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 7:
                this.btImportGerber = ((System.Windows.Controls.Button)(target));

            #line 68 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btImportGerber.Click += new System.Windows.RoutedEventHandler(this.btImportGerber_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.btImportCad = ((System.Windows.Controls.Button)(target));

            #line 74 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btImportCad.Click += new System.Windows.RoutedEventHandler(this.btImportCad_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.btSetROI = ((System.Windows.Controls.Button)(target));

            #line 80 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btSetROI.Click += new System.Windows.RoutedEventHandler(this.btSetROI_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.btRotation = ((System.Windows.Controls.Button)(target));

            #line 86 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btRotation.Click += new System.Windows.RoutedEventHandler(this.btRotation_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.btSelectPad = ((System.Windows.Controls.Button)(target));

            #line 92 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btSelectPad.Click += new System.Windows.RoutedEventHandler(this.btSelectPad_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.btAdjustsadxXY = ((System.Windows.Controls.Button)(target));

            #line 98 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btAdjustsadxXY.Click += new System.Windows.RoutedEventHandler(this.btAdjustXY_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.btLinkPad = ((System.Windows.Controls.Button)(target));

            #line 104 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btLinkPad.Click += new System.Windows.RoutedEventHandler(this.btLinkPad_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.btSetLinkPad = ((System.Windows.Controls.Button)(target));

            #line 110 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btSetLinkPad.Click += new System.Windows.RoutedEventHandler(this.btSetLinkPad_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.btDeleteLinkPad = ((System.Windows.Controls.Button)(target));

            #line 116 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btDeleteLinkPad.Click += new System.Windows.RoutedEventHandler(this.btDeleteLinkPad_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.btPadSettings = ((System.Windows.Controls.Button)(target));

            #line 122 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btPadSettings.Click += new System.Windows.RoutedEventHandler(this.btPadSettings_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.btMark1 = ((System.Windows.Controls.Button)(target));

            #line 128 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btMark1.Click += new System.Windows.RoutedEventHandler(this.btMark1_Click);

            #line default
            #line hidden
                return;

            case 18:
                this.btMark2 = ((System.Windows.Controls.Button)(target));

            #line 134 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.btMark2.Click += new System.Windows.RoutedEventHandler(this.btMark2_Click);

            #line default
            #line hidden
                return;

            case 19:
                this.imBox = ((Emgu.CV.UI.ImageBox)(target));

            #line 151 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.imBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.imBox_MouseDown);

            #line default
            #line hidden

            #line 152 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.imBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.imBox_MouseUp);

            #line default
            #line hidden

            #line 153 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.imBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.imBox_MouseMove);

            #line default
            #line hidden

            #line 154 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.imBox.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.imBox_MouseWheel);

            #line default
            #line hidden

            #line 155 "..\..\..\..\..\Views\ModelManagement\GerberTools.xaml"
                this.imBox.Paint += new System.Windows.Forms.PaintEventHandler(this.imBox_Paint);

            #line default
            #line hidden
                return;

            case 20:
                this.listImportedFile = ((System.Windows.Controls.ListBox)(target));
                return;

            case 25:
                this.dgwPads = ((System.Windows.Controls.DataGrid)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#37
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 11 "..\..\..\MainWindow.xaml"
                ((GraphicsVisionFusion.MainWindow)(target)).Closed += new System.EventHandler(this.destroyAll);

            #line default
            #line hidden
                return;

            case 2:
                this.imgBox = ((Emgu.CV.UI.ImageBox)(target));
                return;

            case 3:
                this.col1up = ((System.Windows.Controls.Slider)(target));

            #line 29 "..\..\..\MainWindow.xaml"
                this.col1up.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.col1up_ValueChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.col1low = ((System.Windows.Controls.Slider)(target));

            #line 30 "..\..\..\MainWindow.xaml"
                this.col1low.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.col1low_ValueChanged);

            #line default
            #line hidden
                return;

            case 5:
                this.col2up = ((System.Windows.Controls.Slider)(target));
                return;

            case 6:
                this.col2low = ((System.Windows.Controls.Slider)(target));
                return;

            case 7:
                this.openGLControl = ((SharpGL.WPF.OpenGLControl)(target));

            #line 38 "..\..\..\MainWindow.xaml"
                this.openGLControl.OpenGLDraw += new SharpGL.SceneGraph.OpenGLEventHandler(this.openGLControl_OpenGLDraw);

            #line default
            #line hidden

            #line 38 "..\..\..\MainWindow.xaml"
                this.openGLControl.OpenGLInitialized += new SharpGL.SceneGraph.OpenGLEventHandler(this.openGLControl_OpenGLInitialized);

            #line default
            #line hidden

            #line 38 "..\..\..\MainWindow.xaml"
                this.openGLControl.Resized += new SharpGL.SceneGraph.OpenGLEventHandler(this.openGLControl_Resized);

            #line default
            #line hidden
                return;

            case 8:
                this.colorPicker = ((Xceed.Wpf.Toolkit.ColorPicker)(target));

            #line 47 "..\..\..\MainWindow.xaml"
                this.colorPicker.SelectedColorChanged += new System.Windows.RoutedPropertyChangedEventHandler <System.Nullable <System.Windows.Media.Color> >(this.ColorPicker_SelectedColorChanged);

            #line default
            #line hidden
                return;

            case 9:

            #line 52 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.rotateButton);

            #line default
            #line hidden
                return;

            case 10:

            #line 53 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.clearButton);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        /// <summary>
        /// Method detects polys from contoures, claculates poly's convex hull and triangulates it.
        /// </summary>
        /// <param name="refImg">Image</param>
        /// <param name="maxVertices">Max. vertices in poly</param>
        /// <param name="minArea">Minimal area for poly</param>
        /// <param name="maxArea">Max. area for poly</param>
        /// <param name="threshold">Threshold for segmentation</param>
        /// <param name="imageBox">Imagebox (for dumping a result)</param>
        /// <returns></returns>
        public List<PolyFromTris> detectPolysFromContures(Image<Bgr, Byte> refImg, int maxVertices, double minArea, double maxArea, float threshold, bool filter, int dilate, bool back, ref ImageBox imageBox)
        {
            // Lists, for storing data
            List<Point[]> polys = new List<Point[]>(); // Polys list
            List<Point[]> chull = new List<Point[]>(); // CONV HULL
            avgClrs = new List<Bgr>();
            List<PolyFromTris> polysTriang = new List<PolyFromTris>();

            try
            {
                Bgr backc = new Bgr(threshold, threshold, threshold);
                if (back)
                {
                    Image<Gray, Byte> maskImg = refImg.Convert<Gray, Byte>().PyrDown().PyrUp().ThresholdBinaryInv(new Gray(128.0f), new Gray(255.0f));
                    backc = refImg.GetAverage(maskImg);
                }

               // Image<Bgr, Byte> clrSeg = refImg.ThresholdBinary (back, new Bgr(120.0f, 120.0f, 120.0f));
               // imageBox.Image = clrSeg;
                // Canny
                Image<Bgr, Byte> cannyEdges = refImg.PyrUp().PyrDown().Canny(backc, new Bgr(120.0f, 120.0f, 120.0f));

                cannyEdges = cannyEdges.Dilate(dilate); // To stress borders, improves contoures detection

       
                // Conture detection & Triangulation
                using (MemStorage shramba = new MemStorage())
                    for (Contour<Point> konture = cannyEdges.Convert<Gray, Byte>().FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_TC89_L1, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_LIST, new MemStorage()); konture != null; konture = konture.HNext)
                    {
                     //   Contour<Point> trenutna = konture.ApproxPoly(konture.Perimeter * 0.005, shramba);
                        Seq<Point> convexHull = konture.ApproxPoly(konture.Perimeter * 0.005, shramba).GetConvexHull(Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE);    //konture.GetConvexHull(Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE);

                        // Calculate max. nad min. area of valid polys (holds)
                        float min = 0.0f, max = 0.0f, perim = 0.0f;
                        calcMinMaxArea(refImg, ref min, ref max, ref perim);


                        //      if (konture.Area > minArea && konture.Area < maxArea && trenutna.Total < maxVertices)
                        
                        if ( (convexHull.Area > min && convexHull.Area < max && convexHull.Perimeter < perim && convexHull.Total < maxVertices) || !filter)
                        {
                        //    if ((convexHull.Area / convexHull.Perimeter) >5.5)
                        //    {
                                Point[] conHull = convexHull.ToArray(); //Array.ConvertAll(convexHull.ToArray(), new Converter<Point, PointF>(PointToPointF));

                                chull.Add(conHull);
                                polysTriang.Add(  triangulator.triangulatePoly(convexHull, 4, refImg.Width, refImg.Height));
                                avgClrs.Add(calcPolyBgrAvrege(refImg, convexHull.BoundingRectangle));

                                // Draw detected holds and triangulation
                                imageBox.Image = drawPolys(refImg, chull, Color.DarkRed);
                                triangulator.drawTris(refImg, polysTriang[polysTriang.Count - 1].tris, ref imageBox);
                        //    }
                            
                        }
                    }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Error, please, input an image.");
            }

            // Return triangulated polys
            return polysTriang;
        }