forked from dmMaze/PyPatchMatchInpaint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
31 lines (25 loc) · 927 Bytes
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include "masked_image.h"
#include "nnf.h"
#include "inpaint.h"
int main() {
auto source = cv::imread("img.png", cv::IMREAD_COLOR);
auto mask = cv::imread("mask.png", cv::IMREAD_GRAYSCALE);
//mask = cv::Scalar::all(0);
//for (int i = 0; i < source.size().height; ++i) {
// for (int j = 0; j < source.size().width; ++j) {
// auto source_ptr = source.ptr<unsigned char>(i, j);
// if (source_ptr[0] == 255 && source_ptr[1] == 255 && source_ptr[2] == 255) {
// mask.at<unsigned char>(i, j) = 1;
// }
// }
//}
auto metric = PatchSSDDistanceMetric(4);
auto result = Inpainting(source, mask, &metric).run(false, true);
// cv::imwrite("./images/forest_recovered.bmp", result);
// cv::imshow("Result", result);
// cv::waitKey();
return 0;
}