exercise 1
how to calculate kernel
get the shape of an array: array.shape
get the first row or column of an array: array[0,:]; array[:,0]
np.outer(a,b)
The np.outer function in NumPy is used to compute the outer product of two arrays. It calculates the element-wise product of all pairs of elements from two input arrays and returns a new array with the shape that is the concatenation of the shapes of the two input arrays. The resulting array is typically of higher dimension than the original arrays.
a as the row and b as the column to multipy each other and then get a matrix
the output of an img is its pixel. therefore, i dont need to exchange by myself
Why kernal must be defined in this way:
[0.0838, 0.06193, 0.0838],
[0.0113, 0.0838, 0.0113]])
kernel_2 = np.array([[-0.8984, 0.1472, 1.1410],
[-1.9075, 0.1566, 2.1359],
[-0.8659, 0.0573, 1.0337]])```