function [features] = getFeaturesFromF(F)

DEM = F2DEM(F);

%% pitch & roll
PITCH = F(101);
ROLL = abs(F(110));

%% line averages
LIN_AVGS = zeros(8,1);
index = 0;
for line = 9:16
    index = index + 1;
    DEM_line = DEM(line,:); 
    if (sum(isnan(DEM_line)) > 3)              % if there are more than 3 NaN in line
        LIN_AVGS(index) = NaN;                 % assign NaN
    else
        LIN_AVGS(index) = nanmean(DEM_line);   % compute average (exclude nan values)
    end
end

% standard deviation of line averages
LIN_AVGS_STD = nanstd(LIN_AVGS);

%% number of NaNs in front of robot:
NAN_COUNT = zeros(3,1);
NAN_COUNT(1) = sum(sum(isnan(DEM(12:13,:))));   % compute number of NaN within defined area of DEM
NAN_COUNT(2) = sum(sum(isnan(DEM(13:14,:))));   % compute number of NaN within defined area of DEM
NAN_COUNT(3) = sum(sum(isnan(DEM(14:15,:))));   % compute number of NaN within defined area of DEM

%% columns - (lines 11:16)
GRAD_MAX = zeros(5,1);
GRAD_MIN = zeros(5,1);
GRAD_STD = zeros(5,1);
for col = 1:5
    DEM_column = DEM(11:16, col);
    if (sum(isnan(DEM_column)) > 4)           % we need at least to finite values to compute diff
        GRAD_MAX(col) = NaN;                  % if there are less -> then assign NaN
        GRAD_MIN(col) = NaN;
        GRAD_STD(col) = NaN;
    else
        DEM_column = DEM_column(isfinite(DEM_column));  % take column
        gradient = diff(DEM_column);                    % and compute difference
        GRAD_MAX(col) = max(gradient);                  % get max diff
        GRAD_MIN(col) = min(gradient);                  % get min diff
        GRAD_STD(col) = std(gradient);                  % get st. deviation of diff
    end
end
GRAD_MAX = nanmedian(GRAD_MAX);    % compute median of all 5 column values
GRAD_MIN = nanmedian(GRAD_MIN);    % compute median of all 5 column values
GRAD_STD = nanmedian(GRAD_STD);    % compute median of all 5 column values

%% Features vector:
features = [PITCH;    % 1 value
    ROLL;             % 1 value
    LIN_AVGS;         % 8 values
    LIN_AVGS_STD;     % 1 value
    NAN_COUNT;        % 3 values
    GRAD_MAX;         % 1 value
    GRAD_MIN;         % 1 value
    GRAD_STD;         % 1 value
    ];

end
