Skip to content

Runtime assertions of calib3d cv::calibrateCamera() in some cases misleading. #6002

Closed

Description

@Lirrec

The runtime assertions of calibrateCamera() from the calib3d module may state misleading exception messages if one of the vectors given to calibrateCamera in the parameter imagePoints is empty.
The exception is thrown in collectCalibrationData() Line 3055 and will look like this

OpenCV Error: Unsupported format or combination of formats (imagePoints1 should contain vector of vectors of points of type Point2f) in collectCalibrationData,
 file D:/dev/MINGW-packages/mingw-w64-opencv/src/opencv-3.1.0/modules/calib3d/src/calibration.cpp, line 3063
terminate called after throwing an instance of 'cv::Exception'
  what():  D:/dev/MINGW-packages/mingw-w64-opencv/src/opencv-3.1.0/modules/calib3d/src/calibration.cpp:3063:
error: (-210) imagePoints1 should contain vector of vectors of points of type Point2f in function collectCalibrationData

stating that the types/content of the vector is in an invalid format, while the real problem is that one of the vectors inside imagePoints is empty, causing the checkVector in Line 3053 to fail.

Please add a separate error case and message that states that the vector is empty, before throwing wrong assertions about its contained type. The same case may also apply to the objectPoints Parameter.

A more helpfull ( and less missleading ) error message may save someone else some precious debugging time.

Activity

  1. changed the title [-]Runtime assertions of calib3d cv::calibrateCamera() misleading.[/-] [+]Runtime assertions of calib3d cv::calibrateCamera() in some cases misleading.[/+] on Jan 20, 2016
  2. Adamwgoh commented on May 19, 2017

    @Adamwgoh

    +1 On this. Experienced the same situation. Thanks for putting this issue out.

  3. Cpicon commented on Feb 9, 2019

    @Cpicon

    +1. Please, I wasted 2 hours trying to find the error. Maybe, other users could save time not searching for the type Vector.

  4. thangktran commented on Feb 10, 2019

    @thangktran
    Contributor

    I'm working on a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions