Skip to content

xphoto inpaint crush #965

@saedrna

Description

@saedrna
System information (version)
  • OpenCV => 3.2
  • Operating System / Platform => Mac OS(installed with homebrew) and Windows(installed with cmake)
  • Compiler => clang(mac os) and msvc 2015 (windows)
Detailed description

Sometimes the xphoto::inpaint function will crash with exception Exception: EXC_BAD_ACCESS (code=1, address=0x11ef10ffc) . But not for all the images.

Steps to reproduce

I have upload a project with images below. And here is the code.

#include <iostream>
#include <string>
#include <vector>

#include <opencv2/core.hpp>
#include <opencv2/xphoto.hpp>
#include <opencv2/highgui.hpp>

using namespace std;
using namespace cv;

void inpaint_rgb() {
    string path_mask = "mask1.png";
    string path_gt = "1.png";
    string path_img = path_gt;
    string path_inpaint = "result-1.png";

    Mat gt = cv::imread(path_gt, cv::IMREAD_GRAYSCALE);
    Mat mask = cv::imread(path_mask, cv::IMREAD_GRAYSCALE);
    Mat img = cv::imread(path_img, cv::IMREAD_COLOR);

    img.setTo(cv::Scalar(0,0,0), mask == 255);
    Mat inpainted;
    mask = 255 - mask;
    cv::xphoto::inpaint(img, mask, inpainted, 0);
    cv::imwrite(path_inpaint, inpainted);
}

int main() {
    inpaint_rgb();
    return 0;
}

inpaint.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions