python 转偶数
目录
python变量转偶数
box转偶数
python变量转偶数
x1 = int(x1) // 2 * 2
y1 = int(y1) // 2 * 2
x2 = int(x2) // 2 * 2
y2 = int(y2) // 2 * 2
box转偶数
def save_mp4(output_path,box_list,img_list,clip_start,clip_end):writer = imageio.get_writer(output_path,fps=30,codec='libx264',format='ffmpeg',bitrate='8000k',macro_block_size=None, ffmpeg_params=['-g', '5'])max_box= get_outer_rect(np.asarray(box_list[clip_start:clip_end]))for save_img in img_list[clip_start:clip_end]:x1, y1, x2, y2 = (max_box.astype(int) // 2) * 2cropped = save_img[y1:y2, x1:x2]writer.append_data(cv2.cvtColor(cropped, cv2.COLOR_BGR2RGB))writer.close()