我想在不依赖人脸检测的情况下发现人。在照明条件差的情况下,或者佩珀面临的情况下,人们不会被发现。记忆事件“PeoplePerception/JustArrived”和“EngagementZones/PersonApproached”似乎依赖于被摄像机探测到的面孔。是否存在由激光/红外/声纳距离变化触发的记忆事件?
我想知道是否有比以下更好的解决办法:
while True:
floatDist = self.memory.getData('Device/SubDeviceList/Platform/Front/Sonar/Sensor/Value')
if floatDist < 1.0:
doSomething()
sleep(0.5)发布于 2017-10-12 13:50:39
你可以使用前声纳和事件"FaceDetected“进行人体探测。
但是您可以使用PeriodicTask而不是while循环。您在每0.5秒检查一次事件时,将被允许停止该事件。
我会这样做的:
class HumanDetector:
def __init__(self, ALMemory):
self.ALMemory = ALMemory
# subscribe to FaceDetected
self.subscriber = self.ALMemory.subscriber("FaceDetected")
self.subscriber.signal.connect(self.on_human_tracked)
self.task = qi.PeriodicTask()
self.task.setCallback(self._task)
self.task.setUsPeriod(50000)
self.task.start(True)
def on_human_tracked(self, value):
print "do something with the face"
def _stop(self):
print "_stop..."
self.task.stop()
self.face_detection.unsubscribe("FaceDetected")
print "_stop done"
def _task(self):
print "_task..."
floatDist = self.memory.getData('Device/SubDeviceList/Platform/Front/Sonar/Sensor/Value')
if floatDist < 1.0:
print "do something with the object in front of the robot"
print "_task done"因此,这是一个需要模块ALMemory的python的示例。使用模块ALMemory,您将检查声纳和是否检测到面部。
https://stackoverflow.com/questions/46054420
复制相似问题