Esempio n. 1
0
    def isolate(self,frame):
        blobs = []
        grayscale  = cv2.cvtColor( frame.data, cv2.COLOR_BGR2GRAY )
        rectangles = self.cascade.detectMultiScale( grayscale, scaleFactor=1.2, minNeighbors=3, minSize=self.min_size)
        
        for r in rectangles:
            b = Blob( self.get_estimation_id() ) 
            b.x, b.y = r[0:2]
            b.w, b.h = r[2:4]
            blobs.append(b)

        return blobs
Esempio n. 2
0
def create_blobs_line(settings, screen, blobs):
    """Создает ряд капель"""
    blob = Blob(settings, screen)
    blob_width = blob.rect.width
    blob_number_x = get_number_blob_x(settings, blob_width)

    # Создаем ряд капель
    for blob_number in range(blob_number_x):
        # Создание капли и размещение ее в ряду
        blob = Blob(settings, screen)
        blob.x = blob_width + 2 * blob_width * blob_number
        blob.rect.x = blob.x
        blobs.add(blob)