本文整理汇总了Python中gui.Gui.set_show_mouse方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.set_show_mouse方法的具体用法?Python Gui.set_show_mouse怎么用?Python Gui.set_show_mouse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.Gui
的用法示例。
在下文中一共展示了Gui.set_show_mouse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import set_show_mouse [as 别名]
class Vision:
def __init__(self, pitch_num, stdout, reset_pitch_size, reset_thresh,
scale, colour_order, render_tlayers, file_input=None):
self.running = True
self.connected = False
self.scale = scale
self.stdout = stdout
self._logger = Logger('vision_errors.log')
if file_input is None:
self.cam = Camera(prop_set = {"width": 720, "height": 540})
else:
file_type = 'video'
if file_input.endswith(('jpg', 'png')):
file_type = 'image'
self.cam = VirtualCamera(file_input, file_type)
try:
calibration_path = os.path.join('calibration', 'pitch{0}'.format(pitch_num))
self.cam.loadCalibration(os.path.join(sys.path[0], calibration_path))
except TypeError:
error_msg = 'Calibration file not found.'
self._logger.log(error_msg)
print error_msg
self.cropper = Cropper(pitch_num=pitch_num, reset_pitch=reset_pitch_size)
self.processor = Processor(pitch_num, reset_pitch_size, reset_thresh, scale)
if self.cropper.is_ready():
self.gui = Gui(self.cropper.pitch_size)
else:
self.gui = Gui()
self.threshold_gui = ThresholdGui(self.processor, self.gui, pitch_num = pitch_num)
self.detection = Detection(self.gui, self.processor, colour_order, scale, pitch_num,
render_tlayers=render_tlayers)
self.event_handler = self.gui.get_event_handler()
self.event_handler.add_listener('q', self.quit)
while self.running:
try:
if not self.stdout:
self.connect()
else:
self.connected = True
if self.cropper.is_ready():
#self.output_pitch_size()
self.detection.set_coord_rect(self.cropper.get_coord_rect())
self.detection.set_pitch_dims(self.cropper.pitch_size)
self.processor.set_crop_rect(self.cropper.get_crop_rect())
self.gui.set_show_mouse(False)
else:
self.event_handler.set_click_listener(self.set_next_pitch_corner)
while self.running:
self.process_frame()
except socket.error:
self.connected = False
# If the rest of the system is not up yet/gets quit,
# just wait for it to come available.
time.sleep(1)
error_msg = 'Connection error, sleeping 1s...'
self._logger.log(error_msg)
print error_msg
self.process_frame()
if not self.stdout:
self.socket.close()
def process_frame(self):
"""Get frame, detect objects and display frame
"""
# This is where calibration comes in
if self.cam.getCameraMatrix is None:
frame = self.cam.getImage()
else:
frame = self.cam.getImageUndistort()
self.processor.preprocess(frame, self.scale)
if self.cropper.is_ready():
self.gui.update_layer('raw', self.processor.get_bgr_frame())
else:
self.gui.update_layer('raw', frame)
if self.cropper.is_ready():
entities = self.detection.detect_objects()
self.output_entities(entities)
self.gui.process_update()
def set_next_pitch_corner(self, where):
self.cropper.set_point(where)
if self.cropper.is_ready():
#self.output_pitch_size()
self.processor.set_crop_rect(self.cropper.get_crop_rect())
self.detection.set_pitch_dims(self.cropper.pitch_size)
self.detection.set_coord_rect(self.cropper.get_coord_rect())
self.gui.draw_crosshair(self.cropper.get_coord_rect()[0], 'corner1')
self.gui.draw_crosshair(self.cropper.get_coord_rect()[1], 'corner2')
self.cropper.get_coord_rect()[0]
#.........这里部分代码省略.........