Esempio n. 1
0
    def __init__(self, pic, tau):
        """
        Constructs a blob finder to find blobs in the picture pic, using
        a luminance threshold tau.
        """

        # Initialize an empty list for the blobs in pic.
        self._blobs = []

        # Create a 2D list of booleans called marked, having the same
        # dimensions as pic.
        x = pic.width()
        y = pic.height()
        marked = stdarray.create2D(x, y, False)

        # Enumerate the pixels of pic, and for each pixel (i, j):
        for i in range(x):
            for j in range(y):
                # 1. Create a Blob object called blob.
                blob = Blob()

                # 2. Call _findBlob() with the right arguments.
                self._findBlob(pic, tau, i, j, marked, blob)

                # 3. Add blob to _blobs if it has a non-zero mass.
                if blob.mass() > 0:
                    self._blobs.append(blob)
    def __init__(self, pic, tau):
        """
        Constructs a blob finder to find blobs in the picture pic, using
        a luminance threshold tau.
        """

        # set the blobs list
        self._blobs = []

        # Create a 2D array list with booleans
        List = stdarray.create2D(pic.width(), pic.height(), False)

        # Enumerate the pixels of pics
        for i in range(pic.width()):
            for j in range(pic.height()):
                blob = Blob()
                self._findBlob(pic, tau, i, j, List, blob)
                if blob.mass() > 0:
                    self._blobs.append(blob)
    def __init__(self, pic, tau):
        """
        Constructs a blob finder to find blobs in the picture pic, using
        a luminance threshold tau.
        """

        # Initialize an empty list for the blobs in pic.

        self._blobs = []

        # Create a 2D list of booleans called marked, having the same
        # dimensions as pic.

        marked = stdarray.create2D(pic.width(), pic.height(), False)

        for i in range(pic.width()):
            for j in range(pic.height()):
                b = Blob()
                self.Blobfinder(pic, tau, i, j, marked, b)
                if b.mass() > 0:
                    self._blobs += [b]
Esempio n. 4
0
 def __init__(self, pic, tau):
     """
     Constructs a blob finder to find blobs in the picture pic, using
     a luminance threshold tau.
     """
     # Initialize an empty list for the blobs in pic.
     self._blobs = []
     self.pic = pic
     self.tau = tau
     # Create a 2D list of booleans called marked, having the same
     # dimensions as pic.
     marked = [[False for y in range(self.pic.height())]
               for x in range(self.pic.width())]
     # Enumerate the pixels of pic, and for each pixel (i, j):
     # 1. Create a Blob object called blob.
     # 2. Call _findBlob() with the right arguments.
     # 3. Add blob to _blobs if it has a non-zero mass.
     for i in range(0, self.pic.width()):
         for j in range(0, self.pic.height()):
             blob = Blob()
             self._findBlob(pic, tau, i, j, marked, blob)
             if blob.mass() > 0:
                 self._blobs.append(blob)