A bug in exercise session 2

A bug in exercise session 2

by Michal Jan Tyszkiewicz -
Number of replies: 0
In exercise 4 of the exercise session 2 we provide you with the following function:

def decomposeSeperableFilter(F): 
    # DO NOT CHANGE THIS FUNCTION
    h = [1]
    for i in range(1,s):
            h.append(np.sum(F[:,i])/(np.sum(F[:,0])))
    h = np.asmatrix(np.array(h))
    v = np.asmatrix(F[:,0]).transpose()
    return v, h


which doesn't work because the variable "s" is undefined. Please modify said function to the following:


def decomposeSeperableFilter(F): 
    # DO NOT CHANGE THIS FUNCTION
    h = [1]
    for i in range(1,F.shape[1]):
            h.append(np.sum(F[:,i])/(np.sum(F[:,0])))
    h = np.asmatrix(np.array(h))
    v = np.asmatrix(F[:,0]).transpose()
    return v, h