1、二值化
2、绘制矩形
cv2.rectangle(img,(f_xmin,f_ymin),(f_xmax,f_ymax),(0,0,255),3)
3、图片转视频
import os
import cv2
images = os.listdir('images/')
print(images)
img = cv2.imread('images/'+images[0])
print(img.shape)
# fourcc = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')#.avi格式
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')#.mp4格式
videowrite = cv2.VideoWriter('test.mp4',fourcc,10,(640,480))
for i in images:
imgname = 'images/'+i
img = cv2.imread(imgname)
img = cv2.resize(img, (640,480))
# print(img.shape)
videowrite.write(img)
print(imgname)
videowrite.release()
print('end!')



