Exemple #1
0
        public bool DrawFaceRectangles()
        {
            if (current_frame == null)
            {
                throw new NullReferenceException();
            }

            try
            {
                if (detected_faces_in_frame != null)
                {
                    Bitmap current_frame_bitmap = current_frame.ToBitmap();

                    Graphics graphics = Graphics.FromImage(current_frame_bitmap);

                    Parallel.ForEach(detected_faces_in_frame, detected_face =>
                    {
                        Bitmap a_frame = FramesManager.DrawShapeOnTransparentBackGround(detected_face, current_frame.Width, current_frame.Height);
                        lock (current_frame)
                        {
                            FramesManager.OverLayBitmapToFormNewImage(a_frame, graphics);
                        }
                    });

                    current_frame = new Image <Bgr, byte>(current_frame_bitmap);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
            return(false);
        }
Exemple #2
0
        public void FramesManagerDrawShapeOnTransparentBackGroundTest()
        {
            Point     starting_cordinate = new Point(10, 10);
            Size      size   = new Size(10, 10);
            Rectangle rec    = new Rectangle(starting_cordinate, size);
            Bitmap    bitmap = FramesManager.DrawShapeOnTransparentBackGround(rec, 100, 100);

            Assert.IsNotNull(bitmap);
        }
Exemple #3
0
        public void FramesManagerOverLayBitmapToFormNewImageTest()
        {
            Point     starting_cordinate = new Point(10, 10);
            Size      size     = new Size(10, 10);
            Rectangle rec      = new Rectangle(starting_cordinate, size);
            Bitmap    bitmap   = FramesManager.DrawShapeOnTransparentBackGround(rec, 100, 100);
            Graphics  graphics = Graphics.FromImage(bitmap);
            bool      sucess   = FramesManager.OverLayBitmapToFormNewImage(bitmap, graphics);

            Assert.IsTrue(sucess);
        }