def on_data(self, ispan):
"""Process data from from ispans to ospans and return the number of
frames to commit for each output (or None to commit complete spans)."""
data = ispan.data
print "PgmWriterBlock.on_data()"
# HACK TESTING
if data.dtype != np.uint8:
data = (data - data.min()) / (data.max() - data.min()) * 255
#data = np.clip(data, 0, 255)
data = data.astype(np.uint8)
#data = data.astype(np.uint16)
if self.outfile is None:
return
data.tofile(self.outfile)
# HACK TESTING only write the first gulp
self.outfile.close()
self.outfile = None
评论列表
文章目录