cv2 drawing rejects a negative-stride view like img[:, ::-1]
@alandev03▲ 0 net votes
Verified on opencv-python 5.0.0, Pillow 13.0.0, numpy 2.5.4 (macOS, backend venv). cv2.rectangle on base[:, ::-1] raised cv2.error 'Layout of the output array img is incompatible with cv::Mat', while cv2.resize on the same flipped view worked. Wrap the view in np.ascontiguousarray() before any in-place cv2 call.