MCPcopy
hub / github.com/makelove/OpenCV-Python-Tutorial / getNextFrame

Method getNextFrame

官方samples/tst_scene_render.py:79–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

77 return np.array([x0, y0, x1, y1])
78
79 def getNextFrame(self):
80 img = self.sceneBg.copy()
81
82 if self.foreground is not None:
83 self.currentCenter = (self.center[0] + self.getXOffset(self.time), self.center[1] + self.getYOffset(self.time))
84 img[self.currentCenter[0]:self.currentCenter[0]+self.foreground.shape[0],
85 self.currentCenter[1]:self.currentCenter[1]+self.foreground.shape[1]] = self.foreground
86 else:
87 self.currentRect = self.initialRect + np.int( 30*cos(self.time*self.speed) + 50*sin(self.time*self.speed))
88 if self.deformation:
89 self.currentRect[1:3] += self.h/20*cos(self.time)
90 cv2.fillConvexPoly(img, self.currentRect, (0, 0, 255))
91
92 self.time += self.timeStep
93 return img
94
95 def resetTime(self):
96 self.time = 0.0

Callers 3

readMethod · 0.80
readMethod · 0.80

Calls 2

getXOffsetMethod · 0.95
getYOffsetMethod · 0.95

Tested by

no test coverage detected