我想拍摄一张图像并将其从原始图像的中心裁剪 75%。说实话,我有点不知所措。我曾想过获取原始图像大小
height, width = image.shape
Run Code Online (Sandbox Code Playgroud)
获取百分比值和裁剪:
cropped_y_start = int((height * 0.75))
cropped_y_end = int((height * 0.25))
cropped_x_start = int((width * 0.75))
cropped_x_end = int((width * 0.25))
print cropped_x_start
print cropped_x_end
crop_img = image[cropped_y_start:cropped_y_end, cropped_x_start:cropped_x_end]
Run Code Online (Sandbox Code Playgroud)
这有多个问题,但主要问题是它不是基于图像的中心。对此的任何建议将不胜感激。