Пример #1
0
        /// <summary>
        /// Draw the image buffer into a System.Drawing.Bitmap. If the hotpixels
        /// shall be displayed, red circles are drawn around them.
        /// Then the Display Event is called for displayin in  the Picturebox.
        /// </summary>
        /// <param name="imgBuffer">IFrame containing the handled image.</param>
        private void DisplayBufferInPictureBox(IFrameQueueBuffer imgBuffer)
        {
            Bitmap DisplayImage = new Bitmap(imgBuffer.FrameType.Width, imgBuffer.FrameType.Height);

            using (Graphics graphics = Graphics.FromImage(DisplayImage))
            {
                graphics.DrawImage(imgBuffer.CreateBitmapWrap(), 0, 0);
                Pen pen = Pens.Red;
                if (radioBtn_ShowHotpixel.Checked == true)
                {
                    foreach (var p in listOfCoordinates)
                    {
                        graphics.DrawEllipse(pen, p.X - 5, p.Y - 5, 10, 10);
                    }
                }
            }

            DisplayEvent?.BeginInvoke(this, new BitmapEventArgs(DisplayImage), null, null);
        }