findCirclesGrid fails (sometimes) (Bug #3277)
Description
I can reproduce a assertion error when trying to find the Marker on the attached imag using OpenCV 2.9.0.0.
Code:
Mat bw = imread("fail.png",cv::IMREAD_GRAYSCALE);
vector<cv::Point2f> pointBuf;
bool grid_visible = cv::findCirclesGrid(bw, cv::Size(4,11), pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID);
Error:
OpenCV Error: Assertion failed (scn m.cols || scn + 1 m.cols) in transform, file /home/magazino/opencv/modules/core/src/matmul.cpp, line 1748
terminate called after throwing an instance of 'cv::Exception'
what(): /home/magazino/opencv/modules/core/src/matmul.cpp:1748: error: (-215) scn m.cols || scn + 1 m.cols in function transform
This error is only triggered if the angle between the plane normal and the viewing direction of the camera is large. If the camera looks perpendicular to the marker normal, the marker
is correctly recognized.
Associated revisions
fix bug #3277 (findCirclesGrid failures):
findHomagraphy can return empty Mat in master branch
Merge pull request #3277 from a-wi:CMake_FFMPEG_config_v3
History
Updated by Daniil Osokin over 11 years ago
Hi, Nicolas! Is this happen with your image only or not (please, attach fail.png)? Could you please clarify how it can be reproducibly?
- Category set to calibration, 3d
- Assignee set to Nikolas Engelhard
- Target version set to 2.4.7
Updated by Nikolas Engelhard over 11 years ago
Oh, sorry, here is one image which triggers the assertion: http://postimg.org/image/9s4xcy2rh/88de9f7c/
The code works however for this (very similar) image: http://postimg.org/image/5n44lia01/aa0739be/
It can be reproduced, by just reading the image and trying to detect the marker:
rgb = imread("fail_pattern.png",cv::IMREAD_GRAYSCALE); vector<cv::Point2f> pointBuf; assert(rgb.type() == CV_8UC1); grid_visible = cv::findCirclesGrid(rgb, cv::Size(4,11), pointBuf, cv::CALIB_CB_ASYMMETRIC_GRID);
Updated by Vladislav Vinogradov over 11 years ago
Hello, Nicolas!
Thanks for your report!
I was able to reproduce the issue and submitted patch with fix.
- Assignee changed from Nikolas Engelhard to Vladislav Vinogradov
- Pull request set to https://github.com/Itseez/opencv/pull/1497
- Target version changed from 2.4.7 to 3.0-alpha
- Status changed from New to Open
Updated by Vladislav Vinogradov over 11 years ago
The pull request was merged.
- Status changed from Open to Done