Skip to content

Commit 31f48ac

Browse files
committed
nothing to say
1 parent d367074 commit 31f48ac

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

config.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
bool Config::timeEvaluate = true;
44
bool Config::recordCommand = false;
5+
bool Config::dumpImage = false;

config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using jsoncons::json;
99

1010
class Config {
1111
public:
12-
static bool timeEvaluate, recordCommand;
12+
static bool timeEvaluate, recordCommand, dumpImage;
1313
static void load(jsoncons::json json) {
1414
if (json.has_member("timeEvaluate")) {
1515
timeEvaluate = json["timeEvaluate"].as<bool>();

multilevel.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "multilevel.h"
22
#include "graphCut/graph.cpp"
33
#include "graphCut/maxflow.cpp"
4+
#include "config.h"
45
#include <iostream>
56
#include <QDebug>
67
#include <QtNetwork/QtNetwork>
@@ -20,6 +21,7 @@ MyImage MyImage::background;
2021

2122

2223
void MyImage::dump_image(string fname, int id, int channel) {
24+
if (!Config::dumpImage) return;
2325
fname = fname + (char)('0' + id) + "_c_" + (char)('0' + channel);
2426
cerr << "dump image " << fname << endl;
2527
auto v = buffer;
@@ -39,6 +41,11 @@ void MyImage::dump_image(string fname, int id, int channel) {
3941
s.save((fname+".png").c_str());
4042
}
4143

44+
void MyImage::set_dump_img(MyImage &img) {
45+
if (!Config::dumpImage) return;
46+
background = img;
47+
}
48+
4249
Vec3d color2vec(unsigned int a) {
4350
int a1 = (a & 0xff0000) >> 16;
4451
int a2 = (a & 0x00ff00) >> 8;

multilevel.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class MyImage {
4343
}
4444

4545
static MyImage background;
46-
static void set_dump_img(MyImage img) {background = img;}
47-
46+
static void set_dump_img(MyImage &img);
4847
void dump_image(string fname, int id, int channel);
4948
};
5049

0 commit comments

Comments
 (0)