本文整理汇总了Python中arduino.Arduino.push方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.push方法的具体用法?Python Arduino.push怎么用?Python Arduino.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arduino.Arduino
的用法示例。
在下文中一共展示了Arduino.push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import push [as 别名]
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=10,
minSize=(30, 30),
flags=cv2.CASCADE_SCALE_IMAGE
)
height, width, channels = frame.shape
cv2.line(frame, (width / 2, 0), (width / 2, height), color=(0, 0, 255))
if len(faces) == 0:
arduino.push("0 0")
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
centerX = x + (w / 2)
centerY = y + (h / 2)
center = (centerX, centerY)
cv2.circle(frame, center, 20, color=(0, 0, 255))
if x < width /2 and x + w > width / 2:
push_x = 0
elif width / 2 > centerX:
push_x = -1
else:
示例2: __int__
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import push [as 别名]
class Eye:
def __int__(self):
self.arduino = Arduino()
def look(self, x, y):
self.arduino.push(x + " " + y + " +")