Skip to content

findEllipses exception #4022

@dmaritex

Description

@dmaritex

System Information

version: 4.11.0
OS: Win11

Detailed description

An exception is raised when performing:
cv::ximgproc::findEllipses
it seems that tries to access a pixel out of range on an intermediate image in find_ellipses.cpp EllipseDetectorImpl::preProcessing

lines 1302
for (int i = 0; i <= imgSize.height; i++) {
int *tmpMag = magBuffer[(i > 0) + 1] + 1;
const short *tmpDx = dx.ptr(i);

In debug mode it seems to crash directly on the first inspected image. In release surprisingly it can run for a while, but still crashes randomly while labelling ellipses

Steps to reproduce

#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/ximgproc.hpp>

    cv::Mat ellipses;
    cv::ximgproc::findEllipses(frameGray, ellipses);

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

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