|
def | __init__ (self, **kw) |
|
def | draw_quads (self, img, quads, color=(0, 255, 0)) |
|
def | render (self, dst) |
|
def | __init__ (self, size=None, noise=0.0, bg=None, **params) |
|
def | read (self, dst=None) |
|
def | isOpened (self) |
|
Definition at line 140 of file video.py.
◆ __init__()
def var.video.Chess.__init__ |
( |
|
self, |
|
|
** |
kw |
|
) |
| |
Definition at line 141 of file video.py.
141 def __init__(self, **kw):
142 super(Chess, self).__init__(**kw)
144 w, h = self.frame_size
146 self.grid_size = sx, sy = 10, 7
149 for i, j
in np.ndindex(sy, sx):
150 q = [[j, i, 0], [j+1, i, 0], [j+1, i+1, 0], [j, i+1, 0]]
151 [white_quads, black_quads][(i + j) % 2].append(q)
152 self.white_quads = np.float32(white_quads)
153 self.black_quads = np.float32(black_quads)
156 self.K = np.float64([[fx*w, 0, 0.5*(w-1)],
157 [0, fx*w, 0.5*(h-1)],
160 self.dist_coef = np.float64([-0.2, 0.1, 0, 0])
◆ draw_quads()
def var.video.Chess.draw_quads |
( |
|
self, |
|
|
|
img, |
|
|
|
quads, |
|
|
|
color = (0, 255, 0) |
|
) |
| |
Definition at line 163 of file video.py.
163 def draw_quads(self, img, quads, color = (0, 255, 0)):
164 img_quads = cv.projectPoints(quads.reshape(-1, 3), self.rvec, self.tvec, self.K, self.dist_coef) [0]
165 img_quads.shape = quads.shape[:2] + (2,)
167 cv.fillConvexPoly(img, np.int32(q*4), color, cv.LINE_AA, shift=2)
◆ render()
def var.video.Chess.render |
( |
|
self, |
|
|
|
dst |
|
) |
| |
Reimplemented from var.video.VideoSynthBase.
Definition at line 169 of file video.py.
169 def render(self, dst):
173 sx, sy = self.grid_size
174 center = np.array([0.5*sx, 0.5*sy, 0.0])
175 phi = pi/3 + sin(t*3)*pi/8
176 c, s = cos(phi), sin(phi)
177 ofs = np.array([sin(1.2*t), cos(1.8*t), 0]) * sx * 0.2
178 eye_pos = center + np.array([cos(t)*c, sin(t)*c, s]) * 15.0 + ofs
179 target_pos = center + ofs
181 R, self.tvec = common.lookat(eye_pos, target_pos)
182 self.rvec = common.mtx2rvec(R)
184 self.draw_quads(dst, self.white_quads, (245, 245, 245))
185 self.draw_quads(dst, self.black_quads, (10, 10, 10))
◆ black_quads
var.video.Chess.black_quads |
◆ dist_coef
var.video.Chess.dist_coef |
◆ grid_size
var.video.Chess.grid_size |
◆ rvec
◆ tvec
◆ white_quads
var.video.Chess.white_quads |
The documentation for this class was generated from the following file:
- repos_for_Dox/cFp_Zoo/HOST/vision/common/languages/python/var/video.py