Esempio n. 1
0
	def __init__(self, save_logs_):
		self._cap = scorer.VideoCapture(0)
		self._detected = np.array([])
		self.bgr = None
		self.time = None
		self._thumbnail = np.zeros(3)
		self._bgsub = None
		self._fgmask = np.zeros(3)
		self._save_logs = save_logs_

		try:
			self._cascade = cv2.CascadeClassifier(CASCADE_PATH)
		except:
			print('Face cascade is not found')
		
		if not os.path.isdir(LOG_PATH):
			os.makedirs(LOG_PATH)

		if self._save_logs:
        		self._logger = logging.getLogger('detect_log')
        		self._logger.setLevel(10)
        		log = logging.FileHandler(LOG_PATH + 'detect.log')
        		self._logger.addHandler(log)
        		stream = logging.StreamHandler()
        		self._logger.addHandler(stream)
Esempio n. 2
0
 def __init__(self):
     self.cap = scorer.VideoCapture(0)
     self.hog = cv2.HOGDescriptor()
     self.hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
Esempio n. 3
0
args = sys.argv

# GPIO Set UP
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
pin_list = (24, 23)

# Get ROI Information
roi = scorer_util.ROIStorage(
    os.path.dirname(__file__) + "/raspi_magazine.json")
x1, y1, x2, y2 = roi.get_roi_rect_by_index(0)

# Get Camera Object
cap = scorer.VideoCapture(0)

if len(args) > 1:
    # Get Image Frame
    frame = cap.read()
    if frame == None:
        sys.exit()

    # Get BGR data(CvMati format)
    bgr = frame.get_bgr()

    # Trim the BGR Image
    rect = bgr[y1:y2, x1:x2]

    if args[1] == "on":
        # Save the Image