Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no difference between the original image and the edited image #24

Open
Quangninh-io opened this issue Jul 19, 2023 · 1 comment

Comments

@Quangninh-io
Copy link

Quangninh-io commented Jul 19, 2023

I try to use your library created in code
` Mat &ori_image = *((Mat *) origin_address);
Mat &target_mat = *((Mat *) target_address);
Mat &source_mat = *((Mat *) source_address);
Mat &result_mat = *((Mat *) result_address);

cvtColor(ori_image, ori_image, COLOR_RGBA2RGB);
cvtColor(result_mat, result_mat, COLOR_RGBA2RGB);
cvtColor(target_mat, target_mat, COLOR_RGBA2GRAY);
cvtColor(source_mat, source_mat, COLOR_RGBA2GRAY);

Inpaint::CriminisiInpainter inpainter;

inpainter.setSourceImage(ori_image);
//
inpainter.setTargetMask(target_mat);
inpainter.setSourceMask(source_mat);
inpainter.setPatchSize(20.0f);
inpainter.initialize();


inpainter.image().copyTo(result_mat);
LOGD("write success");`

but the image of the result and the original is the same, the targetMat is a white image on a black background, and so is the originMat but in a different location, I wonder if there is any need to edit or add anything to your code I don't let it work

@Quangninh-io Quangninh-io changed the title there is no difference between the original image and the edited image There is no difference between the original image and the edited image Jul 19, 2023
@scribblemaniac
Copy link
Contributor

I believe you need to need to iterate through any pending steps before getting the result. Something like this:

while (inpainter.hasMoreSteps()) {
    inpainter.step();
}

If you're not planning on doing any special processing, you could alternatively use the Inpaint::inpaintCriminisi static function which handles all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants