import numpy as np import cv2 from cv2 import VideoWriter, VideoWriter_fourcc
def main2(): width = 1280 height = 720 FPS = 24 seconds = 10 radius = 150 paint_h = int(height / 2)
img = cv2.imread('./before/mother.jpg')
fourcc = VideoWriter_fourcc(*'MP42')
video = VideoWriter('./circle_noise.avi', fourcc, float(FPS), (width, height))
for paint_x in range(-radius, width + radius, 6):
frame = np.random.randint(0, 256,
(height, width, 3),
dtype=np.uint8)
cv2.circle(frame, (paint_x, paint_h), radius, (255, 255, 255), -1)
video.write(frame)
video.release()
This code is working fine. It creates a noise video and moves a circle inside the video from left to right. But I want to do a different thing. I want to add moving images not a circle. Further says I have to create a video. Inside the video, I have to move images from left to right like the circle of the above code. I am a beginner to opencv and python. Could someone please help for giving some advises or references to reach my final outcome.