背景

cv领域常用的图片的方法的积累与总结,使用python语言实现

图片裁剪

def cut_img(img_path, after_path, height_start, height_stop, width_start, width_stop):
img = cv2.imread(img_path)
cropped_image = img[height_start:height_stop, width_start:width_stop] # Slicing to crop the image 高:宽
cv2.imwrite(after_path, cropped_image)