#!/usr/bin/env python
# 
# Released under the BSD license. See LICENSE file for details.
"""
This program basically does face detection an blurs the face out.
"""
print __doc__

from simplecv import Camera, Display, HaarCascade

# Initialize the camera
cam = Camera()

# Create the display to show the image
display = Display()

# Haar Cascade face detection, only faces
haarcascade = HaarCascade("face")

# Loop forever
while display.isNotDone():
    # Get image, flip it so it looks mirrored, scale to speed things up
    img = cam.getImage().flip_horizontal().scale(0.5)
    # Load in trained face file
    faces = img.find_haar_features(haarcascade)
    # Pixelize the detected face
    if faces:
        bb = faces[-1].get_bounding_box()
        img = img.pixelize(10, region=(bb[0], bb[1], bb[2], bb[3]))
    # Display the image
    img.save(display)
sudo apt-get install python-zbar


Then line up the item in the red box and left click the mouse to tell
the program to try and read the barcode
'''

print __doc__


import time
import csv
from simplecv import Color, ColorCurve, Camera, Image, pg, np, cv
from simplecv.display import Display

cam = Camera()
display = Display((800,600))
data = "None"
mydict = dict()
myfile = "barcode-list.csv"

while display.isNotDone():
    display.checkEvents()#check for mouse clicks
    img = cam.getImage()
    img.draw_rectangle(img.width/4,img.height/4,img.width/2,img.height/2,color=Color.RED,width=3)
    if display.mouseLeft: # click the mouse to read
        img.draw_text("reading barcode... wait",10,10)
        img.save(display)
        barcode = img.find_barcode()
        if barcode: # if we have a barcode
            data = str(barcode.data)
Ejemplo n.º 3
0
To install on Ubuntu Linux 12.04 or higher:
sudo apt-get install python-zbar


Then line up the item in the red box and left click the mouse to tell
the program to try and read the barcode
'''

print __doc__

import time
import csv
from simplecv import Color, ColorCurve, Camera, Image, pg, np, cv
from simplecv.display import Display

cam = Camera()
display = Display((800, 600))
data = "None"
mydict = dict()
myfile = "barcode-list.csv"

while display.isNotDone():
    display.checkEvents()  #check for mouse clicks
    img = cam.getImage()
    img.draw_rectangle(img.width / 4,
                       img.height / 4,
                       img.width / 2,
                       img.height / 2,
                       color=Color.RED,
                       width=3)
    if display.mouseLeft:  # click the mouse to read
Ejemplo n.º 4
0
#!/usr/bin/env python
#
# Released under the BSD license. See LICENSE file for details.
"""
All this example does is find a face and replace it with another image. The
image should auto scale to match the size of the face.
"""
print __doc__

from simplecv import Camera, Display, HaarCascade, Image

#initialize the camera
cam = Camera()
# Create the display to show the image
display = Display()

# Load the new face image
troll_face = Image('troll_face.png', sample=True)

# Haar Cascade face detection, only faces
haarcascade = HaarCascade("face")

# Loop forever
while display.isNotDone():
    # Get image, flip it so it looks mirrored, scale to speed things up
    img = cam.getImage().flip_horizontal().scale(0.5)
    # load in trained face file
    faces = img.find_haar_features(haarcascade)
    # If there were faces found do something
    if faces:
        face = faces[-1]