Exemplo n.º 1
0
    public void Init(string VideoFile, out uint FirstFrame, out uint LastFrame)
    {
        var ImagesDir = PrepVideo.GetImagesDir(VideoFile);

        Background.ImagesDir = ImagesDir;
        Background.FileExt   = FILE_EXT;

        rot180z = Quaternion.Euler(0, 0, 180);

        var posFile = PrepVideo.GetPositionsFilePath(VideoFile);

        GNSSTransform.InitModels();
        GNSSTransform.CreateGNSSMarkers(posFile);

        FirstFrame = UInt32.MaxValue;
        LastFrame  = 0;
        foreach (var viewsChunk in AliceSfm.Load(ImagesDir))
        {
            var chunk = InitChunk(viewsChunk, posFile);
            FirstFrame = Math.Min(FirstFrame, chunk.FirstFrame);
            LastFrame  = Math.Max(LastFrame, chunk.LastFrame);

            ChunksSequence.AddChunk(chunk);
        }
    }
Exemplo n.º 2
0
    static void ImportVideo(string videoFile)
    {
        AutoResetEvent AbortEvent = new AutoResetEvent(false);

        ImportStartedEvent?.Invoke(
            videoFile,
            () => AbortEvent.Set());

        try
        {
            uint NumFrames;

            PrepVideo.SplitFrames(
                FFMPEG_BIN, videoFile, SplitProgress, AbortEvent,
                out NumFrames);

            MeshroomCompute.PhotogrammImages(
                MESHROOM_COMPUTE_BIN, SENSOR_DATABASE, VOC_TREE,
                PrepVideo.GetImagesDir(videoFile),
                TIME_BASE, NumFrames, MeshroomProgress,
                AbortEvent);

            /*
             * create positions file last, we use it to
             * figure out if a video have been imported
             */
            PrepVideo.ExtractSubtitles(FFMPEG_BIN, videoFile, AbortEvent);

            ImportFinishedEvent?.Invoke();
            VideoOpenedEvent?.Invoke(videoFile);
        }
        catch (ProcessAborted)
        {
            ImportCanceledEvent?.Invoke();
        }
    }