Example #1
0
def render_main(input_dir, output_dir, ms_rate, egl):
    os.chdir(os.getcwd())
    shs = np.load('../env_sh.npy')
    # NOTE: GL context has to be created before any other OpenGL function loads.
    from lib.renderer.gl.init_gl import initialize_GL_context
    initialize_GL_context(width=RENDER_WIDTH, height=RENDER_HEIGHT, egl=egl)
    from lib.renderer.gl.prt_render import PRTRender
    render = PRTRender(width=RENDER_WIDTH,
                       height=RENDER_HEIGHT,
                       ms_rate=ms_rate,
                       egl=egl)
    render_uv = PRTRender(width=RENDER_WIDTH,
                          height=RENDER_HEIGHT,
                          uv_mode=True,
                          egl=egl)
    for obj_dir in os.scandir(input_dir):
        if obj_dir.is_dir():
            subject_name = os.path.basename(obj_dir)
            render_prt_ortho(subject_name, output_dir, input_dir, shs, render,
                             render_uv)
Example #2
0
                        type=int,
                        default=.5,
                        help='mean value of prt array if not using prt')
    parser.add_argument('--yaw_low',
                        type=int,
                        default=0,
                        help='yaw range lower bound')
    parser.add_argument('--yaw_high',
                        type=int,
                        default=360,
                        help='yaw range upper bound')
    args = parser.parse_args()

    # NOTE: GL context has to be created before any other OpenGL function loads.
    from lib.renderer.gl.init_gl import initialize_GL_context
    initialize_GL_context(width=args.size, height=args.size, egl=args.egl)

    from lib.renderer.gl.prt_render import PRTRender
    rndr = PRTRender(width=args.size,
                     height=args.size,
                     ms_rate=args.ms_rate,
                     egl=args.egl)
    rndr_uv = PRTRender(width=args.size,
                        height=args.size,
                        uv_mode=True,
                        egl=args.egl)

    if args.input[-1] == '/':
        args.input = args.input[:-1]
    subject_name = args.input.split('/')[-1]
    render_prt_ortho(args.out_dir,
Example #3
0
            os.path.join(out_path, 'GEO', 'OBJ', subject_name, video_name,
                         frame_name + '.obj')):
        print("Skipped ", frame_name)
        return None
    PRT, F = computePRT(obj_path, n, 2)
    shs = np.load('/home/ayushagarwal/PIFu/env_sh.npy')

    from lib.renderer.gl.prt_render import PRTRender
    rndr = PRTRender(width=512, height=512, ms_rate=1, egl=True)

    render_prt_ortho(obj_path, PRT, F, out_path, frame_name, subject_name,
                     video_name, shs, rndr)
    del PRT, F, shs, rndr


if __name__ == '__main__':
    #/vision/u/ayush/surreal/PIFu/pifu_train/136_31/136_31_c0002
    start_time = time.time()
    dir_list = glob.glob("/home/ayushagarwal/PIFu/pifu_train/*/*/")
    #obj_list = glob.glob("/home/ayushagarwal/PIFu/pifu_train/*/*/frame*.obj")

    from lib.renderer.gl.init_gl import initialize_GL_context
    initialize_GL_context(width=512, height=512, egl=True)

    random.shuffle(dir_list)
    for dir_path in dir_list:
        obj_list = glob.glob(dir_path + "frame*.obj")
        for obj_path in obj_list:
            testPRT(obj_path)
    print("Finished in: ", time.time() - start_time)