def getCurrentStatus(self, filename_detections):
pbar = pb.ProgressBar(maxval=len(self._seq.data), widgets=['Loading last status', pb.Percentage(), pb.Bar()])
pbar.start()
cache_str = ''
with open(filename_detections, "r") as inputfile:
cache_str = inputfile.readlines()
for i in xrange(len(self._seq.data)):
pbar.update(i)
if len(self.subset_idxs) > 0:
if i not in self.subset_idxs:
break
hd = HandDetector(numpy.zeros((1, 1)), 0., 0.) # dummy object
com = numpy.asarray(hd.detectFromCache(filename_detections, self._seq.data[i].fileName, cache_str))
if numpy.allclose(com[2], 0.):
self.curFrame = i
break
else:
self._seq.data[i] = self._seq.data[i]._replace(com=self.importer.jointImgTo3D(com.reshape((3,))))
# redo last pose, it might be set to default and saved
if self.curFrame > 0:
if len(self.subset_idxs) > 0:
if self.subset_idxs.index(self.curFrame) - 1 >= 0:
self.curFrame = self.subset_idxs[self.subset_idxs.index(self.curFrame) - 1]
else:
self.curFrame -= 1
评论列表
文章目录