def __exit__(self): pyrs.stop()
hand_image_string = hand_image_png.tostring() # convert int scores to string of size 2 # fix the size of buffer (=2) if score >= 100: score = 99 elif score >= 10: score_string = str(score) elif score < 0: score_string = '00' else: score_string = '0' + str(score) assert len(score_string) == 2 conn.send(score_string + hand_image_string) else: print "Received garbage:", data except socket.error: print "socket error" pass if render: cd = np.concatenate((c,d), axis=1) cv2.putText(cd, str(fps_smooth)[:4], (0,50), cv2.FONT_HERSHEY_SIMPLEX, 2, (0,0,0)) cv2.imshow('', cd) cv2.imshow('hand', hand_image) if cv2.waitKey(1) & 0xFF == ord('q'): break pyrs.stop()
def stop(self): pyrs.stop() self.device = None
def run(self): while not self.is_stop: self.realsense.wait_for_frames() self.frame = self.realsense.frame() self.dev.stop() pyrs.stop()
def __del__(self): pyrs.stop() #self.video.release() pass