Commit 3de59144 authored by Gihan Jayatilaka's avatar Gihan Jayatilaka

rand-data-2

parent be1d0615
import sys
import numpy as np
import cv2
import random
def flip(p):
return True if random.random() < p else False
def makeVideo(READ_VIDEO_FILE,msg,WRITE_VIDEO_FILE,DELTA):
......@@ -42,15 +45,16 @@ def makeVideo(READ_VIDEO_FILE,msg,WRITE_VIDEO_FILE,DELTA):
mask = np.repeat(mask, HEIGHT/GRID_Y, axis=0)
mask = np.repeat(mask, WIDTH/GRID_X, axis=1)
#print(msg)
mask = mask.astype(np.float32) +\
(mask==np.full(shape=mask.shape,fill_value=0)).astype(np.float32)*np.random.uniform(low=0.0,high=0.2,size=mask.shape) \
mask = (mask==np.full(shape=mask.shape,fill_value=0)).astype(np.float32)*np.random.uniform(low=0.0,high=0.2,size=mask.shape) \
+ (mask==np.full(shape=mask.shape,fill_value=1)).astype(np.float32)*np.random.uniform(low=0.8,high=1.0,size=mask.shape)
r=np.random.randint(low=2,high=6,size=1)
r=r[0]
r=5
mask=cv2.GaussianBlur(mask,ksize=(r,r),sigmaX=0)
if flip(0.6):
if flip(0.6):
mask=cv2.GaussianBlur(mask,ksize=(5,5),sigmaX=0)
else:
mask=cv2.GaussianBlur(mask,ksize=(15,15),sigmaX=0)
raw = cv2.cvtColor(cv2.resize(frame, (WIDTH, HEIGHT)), cv2.COLOR_BGR2LAB)
l,a,b = cv2.split(raw)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment