pose_estimation/blender/functions.py
def render_pose(render_props):
    '''
    render the object at different x, y, and z locations and orientations (as
    quaternions)
    '''

    # preliminary things
    if render_props.image_names is None:
        image_numerical_name = '%06d.png' # generic name for each image

    # loop through poses to generate images
    for i in range(render_props.n_renders):

        # different world color?
        if render_props.world_RGB is not None:
            world_RGB_i = render_props.world_RGB[:, i]
        else:
            world_RGB_i = None
       
        # give the image a name
        if render_props.image_names is None:
            image_file_name_i = image_numerical_name % i
        else:
            image_file_name_i = render_props.image_names[i]
        image_file_i = os.path.join(render_props.save_dir, image_file_name_i)
        
        # render image i
        render_image(
            cam_ob=render_props.cam_ob,
            cam_pos=render_props.cam_xyz,
            cam_quat=render_props.cam_quat,
            ob=render_props.ob,
            ob_pos=render_props.xyz[:,i],
            ob_quat=render_props.quat[:,i],
            image_file=image_file_i,
            alpha=render_props.alpha,
            world_RGB=world_RGB_i)

        # if we have a list of background images, overlay render onto
        # background
        if render_props.bkgd_image_list is not None:
            im_i = ti.load_im_np(image_file_i)
            im_bkgd_i = ti.load_im_np(render_props.bkgd_image_list[i])
            im_overlay = ti.overlay(im_i, im_bkgd_i)
            ti.write_im_np(image_file_i, im_overlay)

    # compute gramian for all renders, then save data
    if render_props.compute_gramian:
        gram_file = os.path.join(render_props.save_dir, 'gramian.npz')
        gram = compute_gramian_object(render_props)
        np.savez(gram_file, gram=gram)

    render the object at different x, y, and z locations and orientations (as
    quaternions)
    
render the object at different x, y, and z locations and orientations (as
quaternions)
render the object at different x y and z locations and orientations ( as quaternions )
def render_pose(render_props):
    if render_props.image_names is None:
        image_numerical_name = '%06d.png' 
    for i in range(render_props.n_renders):
        if render_props.world_RGB is not None:
            world_RGB_i = render_props.world_RGB[:, i]
        else:
            world_RGB_i = None
        if render_props.image_names is None:
            image_file_name_i = image_numerical_name % i
        else:
            image_file_name_i = render_props.image_names[i]
        image_file_i = os.path.join(render_props.save_dir, image_file_name_i)
        render_image(
            cam_ob=render_props.cam_ob,
            cam_pos=render_props.cam_xyz,
            cam_quat=render_props.cam_quat,
            ob=render_props.ob,
            ob_pos=render_props.xyz[:,i],
            ob_quat=render_props.quat[:,i],
            image_file=image_file_i,
            alpha=render_props.alpha,
            world_RGB=world_RGB_i)
        if render_props.bkgd_image_list is not None:
            im_i = ti.load_im_np(image_file_i)
            im_bkgd_i = ti.load_im_np(render_props.bkgd_image_list[i])
            im_overlay = ti.overlay(im_i, im_bkgd_i)
            ti.write_im_np(image_file_i, im_overlay)
    if render_props.compute_gramian:
        gram_file = os.path.join(render_props.save_dir, 'gramian.npz')
        gram = compute_gramian_object(render_props)
        np.savez(gram_file, gram=gram)
def render_pose ( render_props ) : if render_props . image_names is None : image_numerical_name = '%06d.png' for i in range ( render_props . n_renders ) : if render_props . world_RGB is not None : world_RGB_i = render_props . world_RGB [ : , i ] else : world_RGB_i = None if render_props . image_names is None : image_file_name_i = image_numerical_name % i else : image_file_name_i = render_props . image_names [ i ] image_file_i = os . path . join ( render_props . save_dir , image_file_name_i ) render_image ( cam_ob = render_props . cam_ob , cam_pos = render_props . cam_xyz , cam_quat = render_props . cam_quat , ob = render_props . ob , ob_pos = render_props . xyz [ : , i ] , ob_quat = render_props . quat [ : , i ] , image_file = image_file_i , alpha = render_props . alpha , world_RGB = world_RGB_i ) if render_props . bkgd_image_list is not None : im_i = ti . load_im_np ( image_file_i ) im_bkgd_i = ti . load_im_np ( render_props . bkgd_image_list [ i ] ) im_overlay = ti . overlay ( im_i , im_bkgd_i ) ti . write_im_np ( image_file_i , im_overlay ) if render_props . compute_gramian : gram_file = os . path . join ( render_props . save_dir , 'gramian.npz' ) gram = compute_gramian_object ( render_props ) np . savez ( gram_file , gram = gram )
render the object at different x, y, and z locations and orientations (as
quaternions)
render the object at different x y and z locations and orientations ( as quaternions )
'''
    render the object at different x, y, and z locations and orientations (as
    quaternions)
    ''' # preliminary things # generic name for each image # loop through poses to generate images # different world color? # give the image a name # render image i # if we have a list of background images, overlay render onto # background # compute gramian for all renders, then save data
render_props