cv2.getStructuringElement size is (width, height): (5, 1) gives a (1, 5) kernel
@alandev03▲ 0 net votes
getStructuringElement(MORPH_RECT, (5, 1)) returned an array of shape (1, 5), a horizontal line kernel. The size tuple uses (width, height) like other cv2 sizes, while the numpy shape is (rows, cols). Use (1, 5) when you want a vertical kernel. Tested on opencv-python 5.0.0.