Ejemplo n.º 1
0
        public static ascx_MovieEditor start_ImageCapture(this ascx_MovieEditor movieEditor, Action <int> capturedFramesCount)
        {
            "Starting Image Capture".debug();
            var aforgeVideo = movieEditor.AForge_Video;

            aforgeVideo.CapturingImages = true;
            Bitmap lastBitMap     = null;
            var    capturedImages = new List <Bitmap>();

            while (aforgeVideo.CapturingImages)
            {
                var bitmap = aforgeVideo.capture(movieEditor);
                // only add if the bimap is different from the previous frame
                if (aforgeVideo.AddDuplicateFrames || bitmap.isNotEqualTo(lastBitMap))
                {
                    capturedImages.Add(bitmap);
                    capturedFramesCount(capturedImages.size());
                    aforgeVideo.sleep(10, false);                        // small sleep to prevent a rare race-condition where a number of images are added in big numbers
                }
                else
                {
                    aforgeVideo.frameCaptureDelay();                      // only sleep if we didn't add
                }
                lastBitMap = bitmap;
            }
            "There where {0} images captured which will now be imported into the Movie Editor".info(capturedImages.size());
            movieEditor.add_Bitmaps(capturedImages);
            return(movieEditor);
        }
Ejemplo n.º 2
0
        public static ascx_MovieEditor stop_ImageCapture(this ascx_MovieEditor movieEditor)
        {
            "Stopping Image Capture".debug();
            var aforgeVideo = movieEditor.AForge_Video;

            aforgeVideo.CapturingImages = false;
            return(movieEditor);
        }
Ejemplo n.º 3
0
 public static ascx_MovieEditor playLastVideoCreated(this ascx_MovieEditor movieEditor)
 {
     if (movieEditor.movieExists())
     {
         O2Gui.open <Panel>("Video Player", 640, 480).add_VideoPlayer().play(movieEditor.AForge_Video.PathToAviVideo);
     }
     return(movieEditor);
 }
Ejemplo n.º 4
0
        public static string add_Bitmap(this ascx_MovieEditor movieEditor, Bitmap bitmap)
        {
            var tempFile    = bitmap.save();
            var savedBitmap = Files.MoveFile(tempFile, movieEditor.TempVideoImages);

            movieEditor.FramesList.add_Item(savedBitmap);
            return(savedBitmap);
        }
Ejemplo n.º 5
0
 public static ascx_MovieEditor add_Bitmaps(this ascx_MovieEditor movieEditor, List <Bitmap> bitmaps)
 {
     foreach (var bitmap in bitmaps)
     {
         movieEditor.add_Bitmap(bitmap);
     }
     return(movieEditor);
 }
Ejemplo n.º 6
0
 public static List <string> imagesPaths(this ascx_MovieEditor movieEditor)
 {
     return(movieEditor.FramesList.items <string>());
     //var imagesPaths = new List<string>();
     //foreach(var item in movieEditor.FramesList.items())
     //imagesPaths.Add("asd");
     //return imagesPaths;
 }
Ejemplo n.º 7
0
        public static ascx_MovieEditor showMovieCaptureLocation(this ascx_MovieEditor movieEditor)
        {
            //var handle = movieEditor.parentForm().Handle;
            //"Current Form Handle: {0}".info(handle);
            var panel = O2Gui.open <Panel>("Capture Location", movieEditor.AForge_Video.Desktop_Capture_Width,
                                           movieEditor.AForge_Video.Desktop_Capture_Height);
            var form = panel.parentForm();

            form.top(movieEditor.AForge_Video.Desktop_Capture_Top)
            .left(movieEditor.AForge_Video.Desktop_Capture_Left)
            .opacity(0.5);
            return(movieEditor);
        }
Ejemplo n.º 8
0
        public static ascx_MovieEditor createVideo(this ascx_MovieEditor movieEditor)
        {
            movieEditor.AForge_Video.PathToAviVideo = "";
            var currentImages = movieEditor.imagesPaths();

            "Creating movie with {0} images".info(currentImages.size());
            movieEditor.AForge_Video.createVideo(currentImages);
            if (movieEditor.movieExists())
            {
                "Movie successfuly created: {0}".debug(movieEditor.AForge_Video.PathToAviVideo);
            }
            return(movieEditor);
        }
Ejemplo n.º 9
0
 public static ascx_MovieEditor playLastMovieCreated(this ascx_MovieEditor movieEditor)
 {
     return(movieEditor.playLastVideoCreated());
 }
Ejemplo n.º 10
0
 public static ascx_MovieEditor createMovie(this ascx_MovieEditor movieEditor)
 {
     return(movieEditor.createVideo());
 }
Ejemplo n.º 11
0
 public static bool movieExists(this ascx_MovieEditor movieEditor)
 {
     return(movieEditor.AForge_Video.PathToAviVideo.valid() &&
            movieEditor.AForge_Video.PathToAviVideo.fileExists());
 }