Face Hallucination

PCA Feature Reduction for Face Hallucination

Coefficients Matrix

Apply PCA to low resolution input image


im_path = 'SplitFrame_000.bmp';
lowres = imread(im_path);
dbl_lowres = double(lowres);
width = size(lowres,1);
height = size(lowres,2);

rshp_lowres = reshape(lowres, width*height, 3);

%% figure, imshow(rshp_lowres);
coeff = pca(double(rshp_lowres));


Multiply each low resolution training image by the coefficient matrix. The inner product is interpreted as projecting the training set into the coordinate space that provides maximum between class variance.

lowres_dir_path = uigetdir;
image_files = dir(strcat(lowres_dir_path, '\*.bmp'));
num_files = length(image_files);
table_of_features = [];
for i = 1 : num_files
    %% check isDir
    file_name = image_files(i).name;
    training_image = imread(strcat(lowres_dir_path ,'\', file_name));
    training_image = double(training_image);
    training_width = size(training_image, 1);
    training_height = size(training_image, 2);
    reshaped_training_image = reshape(training_image, width * height, 3);
    reduced_image = reshaped_training_image * coeff;
    table_of_features = [table_of_features; transpose(reduced_image)];


Finally save the results for KNN processing

save features.dat table_of_features -ascii -double;


[1] http://www.mathworks.com/matlabcentral/answers/167938-how-pca-can-be-applied-to-an-image-to-reduce-its-dimensionality-with-example


One thought on “PCA Feature Reduction for Face Hallucination

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s