Пример #1
0
print(__doc__)

###############################################################################
# Building SVC from database

FACE_DIM = (50, 50)  # h = 50, w = 50

# Load training data from face_profiles/
face_profile_data, face_profile_name_index, face_profile_names = ut.load_training_data(
    "../face_profiles/")

print "\n", face_profile_name_index.shape[0], " samples from ", len(
    face_profile_names), " people are loaded"

# Build the classifier
clf, pca = svm.build_SVC(face_profile_data, face_profile_name_index, FACE_DIM)

###############################################################################
# Facial Recognition In Live Tracking

DISPLAY_FACE_DIM = (200, 200)  # the displayed video stream screen dimention
SKIP_FRAME = 2  # the fixed skip frame
frame_skip_rate = 0  # skip SKIP_FRAME frames every other frame
SCALE_FACTOR = 4  # used to resize the captured frame for face detection for faster processing speed
face_cascade = cv2.CascadeClassifier(
    "../classifier/haarcascade_frontalface_default.xml"
)  #create a cascade classifier
sideFace_cascade = cv2.CascadeClassifier(
    '../classifier/haarcascade_profileface.xml')

if len(sys.argv) == 2:
Пример #2
0

print(__doc__)

###############################################################################
# Building SVC from database

FACE_DIM = (50,50) # h = 50, w = 50

# Load training data from face_profiles/
face_profile_data, face_profile_name_index, face_profile_names  = ut.load_training_data("../face_profiles/")

print "\n", face_profile_name_index.shape[0], " samples from ", len(face_profile_names), " people are loaded"

# Build the classifier
clf, pca = svm.build_SVC(face_profile_data, face_profile_name_index, FACE_DIM)


###############################################################################
# Facial Recognition In Live Tracking


DISPLAY_FACE_DIM = (200, 200) # the displayed video stream screen dimention 
SKIP_FRAME = 2      # the fixed skip frame
frame_skip_rate = 0 # skip SKIP_FRAME frames every other frame
SCALE_FACTOR = 4 # used to resize the captured frame for face detection for faster processing speed
face_cascade = cv2.CascadeClassifier("../classifier/haarcascade_frontalface_default.xml") #create a cascade classifier
sideFace_cascade = cv2.CascadeClassifier('../classifier/haarcascade_profileface.xml')

if len(sys.argv) == 2:
    SCALE_FACTOR = float(sys.argv[1])