Exemplo n.º 1
0
        public ImageForm(Bitmap image)
        {
            InitializeComponent();

            Image       = image;
            updateImage = new UpdateImageDelegate(UpdateImage);
        }
Exemplo n.º 2
0
        public BinarizeForm(Bitmap image, UpdateImageDelegate updateImage)
        {
            InitializeComponent();

            Image                 = image;
            this.updateImage      = updateImage;
            imagePictureBox.Image = lookUpTableProcessor.ApplyLookUpTable(Image, lookUpTable);
            binarizeLevel.Value   = 127;
        }
        public ArithmeticalWindow(Bitmap image, UpdateImageDelegate updateImage, BinaryOperation operation)
        {
            InitializeComponent();
            SourceImage      = image;
            this.updateImage = updateImage;
            this.operation   = operation;

            EnableControls(false);
        }
Exemplo n.º 4
0
 /// <summary>
 /// A thread safe method to update the picture box.
 /// </summary>
 private void UpdatePictureBox()
 {
     if (pictureBox1.InvokeRequired)
     {
         UpdateImageDelegate d = new UpdateImageDelegate(UpdatePictureBox);
         pictureBox1.Invoke(d, new object[] { });
     }
     else
     {
         pictureBox1.Update();
     }
 }
Exemplo n.º 5
0
        public PosterizeForm(Bitmap image, UpdateImageDelegate updateImage)
        {
            InitializeComponent();

            Image            = image;
            this.updateImage = updateImage;

            for (int i = 2; i < 129; ++i)
            {
                GrayLevelsCount.Items.Add(i);
            }
            GrayLevelsCount.SelectedIndex = 0;
            imagePictureBox.Image         = lookUpTableProcessor.ApplyLookUpTable(Image, lookUpTable);
        }
        public MedianFilterForm(Bitmap image, UpdateImageDelegate updateImage)
        {
            InitializeComponent();

            Image            = image;
            this.updateImage = updateImage;

            for (int i = 3; i < 24; i += 2)
            {
                maskWidthComboBox.Items.Add(i);
                maskHeightComboBox.Items.Add(i);
            }

            maskHeightComboBox.SelectedIndex = 0;
            maskWidthComboBox.SelectedIndex  = 0;
            useExistingRadioButton.Checked   = true;
        }
Exemplo n.º 7
0
 /// <summary>
 /// 更新图片进程
 /// </summary>
 public void UpdatePictrueImage()
 {
     try
     {
         UpdateImageThreadCallBack_OC = new UpdateImageDelegate(UpdateImage);
         Thread thread = new Thread(new ThreadStart(UpdateImageThreadCallBack_OC))
         {
             IsBackground = true
         };
         thread.Start();
         Thread.Sleep(40);
     }
     catch (Exception)
     {
         throw new Exception();
     }
 }
        public GradientFilterForm(Bitmap image, UpdateImageDelegate updateImage)
        {
            InitializeComponent();
            Image            = image;
            this.updateImage = updateImage;

            PropertyInfo[] comboBoxElements = typeof(Mask).GetProperties();
            foreach (PropertyInfo propertyInfo in comboBoxElements)
            {
                xMaskComboBox.Items.Add(propertyInfo.Name);
                yMaskComboBox.Items.Add(propertyInfo.Name);
            }

            xMaskComboBox.SelectedIndex     = 0;
            yMaskComboBox.SelectedIndex     = 0;
            useExistingRadioButton.Checked  = true;
            rescaleRangeRadioButton.Checked = true;
        }
Exemplo n.º 9
0
        private void UpdateImage(Image<Bgr, Byte> img, int frame, int frameCount, double fps, bool lastFrame)
        {
            if (!isStopped && this.InvokeRequired && img.Bytes != null)
            {
                UpdateImageDelegate UpdateImageVar = new UpdateImageDelegate(UpdateImage);
                Object[] args = new Object[5];
                args[0] = img;
                args[1] = frame;
                args[2] = frameCount;
                args[3] = fps;
                args[4] = lastFrame;

                Invoke(UpdateImageVar, args);
            }
            else
            {
                if (imageStream != null)
                {
                    activeImageBox.Image = img;
                    activeImageBox.Update();
                    if (frameCount > 0)
                    {
                        lblMovieProgress.Text = @"Frame " + frame + @"/" + frameCount;
                        lblMovieProgress.Invalidate();

                        if (lastFrame) //vid is finished.
                        {
                            return;
                        }
                    }

                    if (tbFramePosition.Enabled && frame <= tbFramePosition.Maximum)
                    {
                        tbFramePosition.Value = frame;
                        lblVideoTime.Text = GetTimeFromSeconds(frame / targetfps);
                    }

                    if (isRecording && (Environment.TickCount - blinkStart > 500))
                    {
                        pictRecording.Visible = !pictRecording.Visible;
                        blinkStart = Environment.TickCount;
                    }

                    if (lblElapsedTime.Visible)
                    {
                        TimeSpan span = DateTime.Now - videoStart;
                        if (span.Seconds > 1)
                        {
                            lblElapsedTime.Text = "Time: " + span.Hours.ToString("0") + ":" + span.Minutes.ToString("00") + ":" + span.Seconds.ToString("00");
                        }
                    }

                    lblMovieStatus.Text = "FPS: " + fps.ToString("0.0");
                    tsLblBufferSize.Text = "Buffer Fullness: " + imageStream.ReadBufferFullness + "%";

                    histogramView.CreateHistogram(img);
                }
            }
        }