//ADDS A CAPTURED FRAME TO A THREAD SAFE QUEUE FOR EASY ACESS WHEN THE FRAME IS PROCESSED BY MULTIPLE FRAMES public bool AddNextFrameToQueueForProcessing() { using (current_frame = FramesManager.GetNextFrame(camera.camera_capture)) { if (current_frame != null) { int width = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.review_image_box).Width; int height = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.review_image_box).Height; Size new_size = new Size(width, height); Singleton.REVIEW_FRAMES_TO_BE_PROCESSED.Enqueue(FramesManager.ResizeColoredImage(current_frame.Clone(), new_size)); return(true); } //FRAME IS NULL //MEANING END OF FILE IS REACHED else { //ADD BLACK FRAME TO DATASTORE AND TERMINATE THREAD //ALSO SIGNAL TO OTHERS THAT THIS THREAD IS DONE WORK_DONE = true; running = false; Debug.WriteLine("Terminating video from file"); return(false); } } }
//ADDS A CAPTURED FRAME TO THREAD SAFE QUEUES //FOR EASY ACESS WHEN THE FRAME IS PROCESSED BY MULTIPLE THREADS LATER public bool AddNextFrameToQueuesForProcessing() { //get next frame from camera current_frame = FramesManager.GetNextFrame(camera_capture); if (current_frame != null) { int new_width = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.live_stream_image_box1).Width; int new_height = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.live_stream_image_box1).Height; Size new_size = new Size(new_width, new_height); //add frame to queue for display Singleton.LIVE_FRAMES_TO_BE_DISPLAYED.Enqueue(FramesManager.ResizeColoredImage(current_frame.Clone(), new_size)); //add frame to queue for storage Singleton.FRAMES_TO_BE_STORED.Enqueue(current_frame.Clone()); //resize frame to save on memory and improve performance int width = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.review_image_box).Width; int height = Singleton.MAIN_WINDOW.GetControl(MainWindow.MainWindowControls.review_image_box).Height; Size size = new Size(width, height); current_frame = FramesManager.ResizeColoredImage(current_frame, size); //add frame to queue for face detection and recognition Singleton.LIVE_FRAMES_TO_BE_PROCESSED.Enqueue(current_frame.Clone()); //return return(true); } //FRAME IS NULL //MEANING END OF FILE IS REACHED else { //ADD BLACK FRAME TO DATASTORE AND TERMINATE THREAD //ALSO SIGNAL TO OTHERS THAT THIS THREAD IS DONE WORK_DONE = true; running = false; Debug.WriteLine("Terminating camera output"); return(false); } }
public void FramesManagerGetNextFrameTest() { Image <Bgr, byte> image = FramesManager.GetNextFrame(new Capture()); Assert.IsNotNull(image); }