本文整理汇总了Python中Point.Point.is_on方法的典型用法代码示例。如果您正苦于以下问题:Python Point.is_on方法的具体用法?Python Point.is_on怎么用?Python Point.is_on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point.Point
的用法示例。
在下文中一共展示了Point.is_on方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LaserMote
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import is_on [as 别名]
#.........这里部分代码省略.........
str(cx), str(cy),
str(self.get_distance(cx, cy)))
# update last point locations
self.point.update_last_seen_position(cx, cy)
self.point.set_on()
self.point.current_object = self.is_dot_within_rois(cx, cy)
# cv2.drawContours(frame, cnt, -1, GREEN, 15) # draws the contour
cv2.circle(frame, (cx, cy), 1, GREEN, thickness=4, lineType=8, shift=0) # circle cnt center
elif not self.point.was_seen():
# cv2.drawContours(frame, cnt, -1, BLUE, 15) # draws the contour
self.point.set_on()
self.point.update_last_seen_position(cx, cy)
self.point.current_object = self.is_dot_within_rois(cx, cy)
if self.debug:
print '[DEBUG] First seen point is at: ({0},{1}).'.format(str(cx), str(cy))
print '[DEBUG] Updated last seen coordinates.'
cv2.putText(
frame,
self.debug_text(cx, cy, area, found=True), LaserMote.BOTTOM_LEFT_COORD,
cv2.FONT_HERSHEY_SIMPLEX, 0.5, WHITE, 1)
found_valid_point = True
break # only one contour
if not found_valid_point:
cv2.putText(frame, self.debug_text(),
LaserMote.BOTTOM_LEFT_COORD, cv2.FONT_HERSHEY_SIMPLEX, 0.5, WHITE, 1)
if self.point.is_on() and self.point.was_seen():
current_object = self.is_dot_within_rois(self.point.last_seen_x, self.point.last_seen_y)
self.point.set_off(current_object)
return frame
def run(self):
self.setup_capture()
if self.write_to_video:
self.setup_video()
while True:
# get frame
ret, frame = self.camera.read()
# get frame size
# w, h = frame.shape[:2]
# mirror the frame
frame = cv2.flip(frame, 1)
mask = None
# wait for space to be clicked to capture background
if cv2.waitKey(1) == 32:
print 'background captured'
self.background = frame
# clean up noise by adding median blur
cv2.medianBlur(self.background, 5, self.background)
self.blacked = cv2.bitwise_and(frame, frame, mask=mask)
if self.debug and (self.blacked is not None):
# absDiff = cv2.absdiff(self.background, frame)