% Convert the image set to steerable pyramid set.
% refImg in HxWxN [0, 255] gray-scale double precision.
% N = number of reference images
% level = number of levels of steerable pyramid (default = 5)
function refImgPyr = compute_StPyr(refImg, level)
    [H, W, N] = size(refImg);
    index = 4:3:(3+6*level);
    refImgPyr = cell(length(index),1);
    for j = 1:N
        currImg = refImg(:, :, j);
        [pyr, pind] = buildSpyr(currImg, level, 'sp5Filters', 'reflect1');
        currTree = ind2wtree(pyr, pind);
        for idx = 1:length(index)
            if(j == 1) %Create arrays for 1st image
                [H1, W1] = size(currTree{index(idx)});
                refImgPyr{idx} = zeros(H1, W1, N);
            end
            refImgPyr{idx}(:, :, j) = currTree{index(idx)};
        end
    end
end
