<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 The beginning of a demo
Step1:  Here we set up the camera
Step2:  Now we also get a single image from the cam, so mug it up!
Step3:  In Ipython Notebook, you can sometimes use TAB autocompletion if the variable is in memory.
Let's see what "sh" brings up.
img.sh
Let's try shrinking beforehand
Step4:  Let's try getting some documentation
Step5:  Okay, cool - built in documentation. Good.
Let's draw some text on it.
Step6:  Let's look at some people
Who's there?
This function lists what features we can detect (built in).
Step7:  Look at the image set as a whole
<ASSISTANT_TASK:>
Python Code:
from SimpleCV import *
from time import sleep
#import pytesseract
from bs4 import BeautifulSoup
Explanation: The beginning of a demo
End of explanation
cam = Camera()
Explanation: Here we set up the camera
End of explanation
img = cam.getImage()
Explanation: Now we also get a single image from the cam, so mug it up!
End of explanation
img.scale(0.5).show()
# Okay, let's keep that
img = img.scale(0.5)
Explanation: In Ipython Notebook, you can sometimes use TAB autocompletion if the variable is in memory.
Let's see what "sh" brings up.
img.sh
Let's try shrinking beforehand
End of explanation
img.edges?
Explanation: Let's try getting some documentation
End of explanation
# This draws directly onto the image (in place)
img.drawText('RASPBERRY Pi', 10, 10, color=Color.BLUE, )
img.show()
#Let's try bigger font
img.drawText('RASPBERRY Pi', 10, 10, color=Color.ORANGE, fontsize=50)
img.drawText('SimpleCV', 10, 100, color=Color.ORANGE, fontsize=50)
img.show()
#from SimpleCV import Image, Color, Display
# Make a function that does a half and half image.
def halfsies(left,right): 
    result = left
    # crop the right image to be just the right side.
    crop   = right.crop(right.width/2.0,0,right.width/2.0,right.height)
    # now paste the crop on the left image.
    result = result.blit(crop,(left.width/2,0))
    # return the results.
    return result
# Load an image from imgur.
#img = Image('http://i.imgur.com/lfAeZ4n.png')
# binarize the image using a threshold of 90 
# and invert the results.
output = img.binarize().invert()
# create the side by side image.
result = halfsies(img,output)
result.show()
Explanation: Okay, cool - built in documentation. Good.
Let's draw some text on it.
End of explanation
img.listHaarFeatures()
ppl = Image('group.jpg')
ppl = Image('tng.jpg')
ppl.show()
#obs = ppl.findHaarFeatures('face.xml')
obs = ppl.findHaarFeatures('upper_body.xml')
for f in obs:
    print str(f.coordinates())
    f.draw(color=Color.YELLOW, width=4)
    
    
ppl.show()
Explanation: Let's look at some people
Who's there?
This function lists what features we can detect (built in).
End of explanation
print obs.sortX()
# Highlight the person on the end
feat1 = obs.sortX()[-1]
feat1.draw(color=Color.RED, width=4)
feat2 = obs.sortX()[0]
# reshow the image after drawing in it
ppl.show()
# Here's a function that may help you swap parts in two images.
def swap( img1, f1, f2):
    # Gte a "mask" that is the first feature cropped and ressized 
    # to the size of the second feature.
    f1mask = f1.crop().resize(w=f2.width(), h=f2.height())
    
    # get the similar for the other
    f2mask = f2.crop().resize(w=f1.width(), h=f1.height())
    
    
    # Set up the output images
    out1 = img1.blit( f2mask, f1.topLeftCorner(), alpha=0.8)
    out2 = out1.blit( f1mask, f2.topLeftCorner(), alpha=0.8)
    
    return out1, out2
# Run the swap and ignore the first return value
img3, img4 = swap( ppl, feat1, feat2)
img4.show()
while True:
    # Reduce the image size
    img = cam.getImage().scale(0.5)
    faces = img.findHaarFeatures("face.xml")
    for f in faces:
        f.draw(width=3)
    img.show()
### NOTE: I think you'll want to move this code to the while loop above so it's executed repeatedly.
# That while loop never exits right now (always True)
face1 = faces.sortX()[]
face2= faces.sortX()[1]
img1 = swap (img, face1, face2)
img1.show()
Explanation: Look at the image set as a whole
End of explanation
<END_TASK>