function [indEliminated, numSelectedFeatures]= createMask(filterSelected,xSelected,ySelected, sx, sy, numOrient, numScale, numDoG)

numGabor = numOrient*numScale;
numFilter = numGabor+numDoG;
mask = cell(numFilter,1);
for iFilter = 1:numFilter
    mask{iFilter}=zeros(sx,sy);
end

for i=1:length(filterSelected)
     mask{filterSelected(i)}(xSelected(i),ySelected(i))=1;
end

unfold_mask=[];
for iS = 1:numScale
    
    for iO = 1: numOrient     
        unfold_mask = [unfold_mask, mask{ iO+(iS-1)*numOrient }]; 
    end
    
    for iO = 1: numOrient     
        unfold_mask = [unfold_mask, mask{ iO+(iS-1)*numOrient }]; 
    end
    
end

for iD = 1:numDoG
    unfold_mask = [unfold_mask, mask{ numGabor+ iD }];
end

indEliminated = find(unfold_mask==0);
numSelectedFeatures = sum(unfold_mask(:));
