Opencv_contrib: cv::xphoto::inpaint crashed in KDTreeComparator::operator()(int const&, int const&) const

Created on 15 Mar 2018  Â·  5Comments  Â·  Source: opencv/opencv_contrib

System information (version)
  • OpenCV => 3.4.1
  • Operating System / Platform => iOS 11
    inpaint-crash
bug xphoto

All 5 comments

hello, @hezhk3 , could you add a short code example (and maybe a small image) to reproduce the error ?

(and maybe drop the screenshot ? yes, there's a buffer overrun, but apart from that, no useful information there)

Sorry for the late reply. Using these two images as src and mask, the xphoto::inpaint is crashing all the time.

images.zip

my test code: https://pan.baidu.com/s/1Ospqv_atheXd-Svu8bqrTw

I've tried to reproduce the issue but doesn't get the crash at least for the following code

Mat src = imread("src.png", IMREAD_GRAYSCALE);
Mat mask = imread("mask.png", IMREAD_GRAYSCALE);
Mat dst;
xphoto::inpaint(src, mask, dst, xphoto::INPAINT_SHIFTMAP);
return 0;

@hezhk3 Could you please provide a short reproducer?

@terfendail I've tested on Windows. It's weird that I can't reproduce on Windows. Maybe it's only crashing on iOS.

        UIImage *srcImage = [UIImage imageNamed:@"src.png"];
        UIImage *maskImage = [UIImage imageNamed:@"mask.png"];

        cv::Mat src, mask, dst;

        UIImageToMat(srcImage, src, false);
        UIImageToMat(maskImage, mask, false);

        std::cout << src.channels() << std::endl;
        std::cout << mask.channels() << std::endl;

        cv::xphoto::inpaint(src, mask, dst, cv::xphoto::INPAINT_SHIFTMAP);

        UIImage *dstImage = MatToUIImage(dst);

I am getting the same issue on iOS, I found that applying the modifications proposed on https://github.com/opencv/opencv_contrib/issues/965#issuecomment-429534323 the issue its fixed, when I get some time I will create the PR with the fix

Was this page helpful?
0 / 5 - 0 ratings