Beispiel #1
0
        private static void extract_voxel(string lfile, string rfile, string prefix)
        {
            int          w     = 1920;
            int          h     = 1080;
            int          shift = 0;
            int          count = 0;
            VideoCapture lcap  = new VideoCapture(lfile);
            VideoCapture rcap  = new VideoCapture(rfile);

            while (true)
            {
                Image l = LoadArgs.get_image_from_stream(lcap);
                Image r = LoadArgs.get_image_from_stream(rcap);
                if (l.W == 0 || r.W == 0)
                {
                    break;
                }
                if (count % 100 == 0)
                {
                    shift = LoadArgs.best_3d_shift_r(l, r, -l.H / 100, l.H / 100);
                    Console.Write($"{shift}\n");
                }
                Image  ls   = LoadArgs.crop_image(l, (l.W - w) / 2, (l.H - h) / 2, w, h);
                Image  rs   = LoadArgs.crop_image(r, 105 + (r.W - w) / 2, (r.H - h) / 2 + shift, w, h);
                string buff = $"{prefix}_{count:05}_l";
                LoadArgs.save_image(ls, buff);
                buff = $"{prefix}_{count:05}_r";
                LoadArgs.save_image(rs, buff);
                ++count;
            }
        }