function [ flattened ] = flatten( features )
% Hassan Nahas
%This function flattens a feature space that is expected to be 3
%dimensional to 2 dimensions.
    isfeaturevector = size(features,3) >= 16;
    
    if isfeaturevector
        flattened = permute(features,[3,1,2]);
        flattened = reshape(flattened,size(features,3),[]);
    else
        flattened = reshape(features,1,[]);
    end
    
end

