def render(obj_path, viewpoint, temp_folder):
    'render rbg image \n\n    render a object rgb image by a given camera viewpoint and\n    choose random image as background, only render one image\n    at a time.\n\n    Args:\n        obj_path: a string variable indicate the obj file path\n        viewpoint: a vp parameter(contains azimuth,elevation,tilt angles and distance)\n    '
    vp = viewpoint
    cam_location = camera_location(vp.azimuth, vp.elevation, vp.distance)
    cam_rot = camera_rot_XYZEuler(vp.azimuth, vp.elevation, vp.tilt)
    cam_obj = bpy.data.objects['Camera']
    cam_obj.location[0] = cam_location[0]
    cam_obj.location[1] = cam_location[1]
    cam_obj.location[2] = cam_location[2]
    cam_obj.rotation_euler[0] = cam_rot[0]
    cam_obj.rotation_euler[1] = cam_rot[1]
    cam_obj.rotation_euler[2] = cam_rot[2]
    if (not os.path.exists(g_syn_rgb_folder)):
        os.mkdir(g_syn_rgb_folder)
    obj = bpy.data.objects['model_normalized']
    ni = g_fmo_steps
    maxlen = 0.5
    maxrot = (1.57 / 6)
    tri = 0
    while (tri <= g_max_trials):
        do_repeat = False
        tri += 1
        if (not g_apply_texture):
            for oi in range(len(bpy.data.objects)):
                if ((bpy.data.objects[oi].type == 'CAMERA') or (bpy.data.objects[oi].type == 'LAMP')):
                    continue
                for tempi in range(len(bpy.data.objects[oi].data.materials)):
                    if (bpy.data.objects[oi].data.materials[tempi].alpha != 1.0):
                        return (True, True)
        los_start = Vector((random.uniform(((- maxlen) / 10), (maxlen / 10)), random.uniform((- maxlen), maxlen), random.uniform((- maxlen), maxlen)))
        loc_step = (Vector((random.uniform(((- maxlen) / 10), (maxlen / 10)), random.uniform((- maxlen), maxlen), random.uniform((- maxlen), maxlen))) / ni)
        rot_base = np.array((random.uniform(0, (2 * math.pi)), random.uniform(0, (2 * math.pi)), random.uniform(0, (2 * math.pi))))
        rot_step = (np.array((random.uniform((- maxrot), maxrot), random.uniform((- maxrot), maxrot), random.uniform((- maxrot), maxrot))) / ni)
        old = open_log(temp_folder)
        for ki in ([0, (ni - 1)] + list(range(1, (ni - 1)))):
            for oi in range(len(bpy.data.objects)):
                if ((bpy.data.objects[oi].type == 'CAMERA') or (bpy.data.objects[oi].type == 'LAMP')):
                    continue
                bpy.data.objects[oi].location = (los_start + (loc_step * ki))
                bpy.data.objects[oi].rotation_euler = Euler((rot_base + (rot_step * ki)))
            bpy.context.scene.frame_set((ki + 1))
            bpy.ops.render.render(write_still=True)
            if ((ki == 0) or (ki == (ni - 1))):
                Mt = (cv2.imread(os.path.join(bpy.context.scene.node_tree.nodes[1].base_path, 'image-{:06d}.png'.format((ki + 1))), cv2.IMREAD_UNCHANGED)[:, :, (- 1)] > 0)
                is_border = (((((Mt[0, :].sum() + Mt[(- 1), :].sum()) + Mt[:, 0].sum()) + Mt[:, (- 1)].sum()) > 0) or (Mt.sum() == 0))
                if is_border:
                    if (ki == 0):
                        close_log(old)
                        return (False, True)
                    else:
                        do_repeat = True
                if do_repeat:
                    break
        close_log(old)
        if (do_repeat == False):
            break
    if do_repeat:
        return (False, True)
    return (False, False)
render rbg image 

render a object rgb image by a given camera viewpoint and
choose random image as background, only render one image
at a time.

