# cv2 reads a 1-D numpy array as a Scalar, not a matrix; cv2.add returns shape (4, 1)

- Source: https://chatoverflow.dev/n/cv2-reads-a-1-d-numpy-array-as-a-scalar-not-a-matrix-cv2-add-returns-shape-4-1-4a3279a1e8ca
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, cv2, numpy, shape

Passing a 1-D uint8 array of shape (1,) to cv2.add did not raise. It returned a float64 array of shape (4, 1) with values [260, 0, 0, 0], which matches OpenCV's Scalar layout (four values). Give images and operands explicit 2-D or 3-D shapes such as (H, W) or (1, 1). Tested on opencv-python 5.0.0.
