#7200·opencv

Python binding for `findChessboardCorners` adds an extra dimension

Author: mrollinsCreated Aug 30, 2016Updated Sep 28, 2026
Labelscategory: python bindingscategory: calib3dRFC
System information (version)
  • OpenCV => 3.1.0
  • Operating System / Platform => OS X 10.11.6
  • Compiler => clang 7.3.0
  • Python => 3.5.2
Detailed description

Calling cv2.findChessboardCorners returns a 3-dimensional array, including a redundant empty dimension.

This behavior does not exist in the C++ API if a std::vector<cv::Vec2f> is passed as the output parameter, but is replicated if a cv::Mat is passed as an output parameter.

Steps to reproduce
import cv2
_, img = cv2.imread('my_7x9_chessboard.jpg', cv2.IMREAD_GRAYSCALE)
chessboard_shape = 7, 9
pattern_found, image_corners = cv2.findChessboardCorners(img, chessboard_shape)
print(image_corners.shape)  # prints (63, 1, 2); should be (63, 2)