Args:
    obj_path: a string variable indicate the obj file path
    viewpoint: a vp parameter(contains azimuth,elevation,tilt angles and distance)
def render(obj_path, viewpoint, temp_folder):
    'render rbg image \n\n    render a object rgb image by a given camera viewpoint and\n    choose random image as background, only render one image\n    at a time.\n\n    Args:\n        obj_path: a string variable indicate the obj file path\n        viewpoint: a vp parameter(contains azimuth,elevation,tilt angles and distance)\n    '
    vp = viewpoint
    cam_location = camera_location(vp.azimuth, vp.elevation, vp.distance)
    cam_rot = camera_rot_XYZEuler(vp.azimuth, vp.elevation, vp.tilt)
    cam_obj = bpy.data.objects['Camera']
    cam_obj.location[0] = cam_location[0]
    cam_obj.location[1] = cam_location[1]
    cam_obj.location[2] = cam_location[2]
    cam_obj.rotation_euler[0] = cam_rot[0]
    cam_obj.rotation_euler[1] = cam_rot[1]
    cam_obj.rotation_euler[2] = cam_rot[2]
    if (not os.path.exists(g_syn_rgb_folder)):
        os.mkdir(g_syn_rgb_folder)
    obj = bpy.data.objects['model_normalized']
    ni = g_fmo_steps
    maxlen = 0.5
    maxrot = (1.57 / 6)
    tri = 0
    while (tri <= g_max_trials):
        do_repeat = False
        tri += 1
        if (not g_apply_texture):
            for oi in range(len(bpy.data.objects)):
                if ((bpy.data.objects[oi].type == 'CAMERA') or (bpy.data.objects[oi].type == 'LAMP')):
                    continue
                for tempi in range(len(bpy.data.objects[oi].data.materials)):
                    if (bpy.data.objects[oi].data.materials[tempi].alpha != 1.0):
                        return (True, True)
        los_start = Vector((random.uniform(((- maxlen) / 10), (maxlen / 10)), random.uniform((- maxlen), maxlen), random.uniform((- maxlen), maxlen)))
        loc_step = (Vector((random.uniform(((- maxlen) / 10), (maxlen / 10)), random.uniform((- maxlen), maxlen), random.uniform((- maxlen), maxlen))) / ni)
        rot_base = np.array((random.uniform(0, (2 * math.pi)), random.uniform(0, (2 * math.pi)), random.uniform(0, (2 * math.pi))))
        rot_step = (np.array((random.uniform((- maxrot), maxrot), random.uniform((- maxrot), maxrot), random.uniform((- maxrot), maxrot))) / ni)
        old = open_log(temp_folder)
        for ki in ([0, (ni - 1)] + list(range(1, (ni - 1)))):
            for oi in range(len(bpy.data.objects)):
                if ((bpy.data.objects[oi].type == 'CAMERA') or (bpy.data.objects[oi].type == 'LAMP')):
                    continue
                bpy.data.objects[oi].location = (los_start + (loc_step * ki))
                bpy.data.objects[oi].rotation_euler = Euler((rot_base + (rot_step * ki)))
            bpy.context.scene.frame_set((ki + 1))
            bpy.ops.render.render(write_still=True)
            if ((ki == 0) or (ki == (ni - 1))):
                Mt = (cv2.imread(os.path.join(bpy.context.scene.node_tree.nodes[1].base_path, 'image-{:06d}.png'.format((ki + 1))), cv2.IMREAD_UNCHANGED)[:, :, (- 1)] > 0)
                is_border = (((((Mt[0, :].sum() + Mt[(- 1), :].sum()) + Mt[:, 0].sum()) + Mt[:, (- 1)].sum()) > 0) or (Mt.sum() == 0))
                if is_border:
                    if (ki == 0):
                        close_log(old)
                        return (False, True)
                    else:
                        do_repeat = True
                if do_repeat:
                    break
        close_log(old)
        if (do_repeat == False):
            break
    if do_repeat:
        return (False, True)
    return (False, False)