Skip to content

Commit

Permalink
Fixes graphicatorx
Browse files Browse the repository at this point in the history
  • Loading branch information
eyesmd committed Nov 23, 2018
1 parent b53d740 commit 923909d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 6 additions & 7 deletions apps/inpainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void paint_debug(Mat img) {
debug_data data = ((debug_data *) debug)[LINEAR(i, j)];
// Nt
if (data.normal_t.x * data.normal_t.x + data.normal_t.y * data.normal_t.y > 1e-3) {
if (data.normal_t.x != FLT_MAX) {
line(
img, // mat to draw into
Point(j, i), // origin position
Expand All @@ -319,7 +319,7 @@ void paint_debug(Mat img) {
debug_data data = ((debug_data *) debug)[LINEAR(i, j)];
// Gt
if (data.gradient_t.x * data.gradient_t.x + data.gradient_t.y * data.gradient_t.y > 1e-3) {
if (data.gradient_t.x != FLT_MAX) {
line(
img, // mat to draw into
Point(j, i), // origin position
Expand All @@ -334,18 +334,17 @@ void paint_debug(Mat img) {
forn(i, height) forn(j, width) {
debug_data data = ((debug_data *) debug)[LINEAR(i, j)];

if (abs(data.confidence - 1) > 1e-3) {
img.at<Vec3b>(Point(j, i)) = Vec3b(0, (int)data.confidence, (int)data.confidence);
if (data.confidence != FLT_MAX) {
img.at<Vec3b>(Point(j, i)) = Vec3b(0, (int)(data.confidence * 255), (int)(data.confidence * 255));
}
}

/*
forn(i, height) forn(j, width) {
debug_data data = ((debug_data *) debug)[LINEAR(i, j)];
int scaled_data = ((int) (data.data * 255));
if (data.data != 0) {
if (data.data != FLT_MAX) {
int scaled_data = ((int) (data.data * 255));
img.at<Vec3b>(Point(j, i)) = Vec3b(scaled_data, scaled_data, 0);
}
}
Expand Down
5 changes: 5 additions & 0 deletions c/inpainting.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ bool inpaint_step(int width, int height, char * img, bool * mask, int * debug) {
for (int j = 0; j < width; j++) {

if (!contour_mask[LINEAR(i,j)]) {
debug_data * casted_debug = (debug_data *) debug;
casted_debug[LINEAR(i,j)].confidence = FLT_MAX;
casted_debug[LINEAR(i,j)].data = FLT_MAX;
casted_debug[LINEAR(i,j)].gradient_t = (point) {FLT_MAX, FLT_MAX};
casted_debug[LINEAR(i,j)].normal_t = (point) {FLT_MAX, FLT_MAX};
continue;
}

Expand Down

0 comments on commit 923909d

Please sign in to comment.