function ground = rok_ground_truth_get_points (groundTruth, roomConfig, frame)
    % ground = ROK_GROUND_TRUTH_GET_POINTS (groundTruth, roomConfig, frame)
    %
    % Obtains ground truth points for given frame.
    %
    % Input:
    %  - groundTruth = @GroundTruthDatabase instance
    %  - roomConfig = room config structure, obtained by ROK_ROOM_CREATE()
    %  - frame = frame for which ground truth points are to be retrieved
    %
    % Output:
    %  - ground = array of ground truth structures
    %
    % Copyright (C) 2012, Rok Mandeljc <rok.mandeljc@fe.uni-lj.si>
    
    data = groundTruth.get_ground_truth(frame);
    
    % Create ground truth structure
    ground = [];
    for p = size(data, 1):-1:1,
        ground(p).x = data(p, 1);
        ground(p).y = data(p, 2);
        ground(p).id = p;
    end
    
    % Filter out invalid
    invalid = any(isinf(data), 2);
    ground(invalid) = [];
    
    % Filter detections outside the room
    invalidGround = ([ ground.x ] < roomConfig.area(1)) | ([ ground.x ] > roomConfig.area(3)) | ([ ground.y ] < roomConfig.area(2)) | ([ ground.y ] > roomConfig.area(4));
    ground(invalidGround) = [];
    
end