Пример #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);
        }
    }
Пример #2
0
    static void Main(string[] args)
    {
        var timeBase = new TimeBase {
            Numerator = 1001, Denominator = 30000
        };
        var ffmpegBin = "/usr/bin/ffmpeg";
        //var videoFile = "/home/boris/droneMov/falafel_low.mov";
        var videoFile = "/home/boris/droneMov/valkarra_sunny.mov";

        Console.WriteLine("video {0}", videoFile);

        uint   NumFrames;
        string ImagesDir;

        PrepVideo.SplitFrames(ffmpegBin, videoFile, SplitProgress, out NumFrames, out ImagesDir);
        Console.WriteLine("done spliting hairs, {0} NumFrames", NumFrames);
        PrepVideo.ExtractSubtitles(ffmpegBin, videoFile);

//        NumFrames = 1499u;
//        ImagesDir = "/home/boris/droneMov/panopt/valkarra_sunny";
        MeshroomCompute.PhotogrammImages(
            "/home/boris/Meshroom-2019.1.0/meshroom_compute",
            "/home/boris/Meshroom-2019.1.0/aliceVision/share/aliceVision/cameraSensors.db",
            "/home/boris/Meshroom-2019.1.0/aliceVision/share/aliceVision/vlfeat_K80L3.SIFT.tree",
            ImagesDir, timeBase, NumFrames, MeshroomProgress);
    }
Пример #3
0
    static bool IsImported(string videoFile)
    {
        /*
         * we check the presens of positions file to
         * figure out if the video have been imported
         */
        var positionsFile = PrepVideo.GetPositionsFilePath(videoFile);

        return(File.Exists(positionsFile));
    }
Пример #4
0
    static IEnumerable <(View view, PoseDesc pose)> GetViewPoses(string videoFile)
    {
        var toSweref = GeodesyProjections.fromWGS84Converter("sweref_99_13_30");
        var posFile  = PrepVideo.GetPositionsFilePath(videoFile);
        var cp       = new CaptionParser(posFile);

        uint   TimeStamp;
        double Latitude;
        double Longitude;
        double Altitude;
        double RelativeHeight;
        float  Pitch;
        float  Roll;
        float  Yaw;

        cp.ReadPose(out TimeStamp,
                    out Latitude, out Longitude, out Altitude, out RelativeHeight,
                    out Pitch, out Roll, out Yaw);
        var origin = toSweref(Longitude, Latitude, Altitude);

        yield return(GnssToViewPose(origin, origin, TimeStamp));

        while (true)
        {
            try
            {
                cp.ReadPose(out TimeStamp,
                            out Latitude, out Longitude, out Altitude, out RelativeHeight,
                            out Pitch, out Roll, out Yaw);
            }
            catch (EndOfStreamException)
            {
                Log.Msg("GnssSfm: done loading captions");
                break;
            }

            var gnssPos = toSweref(Longitude, Latitude, Altitude);
            yield return(GnssToViewPose(origin, gnssPos, TimeStamp));
        }
    }
Пример #5
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();
        }
    }