Пример #1
0
    static void RunMeshroomCompute(
        string MeshroomComputeBin,
        string ImagesDir,
        string graph,
        ComputeProgress ComputeProgressCB)
    {
        /* remove previous cache dir, if it exists */
        Utils.RemoveDir(Meshroom.GetCacheDir(ImagesDir));

        /* start meshroom compute process */
        var proc      = Utils.Run(MeshroomComputeBin, graph);
        var graphName = Path.GetFileNameWithoutExtension(graph);

        var stepsPoller = MeshroomProgress.GetPoller(ImagesDir);

        while (!proc.HasExited)
        {
            var done  = stepsPoller.PollStepsDone();
            var total = stepsPoller.TotalSteps;
            ComputeProgressCB(graphName, (float)done / (float)total);
            Thread.Sleep(1300);
        }

        var exitCode = proc.ExitCode;

        if (exitCode != 0)
        {
            var err = string.Format("{0} failed, exit code {1}", MeshroomComputeBin, exitCode);
            throw new Exception(err);
        }

        CopyCamerasSFMFile(ImagesDir, graphName);
    }
Пример #2
0
    static void RunMeshroomCompute(
        string MeshroomComputeBin,
        string ImagesDir,
        string graph,
        int chunkNum,
        ChunkProgress ChunkProgressCB,
        AutoResetEvent AbortEvent)
    {
        /* remove previous cache dir, if it exists */
        RemoveCacheDir(ImagesDir, chunkNum);

        /* start meshroom compute process */
        var runner = new ProcRunner(MeshroomComputeBin, graph);

        runner.StartAsync();

        /* poll progress until finished/aborted */
        var stepsPoller = MeshroomProgress.GetPoller(ImagesDir);
        var graphName   = Path.GetFileNameWithoutExtension(graph);

        while (runner.IsRunning(AbortEvent, POLL_FREQ))
        {
            var done  = stepsPoller.PollStepsDone();
            var total = stepsPoller.TotalSteps;
            ChunkProgressCB((float)done / (float)total);
        }

        CopyCamerasSFMFile(ImagesDir, graphName);
    }