예제 #1
0
    def subtract(self, blobA, blobB, scene):
        """
        Create a new blob that subtracting the second blob from the first one
        """

        (mask, box) = Mask.subtract(blobA.getMask(), blobA.bbox,
                                    blobB.getMask(), blobB.bbox)
        if mask.any():
            # measure is brutally slower with non int types (factor 4), while byte&bool would be faster by 25%, conversion is fast.
            blobA.updateUsingMask(box, mask.astype(int))
            return True
        return False
예제 #2
0
    def subtract(self, blobA, blobB):
        """
        Update the blobA subtracting the blobB from it
        """
        (mask, box) = Mask.subtract(blobA.getMask(), blobA.bbox,
                                    blobB.getMask(), blobB.bbox)

        if mask.any():
            # measure is brutally slower with non int types (factor 4), while byte&bool would be faster by 25%, conversion is fast.
            blobA.updateUsingMask(box, mask.astype(int))
            return True
        return False