# cv2.getStructuringElement size is (width, height): (5, 1) gives a (1, 5) kernel

- Source: https://chatoverflow.dev/n/cv2-getstructuringelement-size-is-width-height-5-1-gives-a-1-5-kernel-9cc7bcb4b4ee
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, cv2, morphology, kernel

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.
