'**SUMMARY**
smartFindBlobs uses a method called grabCut, also called graph cut, to
automagically determine the boundary of a blob in the image. The dumb find
blobs just uses color threshold to find the boundary, smartFindBlobs looks at
both color and edges to find a blob. To work smartFindBlobs needs either a
rectangle that bounds the object you want to find, or a mask. If you use
a rectangle make sure it holds the complete object. In the case of a mask, it
need not be a normal binary mask, it can have the normal white foreground and black
background, but also a light and dark gray values that correspond to areas
that are more likely to be foreground and more likely to be background. These
values can be found in the color class as Color.BACKGROUND, Color.FOREGROUND,
Color.MAYBE_BACKGROUND, and Color.MAYBE_FOREGROUND.
**PARAMETERS**
* *mask* - A grayscale mask the same size as the image using the 4 mask color values
* *rect* - A rectangle tuple of the form (x_position,y_position,width,height)
* *thresh_level* - This represents what grab cut values to use in the mask after the
graph cut algorithm is run,
* 1  - means use the foreground, maybe_foreground, and maybe_background values
* 2  - means use the foreground and maybe_foreground values.
* 3+ - means use just the foreground
* *appx_level* - The blob approximation level - an integer for the maximum distance between the true edge and the
approximation edge - lower numbers yield better approximation.
**RETURNS**
A featureset of blobs. If everything went smoothly only a couple of blobs should
be present.
**EXAMPLE**
>>> img = Image("RatTop.png")
>>> mask = Image((img.width,img.height))
>>> mask.dl().circle((100,100),80,color=Color.MAYBE_BACKGROUND,filled=True
>>> mask.dl().circle((100,100),60,color=Color.MAYBE_FOREGROUND,filled=True)
>>> mask.dl().circle((100,100),40,color=Color.FOREGROUND,filled=True)
>>> mask = mask.applyLayers()
>>> blobs = img.smartFindBlobs(mask=mask)
>>> blobs.draw()
>>> blobs.show()
**NOTES**
http://en.wikipedia.org/wiki/Graph_cuts_in_computer_vision
**SEE ALSO**
:py:meth:`smartThreshold`'

def smartFindBlobs(self, mask=None, rect=None, thresh_level=2, appx_level=3):

    result = self.smartThreshold(mask, rect)
    binary = None
    retVal = None
    if result:
        if (thresh_level == 1):
            result = result.threshold(192)
        elif (thresh_level == 2):
            result = result.threshold(128)
        elif (thresh_level > 2):
            result = result.threshold(1)
        bm = BlobMaker()
        retVal = bm.extractFromBinary(result, self, appx_level)
    return retVal
