本文整理汇总了Python中Point.Point.start方法的典型用法代码示例。如果您正苦于以下问题:Python Point.start方法的具体用法?Python Point.start怎么用?Python Point.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point.Point
的用法示例。
在下文中一共展示了Point.start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LaserMote
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import start [as 别名]
class LaserMote(object):
NOT_FOUND_TEXT = "Laser pointer is not detected."
BOTTOM_LEFT_COORD = (25, 460)
def __init__(self,
min_hue=155, max_hue=179,
min_sat=100, max_sat=255,
min_val=200, max_val=255,
min_area=2, max_area=300,
reset_time=None, wait_time=5,
distance_threshold=25,
tracking_method=1,
capture_locations_flag=True,
locations_size=1,
write_to_video=False,
debug=False, ):
"""
Initializes all needed variables.
:param capture_locations_flag: boolean to determine whether or not ROIs should be set or already set
:param min_hue: minimum hue allowed.
:param max_hue: maximum hue allowed.
:param min_sat: minimum saturation allowed.
:param max_sat: maximum saturation allowed.
:param min_val: minimum value allowed.
:param max_val: maximum value allowed.
:param min_area: minimum area of the laser dot to look for.
:param max_area: maximum area of the laser dot to look for.
:param reset_time: time threshold to reset the last seen laser dot if not seen.
:param wait_time: the wait time to execute an action "turn on tv, print something, etc".
:param distance_threshold: threshold of the distance between current point location and last seen point location.
:param tracking_method: which tracking method to use.
:param write_to_video: boolean to write to video.
:param debug: boolean to allow/disallow debug printing and extra windows.
:rtype : LaserMote object.
"""
self.min_hue = min_hue
self.max_hue = max_hue
self.min_sat = min_sat
self.max_sat = max_sat
self.min_val = min_val
self.max_val = max_val
self.min_area = min_area
self.max_area = max_area
if not reset_time:
if tracking_method == 1:
self.reset_time = 1.5
elif tracking_method == 2:
self.reset_time = 2
else:
self.reset_time = 1
self.wait_time = wait_time
self.camera = None
self.out = None
self.write_to_video = write_to_video
self.capture_locations_flag = capture_locations_flag
if not capture_locations_flag:
self.locations_size = 0
else:
self.locations_size = locations_size
cv2.namedWindow('result')
cv2.setMouseCallback("result", self.capture_locations, 0)
self.debug = debug
self.result = None
self.background = None
self.blacked = None
self.point = Point(reset_time=self.reset_time, wait_time=self.wait_time, debug=self.debug)
self.point.setName('PointThread')
self.point.daemon = True # make deamon thread to terminate when main program ends
self.point.start()
self.distance_threshold = distance_threshold
self.tracking_method = tracking_method
self.reference_points = []
self.object_locations = []
def capture_locations(self, event, x, y, flags, params):
"""
Captures mouse event for creating the ROIs
:param event:
:param x:
:param y:
:param flags:
:param params:
"""
for i in xrange(self.locations_size):
#.........这里部分代码省略.........