这是一个布朗大学的课程大作业:CS143 Introduction to Computer Vision ,http://cs.brown.edu/courses/cs143/
需要的资料见链接,这里面的内容它页面上的资料完全相同,只不过直接通过其页面链接下载速度十分慢。
首先要安装 vl_feat,然后需要一点 svm,hog 的基础知识。
1. 读取人脸样本
function features_pos = get_positive_features(train_path_pos,feature_params)
image_files = dir( fullfile( train_path_pos, '*.jpg') );
num_images = length(image_files);
dim = (feature_params.template_size/feature_params.hog_cell_size)^2*31;
features_pos = rand(num_images, dim);
for i=1:num_images
img = single(imread(fullfile(train_path_pos, image_files(i).name)))/255;
features_pos(i,:) = reshape(vl_hog(img,feature_params.hog_cell_size),[1 dim]);
end
end
<