function [ featuresPerPixel ] = extractFeatureVector( image, threshold )
% Hassan Nahas
%This function extracts the feature vectors associated with an image,
%specifically producing a 16 element vector for each pixel where each
%position describes the status of the pixel with respoect to the desired
%pixel. +1  -> brighter, -1 -> darker, 0 -> same.
    featuresPerPixel = zeros(size(image,1),size(image,2),16);
%     allF = extractFeatureVector(img,threshold);
    for x = 1:16
        
        pos = index2pos(x);
        translatedImage = imtranslate(image,-[pos(1), -pos(2)]);
        
        Pbrighter = translatedImage >= (image + threshold);
        Pbrighter = Pbrighter(:,:,1);
        Pdarker = translatedImage <= (image - threshold);
        Pdarker = Pdarker(:,:,1);
%         Psame = (translatedImage > (image - threshold)) &(translatedImage < (image + threshold));
%         Psame = Psame(:,:,1);
        
        featuresPerPixel(:,:,x) = (-1)*Pdarker + Pbrighter;
    end

end

