本文整理汇总了Python中fabscan.FSConfig.Config.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Config.instance方法的具体用法?Python Config.instance怎么用?Python Config.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fabscan.FSConfig.Config
的用法示例。
在下文中一共展示了Config.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self, cambuffer):
threading.Thread.__init__(self)
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.config = Config.instance()
self.camera_buffer = cambuffer
self.isRecording = True
self.timestamp = int(round(time.time() * 1000))
self.semaphore = threading.BoundedSemaphore()
self.config = Config.instance()
self.settings = Settings.instance()
self.prior_image = None
self.stream = None
# auto exposure mode for logitech C270 can not be controlled by opencv, with this work
# around the exposer mode can be set direcly by v4l2
subprocess.call(["v4l2-ctl", "--set-ctrl", "exposure_auto=1"])
self.camera = cv2.VideoCapture(self.config.camera.device)
self.camera.set(3,1280)
self.camera.set(4,720)
self._logger.debug("Selected Camera Device %i" % (int(self.config.camera.device)))
self.start()
示例2: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self, cambuffer):
threading.Thread.__init__(self)
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.config = Config.instance()
self.camera_buffer = cambuffer
self.isRecording = True
self.timestamp = int(round(time.time() * 1000))
self.semaphore = threading.BoundedSemaphore()
self.config = Config.instance()
self.settings = Settings.instance()
self.prior_image = None
self.stream = None
# auto exposure mode for logitech C270 can not be controlled by opencv, with this work
# around the exposer mode can be set direcly by v4l2
# a value of 1 deactivates auto exposure
#subprocess.call(["v4l2-ctl", "--set-ctrl", "exposure_auto=1"])
try:
self.camera = cv2.VideoCapture(self.config.camera.device)
except:
self._logger.error("Can not create camera device.")
return
# this sets the resolution of the C270 which is 1280x720 by default
self.camera.set(3,1280)
self.camera.set(4,720)
self._logger.debug("Selected Camera Device %i" % (int(self.config.camera.device)))
self.start()
示例3: delete_scan
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def delete_scan(scan_id,ignore_errors=True):
#basedir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
folder = Config.instance().folders.scans+scan_id+"/"
mask = Config.instance().folders.scans+scan_id+"/"'*.[pso][ltb][lyj]'
number_of_files = len(glob.glob(mask))
示例4: run
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def run(self):
self._logger.info("FabScanPi-Server "+str(__version__))
try:
# create Singleton instances
_config = Config.instance(self.config_file)
_settings = Settings.instance(self.settings_file)
_hardwareController = HardwareController.instance()
_eventManager = FSEventManager.instance()
# Websocket Server
self.fsWebSocketServer = FSWebSocketServer()
self.fsWebSocketServer.start()
_scanner = FSScanner()
_scanner.start()
# Web Server
self.fsWebServer = WebServer()
self.fsWebServer.serve_forever()
except (KeyboardInterrupt, SystemExit):
time.sleep(0.5)
_hardwareController.laser.off()
_hardwareController.led.off()
_hardwareController.turntable.stop_turning()
sys.exit(0)
示例5: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self):
super(FSScanProcessor, self).__init__()
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self._prefix = None
self._resolution = 16
self._number_of_pictures = 0
self._total = 0
self._laser_positions = 1
self._progress = 0
self._is_color_scan = True
self.point_cloud = None
self.image_task_q = multiprocessing.Queue(5)
self.current_position = 0
self._laser_angle = 33.0
self._stop_scan = False
self._current_laser_position = 1
self.eventManager = FSEventManager.instance()
self.settings = Settings.instance()
self.config = Config.instance()
self.semaphore = multiprocessing.BoundedSemaphore()
self._contrast = 0.5
self._brightness = 0.5
self.event_q = self.eventManager.get_event_q()
self._worker_pool = FSImageWorkerPool(self.image_task_q,self.event_q)
self.hardwareController = HardwareController.instance()
self.eventManager.subscribe(FSEvents.ON_IMAGE_PROCESSED, self.image_processed)
self._scan_brightness = self.settings.camera.brightness
self._scan_contrast = self.settings.camera.contrast
示例6: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self):
super(FSSettingsPreviewProcessor, self).__init__()
self.hardwareController = HardwareController.instance()
self.eventManager = FSEventManager.instance()
self.config = Config.instance()
self.settings = Settings.instance()
self._image_processor = ImageProcessor(self.config, self.settings)
示例7: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self, prefix):
threading.Thread.__init__(self)
self.eventManager = FSEventManager.instance()
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.settings = Settings.instance()
self.config = Config.instance()
self.prefix = prefix
示例8: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self):
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.config = Config.instance()
self._port = self.config.serial.port
self._baudrate = self.config.serial.baudrate
self._serial = None
self._openSerial()
示例9: load_image
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def load_image(number, prefix, dir_name="scans"):
dir_name = Config.instance().folders.scans + dir_name
prefix = os.path.join(dir_name, "%s_{0}" % prefix)
number = str(number).zfill(3)
if os.path.isfile(prefix.format(number) + ".jpg"):
image = cv2.imread(prefix.format(number) + ".jpg")
return image
else:
return None
示例10: delete_scan
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def delete_scan(scan_id,ignore_errors=True):
#basedir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
folder = Config.instance().folders.scans+scan_id+"/"
if os.path.isdir(folder):
shutil.rmtree(folder, ignore_errors=True)
else:
print "Nothing to delete..."
示例11: save_image
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def save_image(img, number, prefix, dir_name="scans"):
dir_name = Config.instance().folders.scans + dir_name
if not os.path.exists(dir_name):
os.makedirs(dir_name)
prefix = os.path.join(dir_name, "%s_{0}" % prefix)
number = str(number).zfill(3)
cv2.imwrite(prefix.format(number) + ".jpg", img)
return prefix.format(number) + ".jpg"
示例12: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self, task_q, event_q):
self._task_q = task_q
self._event_q = event_q
self.workers = []
self.config = Config.instance()
self._number_of_workers = self.config.process_numbers
self._workers_active = False
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
示例13: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self, id, filter, format):
threading.Thread.__init__(self)
self.eventManager = FSEventManager.instance()
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.settings = Settings.instance()
self.config = Config.instance()
self.scan_id = id
self.filter = filter
self.format = format
示例14: __init__
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def __init__(self):
self._logger = logging.getLogger(__name__)
self._logger.setLevel(logging.DEBUG)
self.config = Config.instance()
if hasattr(self.config.serial, 'port'):
self._port = self.config.serial.port
else:
self._port = self._port = self.serialList()[0]
self._baudrate = self.config.serial.baudrate
self._serial = None
self._connected = False
self._openSerial()
示例15: create
# 需要导入模块: from fabscan.FSConfig import Config [as 别名]
# 或者: from fabscan.FSConfig.Config import instance [as 别名]
def create(self, number_of_workers):
'''
Create Processes in Pool
'''
self.set_number_of_workers(number_of_workers)
for _ in range(self._number_of_workers):
worker = FSImageWorkerProcess(Settings.instance(), Config.instance(), self._task_q, self._event_q)
worker.daemon = True
worker.start()
self.workers.append(worker)
self._workers_active = True
return self.workers