Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2 as cv
- import numpy as np
- import random
- import imagelib as il
- fourcc=cv.VideoWriter_fourcc(*'DIVX')
- film = cv.VideoWriter('film.mkv', fourcc, 24, (1440,1080))
- frame=255*np.ones((1080,1440,3), np.uint8)
- random.seed()
- for x in range(1, 14401):
- print(x)
- h=int(360*(x/4800))%360
- s=100
- l=random.randint(40,60)
- bgr=il.hslToBGR((h,s,l))
- if(x%12!=1):
- area = random.randint(10000,int(1440*1080/8))
- minLength=int(max(area/800,50))
- maxLength=int(area/minLength)
- length=random.randint(minLength, maxLength)
- height=int(area/length)
- x1=random.randint(0,1439-length)
- y1=random.randint(0,1079-height)
- x2=x1+length
- y2=y1+height
- x3=random.randint(0,1439-length)
- y3=random.randint(0,1079-height)
- frame=il.moveEllipse(frame, x1, y1, x2, y2, x3, y3)
- else:
- area = random.randint(10000,250000)
- minLength=int(max(area/800,50))
- maxLength=int(area/minLength)
- length=random.randint(minLength, maxLength)
- height=int(area/length)
- x1=random.randint(0,1439-length)
- y1=random.randint(0,1079-height)
- x2=x1+length
- y2=y1+height
- cv.rectangle(frame, (x1,y1), (x2,y2), bgr, cv.FILLED)
- film.write(frame)
- print('done')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement