function [X,T] = CS5350_NN_perimeter_features
%

letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m',...
    'n','o','p','q','r','s','t','u','v','w','x','y','z'];
digits = ['1','2','3','4','5','6','7','8','9'];

num_im = 26*9;
res = eye(num_im,num_im);
X = zeros(num_im,5);
T = zeros(num_im,1);

count = 0;
for l = 1:26
    let = letters(l);
    for d = 1:9
        count = count + 1;
        dig = digits(d);
        filename = strcat('A1',let,dig,'.jpg');
        im_l_d = imread(filename);
        im_l_d_bin = im_l_d>100;
        im_s = zeros(32,22);
        im_s(2:end-1,2:end-1) = imresize(im_l_d_bin,[30,20]);
        mid_row = ceil(32/2);
        mid_col = ceil(22/2);
        v1 = bweuler(im_s) + 1;
        v2 = sum(sum(im_s(1:mid_row,:)))...
            >sum(sum(im_s(mid_row+1:end,:)));
        v3 = sum(sum(im_s(:,1:mid_col)))...
            >sum(sum(im_s(:,mid_col+1:end)));
        v4 = sum(sum(im_s(1:mid_row,1:mid_col)))...
            >sum(sum(im_s(mid_row+1:end,mid_col+1:end)));
        v5 = sum(sum(im_s(1:mid_row,mid_col+1:end)))...
            >sum(sum(im_s(mid_row+1:end,1:mid_col)));
        v = [v1;v2;v3;v4;v5]';
        X(count,:) = v;
        T(count,:) = l;
    end
end
