(fn_mesh, vid_numframes, vid_fps, vid_traj, vid_shift, vid_border, dolly, vid_format, vid_ssaa,
outpath=None, basename=None)
| 612 | return fn_saved |
| 613 | |
| 614 | def run_makevideo(fn_mesh, vid_numframes, vid_fps, vid_traj, vid_shift, vid_border, dolly, vid_format, vid_ssaa, |
| 615 | outpath=None, basename=None): |
| 616 | if len(fn_mesh) == 0 or not os.path.exists(fn_mesh): |
| 617 | raise Exception("Could not open mesh.") |
| 618 | |
| 619 | vid_ssaa = int(vid_ssaa) |
| 620 | |
| 621 | # traj type |
| 622 | if vid_traj == 0: |
| 623 | vid_traj = ['straight-line'] |
| 624 | elif vid_traj == 1: |
| 625 | vid_traj = ['double-straight-line'] |
| 626 | elif vid_traj == 2: |
| 627 | vid_traj = ['circle'] |
| 628 | |
| 629 | num_fps = int(vid_fps) |
| 630 | num_frames = int(vid_numframes) |
| 631 | shifts = vid_shift.split(',') |
| 632 | if len(shifts) != 3: |
| 633 | raise Exception("Translate requires 3 elements.") |
| 634 | x_shift_range = [float(shifts[0])] |
| 635 | y_shift_range = [float(shifts[1])] |
| 636 | z_shift_range = [float(shifts[2])] |
| 637 | |
| 638 | borders = vid_border.split(',') |
| 639 | if len(borders) != 4: |
| 640 | raise Exception("Crop Border requires 4 elements.") |
| 641 | crop_border = [float(borders[0]), float(borders[1]), float(borders[2]), float(borders[3])] |
| 642 | |
| 643 | if not outpath: |
| 644 | outpath = backbone.get_outpath() |
| 645 | |
| 646 | if not basename: |
| 647 | # output path and filename mess .. |
| 648 | basename = Path(fn_mesh).stem |
| 649 | |
| 650 | # unique filename |
| 651 | basecount = backbone.get_next_sequence_number(outpath, basename) |
| 652 | if basecount > 0: basecount = basecount - 1 |
| 653 | fullfn = None |
| 654 | for i in range(500): |
| 655 | fn = f"{basecount + i:05}" if basename == '' else f"{basename}-{basecount + i:04}" |
| 656 | fullfn = os.path.join(outpath, f"{fn}_." + vid_format) |
| 657 | if not os.path.exists(fullfn): |
| 658 | break |
| 659 | basename = Path(fullfn).stem |
| 660 | basename = basename[:-1] |
| 661 | |
| 662 | print("Loading mesh ..") |
| 663 | |
| 664 | fn_saved = run_3dphoto_videos(fn_mesh, basename, outpath, num_frames, num_fps, crop_border, vid_traj, x_shift_range, |
| 665 | y_shift_range, z_shift_range, [''], dolly, vid_format, vid_ssaa) |
| 666 | |
| 667 | return fn_saved[-1], fn_saved[-1], '' |
| 668 | |
| 669 | def unload_models(): |
| 670 | model_holder.unload_models() |
no test coverage detected