Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to remove the edge but keep the content

Suppose I have such image

I hope to delete that bold edge.Then I use this technique based on floodFill:

#include "opencv.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
    Mat mark = imread("image.jpg", IMREAD_GRAYSCALE);
    rectangle(mark, Rect(0, 0, mark.cols, mark.rows), Scalar(0));
    Mat rect = mark.clone();
    Mat tempmark = rect.clone();
    floodFill(mark, Point(0, 0), Scalar(255), 0, 10, 20, 8);
    return 0;
}

But I have to say it is not a good solution for a grayscale image.Because it will affect the contenct.As you see

This is before inpaint

This is after inpaint

Not only the edge is disappear,but the content is disappear..Is a better solution can do this?

How to remove the edge but keep the content

Suppose I have such image

I hope to delete that bold edge.Then I use this technique based on floodFill:

#include "opencv.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main()
{
    Mat mark = imread("image.jpg", IMREAD_GRAYSCALE);
    rectangle(mark, Rect(0, 0, mark.cols, mark.rows), Scalar(0));
    Mat rect = mark.clone();
    Mat tempmark = rect.clone();
    floodFill(mark, Point(0, 0), Scalar(255), 0, 10, 20, 8);
    return 0;
}

But I have to say it is not a good solution for a grayscale image.Because it will affect the contenct.As you see

This is before inpaint

This is after inpaint

Not only the edge is disappear,but the content is disappear..Is a better solution can do this?