def man_action():vc=cv2.VIDeoCapture("sample.mp4")fps=vc.get(cv2.CAP_PROP_FPS)fps_flow=fps//2fourcc=cv2.VIDeoWriter_fourcc(*"MJPG")flow_vIDeo=cv2.VIDeoWriter("flow_vIDeo.mp4",fourcc,fps_flow,(640,480))while vc.isOpened():su,frame=vc.read()flow_vIDeo.write(frame)cv2.waitKey(1)vc.release()import cv2def cartoon(img_rgb):img_color = img_rgb img_gray = cv2.cvtcolor(img_rgb, cv2.color_RGB2GRAY)img_blur = cv2.medianBlur(img_gray, 7)img_edge = cv2.adaptiveThreshold(img_blur, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, blockSize=9, C=2)img_edge = cv2.cvtcolor(img_edge, cv2.color_GRAY2RGB)img_cartoon = cv2.bitwise_and(img_color, img_edge)return img_cartoondef main () :vc = cv2.VIDeoCapture('sample.mp4 ')while vc. isOpened() :rva1, frame = vc.read ()frame=cartoon(frame )cv2. imshow ("img", frame )总结
以上是内存溢出为你收集整理的opencv-python视频处理之视频慢动作和视频漫画风格全部内容,希望文章能够帮你解决opencv-python视频处理之视频慢动作和视频漫画风格所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)