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); } }
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)); }
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)); } }