Ejemplo n.º 1
0
    def __init__(self, parent=None, cap_Objects=None, time=float):
        super(Save_img_Timer, self).__init__()
        self.parent = parent
        self.cap_Objects = cap_Objects
        self.time = time / 32
        self.save_dirs = []
        self.img_names = []
        self.logger = MyLogging(logger_name='user').logger

        for cap_Object in self.cap_Objects:
            self.save_dirs.append(self.parent.save_path + self.parent.cvid + '/'
                                  + cap_Object.label_name + '/' + \
                                  self.parent.direction + '/')

            self.img_names.append(self.parent.cvid + '_' + self.parent.char + '_' + \
                                  self.parent.date + '_' + cap_Object.label_name +\
                                  '_' + self.parent.direction)

        for save_dir in self.save_dirs:
            if not os.path.exists(save_dir):
                os.makedirs(save_dir)
                self.logger.info('Create dir [%s]' % save_dir)
                msg = 'Create dir [%s]' % save_dir
                self.creat_dirs_msg.connect(self.parent.update_textBrowser)
                self.creat_dirs_msg.emit(msg)

        self.index = 1
        self.isStop = False
Ejemplo n.º 2
0
    def __init__(self, cam_name=None):
        self.cam_name = cam_name
        config = read_config()[self.cam_name]
        self.cam_path = config['cam_path']
        self.width = int(config['width'])
        self.height = int(config['height'])

        self.capture = cv2.VideoCapture(self.cam_path)
        self.capture.set(3, self.width)
        self.capture.set(4, self.height)

        # Logging info
        MyLogging(logger_name='user').logger.info('[%s] Finished '
                                                  'Initializing.' % self.cam_name)
Ejemplo n.º 3
0
    def __init__(self, cofig):
        super(SelfCheck, self).__init__(config)
        self._config = config
        self._necessary_check = config['necessary_check']
        self.mylogger = MyLogging(logger_name='user').logger
        self._show_cam_item = config['operating_mode']['show_cam_item']
        self.check_status = False

        if int(self.necessary_check['database_check']):
            self.databaseCheck()
        if int(self.necessary_check['internet_check']):
            self._InternetCheck()
        if int(self.necessary_check['gpu_check']):
            self.gpuCheck()
Ejemplo n.º 4
0
    def __init__(self, cfg_path='Config.cfg'):
        # 1.Loading Config
        super(Config, self).__init__(cfg_path)
        # 2.Logging
        self.mylogging = MyLogging(logger_name='user')
        self.mylogger = self.mylogging.logger

        self._need_guide = self.config['operating_mode']['need_guide']
        self._cam_path_used = self.config['operating_mode']['cam_path_used']
        self._necessary_check = self.config['necessary_check']
        self._cam_user = self.config['cam_user']
        self._cam_item = self.config['cam_item']
        self._cam_item2 = self.config['cam_item2']
        self._account = self.config['account']
        # Check Hardware and Software before working starting.
        self.before_work()
Ejemplo n.º 5
0
 def __init__(self,
              capture=cv2.VideoCapture,
              width=800,
              height=600,
              label=None,
              label_name=None):
     # Get the capture object from the MainWindow init.
     self.capture = capture
     self.capture.set(3, int(width))
     self.capture.set(4, int(height))
     self.width = width
     self.height = height
     self.label = label
     self.label_name = label_name
     self.currentFrame = np.array([])
     self.logger = MyLogging(logger_name='user').logger
     self.logger.info('Create [Capture]: %s [Label_name]: %s' %
                      (self.capture, self.label_name))
Ejemplo n.º 6
0
    def __init__(self, port_name=None, baud_rate=None,
                 data_bits=None, stop_bits=None):
        # Read config
        config = read_config()[port_name]
        self.port_name = config['port_name']
        self.baud_rate = config['baud_rate']
        self.data_bits = config['data_bits']
        self.stop_bits = config['stop_bits']

        # Initial
        self.weigher = QSerialPort()  # It is the subclass of the QIODevice class;
        self.weigher.setPortName(self.port_name)  # passing name such as 'COM1'
        self.weigher.setBaudRate(int(self.baud_rate))
        self.weigher.setDataBits(QSerialPort.DataBits(int(self.data_bits)))
        self.weigher.setStopBits(QSerialPort.StopBits(int(self.stop_bits)))

        # Logging module
        self.mylogging = MyLogging(logger_name='user')
        self.mylogger = self.mylogging.logger
Ejemplo n.º 7
0
 def __init__(self, port_name=None, baud_rate=None, data_bits=None,
              stop_bits=None):
     # Reading config
     config = read_config()[port_name]
     # Logging module
     self.mylogging = MyLogging(logger_name='user')
     self.mylogger = self.mylogging.logger
     # Configurate door_controller.
     self.door_controller = QSerialPort()
     self.door_controller.setPortName(config['port_name'])
     self.door_controller.setBaudRate(int(config['baud_rate']))
     self.door_controller.setDataBits(int(config['data_bits']))
     self.door_controller.setStopBits(int(config['stop_bits']))
     # Check self.
     self.check()
     # Start to work.
     self.data = QByteArray()
     self.setDataTerminalReady(True)
     self.readyRead.connect(self.acceptData)