cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
var.video.VideoSynthBase Class Reference
Inheritance diagram for var.video.VideoSynthBase:
[legend]
Collaboration diagram for var.video.VideoSynthBase:
[legend]

Public Member Functions

def __init__ (self, size=None, noise=0.0, bg=None, **params)
 
def render (self, dst)
 
def read (self, dst=None)
 
def isOpened (self)
 

Public Attributes

 bg
 
 frame_size
 
 noise
 

Detailed Description

Definition at line 78 of file video.py.

Constructor & Destructor Documentation

◆ __init__()

def var.video.VideoSynthBase.__init__ (   self,
  size = None,
  noise = 0.0,
  bg = None,
**  params 
)

Definition at line 79 of file video.py.

79  def __init__(self, size=None, noise=0.0, bg = None, **params):
80  self.bg = None
81  self.frame_size = (640, 480)
82  if bg is not None:
83  self.bg = cv.imread(cv.samples.findFile(bg))
84  h, w = self.bg.shape[:2]
85  self.frame_size = (w, h)
86 
87  if size is not None:
88  w, h = map(int, size.split('x'))
89  self.frame_size = (w, h)
90  self.bg = cv.resize(self.bg, self.frame_size)
91 
92  self.noise = float(noise)
93 

Member Function Documentation

◆ isOpened()

def var.video.VideoSynthBase.isOpened (   self)

Definition at line 113 of file video.py.

113  def isOpened(self):
114  return True
115 

◆ read()

def var.video.VideoSynthBase.read (   self,
  dst = None 
)

Reimplemented in var.video.Cube, and var.video.Book.

Definition at line 97 of file video.py.

97  def read(self, dst=None):
98  w, h = self.frame_size
99 
100  if self.bg is None:
101  buf = np.zeros((h, w, 3), np.uint8)
102  else:
103  buf = self.bg.copy()
104 
105  self.render(buf)
106 
107  if self.noise > 0.0:
108  noise = np.zeros((h, w, 3), np.int8)
109  cv.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
110  buf = cv.add(buf, noise, dtype=cv.CV_8UC3)
111  return True, buf
112 

◆ render()

def var.video.VideoSynthBase.render (   self,
  dst 
)

Reimplemented in var.video.Chess.

Definition at line 94 of file video.py.

94  def render(self, dst):
95  pass
96 
Here is the caller graph for this function:

Member Data Documentation

◆ bg

var.video.VideoSynthBase.bg

Definition at line 80 of file video.py.

◆ frame_size

var.video.VideoSynthBase.frame_size

Definition at line 81 of file video.py.

◆ noise

var.video.VideoSynthBase.noise

Definition at line 92 of file video.py.


The documentation for this class was generated from the following file: