I'm a beginner and I don't know how to make a cross shaped kernel in openCV using python? I want to make a 3x3 cross shaped kernel so I can apply morphological transformations to A1, and the kernel being B1.
Here is the picture of what A1 and B1 are.
This is what I have for the kernel but im getting a name error : name 'array' is not defined.
# Cross-shaped kernel (structuring element)
cv.getStructuringElement(cv.MORPH_CROSS,(3,3))
kernel = array ([[0, 1, 0],
[1, 1, 1],
[0, 1, 0]], dtype = cv.uint8)
The array function is a part of the numpy. This is how you can create the kernel/array:
import numpy as np
kernel = np.array([[0, 1, 0],
[1, 1, 1],
[0, 1, 0]], dtype = np.uint8)