//DRAWS A SHAPE AROUND THE FACE IF THE OPTION IS SELECTED
        public bool DrawShapeAroundDetectedfaces()
        {
            try
            {
                if (sucessfull)
                {
                    if (draw_detected_faces)
                    {
                        counter++;
                        FaceDrawingThread face_drawer = new FaceDrawingThread(current_frame.Clone(), detected_faces, counter, previous_id);
                        face_drawer.StartWorking();

                        if (counter == 250)
                        {
                            counter     = 0;
                            previous_id = 0;
                        }
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
            return(false);
        }
 public void FaceDrawingThreadFaceDrawingThreadTest()
 {
     Image<Bgr,byte> frame=Singleton.FACE_PIC;
     HaarCascade haarcascade = Singleton.HAARCASCADE;
     Rectangle[] faces=FramesManager.DetectFacesInFrame(frame,haarcascade);
     FaceDrawingThread thread = new FaceDrawingThread(frame,faces,1,0);
     Assert.IsNotNull(thread);
 }
 public void FaceDrawingThreadAddImageToQueueForDisplayTest()
 {
     HaarCascade haarcascade = Singleton.HAARCASCADE;
     Rectangle[] faces = FramesManager.DetectFacesInFrame(Singleton.FACE_PIC, haarcascade);
     FaceDrawingThread thread = new FaceDrawingThread(Singleton.FACE_PIC, faces, 1, 0);
     bool sucess=thread.AddImageToQueueForDisplay();
     Assert.IsTrue(sucess);
 }
 public void FaceDrawingThreadDoWorkTest()
 {
     Image<Bgr, byte> frame = Singleton.FACE_PIC;
     HaarCascade haarcascade = Singleton.HAARCASCADE;
     Rectangle[] faces = FramesManager.DetectFacesInFrame(frame, haarcascade);
     FaceDrawingThread thread = new FaceDrawingThread(frame, faces, 1, 0);
     thread.StartWorking();
     Assert.IsTrue(thread.IsRunning());
     thread.RequestStop();
 }
Beispiel #5
0
        //THIS RELEASES ALL RESOURCES CONSUMED BY A THREAD GIVEN ITS ID
        public static bool ReleaseThreadResources(String thread_id)
        {
            switch (thread_id)
            {
                case ThreadFactory.PERP_ALERT_THREAD:

                    perp_alert_thread       = null;
                    break;

                case ThreadFactory.STUDENT_ALERT_THREAD:
                    student_alert_thread    = null;
                    break;

                case ThreadFactory.CAMERA_THREAD:
                    cam_output              = null;
                    break;

                case ThreadFactory.CAMERA_THREAD_USING_VIDEO:
                    cam_output_using_video  = null;
                    break;

                case ThreadFactory.LIVE_DISPLAY_UPDATER:
                    live_display_updater    = null;
                    break;

                case ThreadFactory.REVIEW_DISPLAY_UPDATER:
                    review_display_updater  = null;
                    break;

                case ThreadFactory.REVIEW_FACE_DETECTOR:
                    review_face_detector    = null;
                    break;

                case ThreadFactory.LIVE_FACE_DETECTOR:
                    live_face_detector      = null;
                    break;

                case ThreadFactory.PERP_RECOGNIZER:
                    perp_recognizer         = null;
                    break;

                case ThreadFactory.PROGRESS_THREAD:
                    face_recog_progress     = null;
                    face_recog_progress_2   = null;
                    break;

                case ThreadFactory.FACE_DRAWER:
                    face_drawer             = null;
                    break;

                case ThreadFactory.FOOTAGE_SAVER:
                    footage_saver           = null;
                    break;

                case ThreadFactory.VIDEO_THREAD:
                    video_from_file_grabber = null;
                    break;

                case ThreadFactory.VIDEO_THREAD_USING_CAMERA:
                    video_from_camera       = null;
                    break;
            }
            return true;
        }
        //DRAWS A SHAPE AROUND THE FACE IF THE OPTION IS SELECTED
        public bool DrawShapeAroundDetectedfaces()
        {
            try
            {
                if (sucessfull)
                {
                    if (draw_detected_faces)
                    {
                        counter++;
                        FaceDrawingThread face_drawer = new FaceDrawingThread(current_frame.Clone(), detected_faces, counter, previous_id);
                        face_drawer.StartWorking();

                        if (counter == 250)
                        {
                            counter = 0;
                            previous_id = 0;
                        }
                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
            return false;
        }