Blob detection in images

SimpleCV has functions to detect blobs in an image. The following code uses the findBlobs() function to detect blobs in the image:

from SimpleCV import Image
import time
img=Image('/home/pi/book/test_set/7.1.02.tiff')
imgBin=img.binarize()
blobs=imgBin.findBlobs()
blobs.show(width=5)
time.sleep(5)

The input image (an aerial photograph of a plane in a hanger) and the detected blobs are as follows:

Blob detection in images

SimpleCV also has a findSkintoneBlobs() function that automatically finds skin-toned blobs from an image. The following program uses the findSkintoneBlobs() function on the live stream that is received from the camera:

from SimpleCV import Image, Camera

cam = Camera()
while 1:
  img=cam.getImage()
  skin =img.findSkintoneBlobs()

  if skin:
    for i in skin:
      print i.centroid()
    skin.draw(), skin.show()
  else:
    print "No Skin detected"

In the preceding program, we printed the centroids of the detected skin-toned blobs. However, the output is highly dependent on the skin tone of the subject person and the lighting conditions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.96.247