示例#1
0
    def isPlaying(self):
        ret = self._thread is not None and self._thread.isAlive()

        if not ret and self._thread is not None and self._timeSinceStopPlaying is None:
            self._timeSinceStopPlaying = Stopwatch()

        return ret
示例#2
0
文件: intent.py 项目: jyl6932/EMobot
    def playVideo(self, emotion_label):
        ret = True
        if Config.ENABLE_BROWSER:
            ret = self._browserService.searchAndPlay(emotion_label)
            print("**********")
            print(ret)

        if ret:
            self._startPlayingVideoTime = Stopwatch()

        return ret
示例#3
0
    def playVideo(self, objectName):
        ret = True
        self._speech.speak(
            "Hang on a second. Let me play you a video about {0}!".format(
                self._appendObjectNameAbbreviation(objectName)))
        if Config.ENABLE_BROWSER:
            ret = self._browserService.searchAndPlay(objectName)

        if ret:
            self._startPlayingVideoTime = Stopwatch()

        return ret
示例#4
0
    def isAfterPlaying(self):
        if self._thread is None:
            return False

        if not self._thread.isAlive():
            if self._timeSinceStopPlaying is None:
                self._timeSinceStopPlaying = Stopwatch()
                return True
            else:
                return self._timeSinceStopPlaying.get(
                ) / 1000 < self._AFTER_PLAYING_DURATION

        return False
示例#5
0
文件: fpsCalc.py 项目: jyl6932/EMobot
 def __init__(self):
     self._history = []
     self._stopWatch = Stopwatch()
示例#6
0
from pose_estimation.openpose import OpenPose
from video_feed.video_offline_reader import VideoOfflineReader
from video_feed.video_csi_reader import VideoCSIReader
from motion.motion_controller import MotionController

import cv2
import numpy as np
from utilities.stopwatch import Stopwatch

socket_sender = SocketSender()
motion = MotionController()

pose_estimator = OpenPose('models')
video_reader = VideoCSIReader()
num_frames = 0
sw = Stopwatch()
show_preview = True
show_annot = False

while True:
    img = video_reader.read_frame()
    num_frames += 1

    if img is None:
        break

    objects, annot_image = pose_estimator.detect(
        img, return_annotated_image=show_preview)
    roll, pitch, game_state, left_wing_roll_target, right_wing_roll_target, body_height = motion.parse_objects(
        objects)
    socket_sender.send(int(roll), int(pitch), game_state,