Skip to content

Commit 3f7d600

Browse files
committed
better queue info for normals.
1 parent e853d57 commit 3f7d600

6 files changed

+32
-11
lines changed

relight/queueitem.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void QueueItem::update() {
7878
case Task::PAUSED:
7979
status->setText("Paused");
8080
case Task::ON_QUEUE:
81+
status->setText("On queue");
8182
case Task::RUNNING:
8283
break;
8384
case Task::DONE:

relightlab/normalsframe.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void NormalsFrame::save() {
9393
}
9494
}
9595
NormalsTask *task = new NormalsTask();
96-
task->parameters = parameters;
96+
task->setParameters(parameters);
9797
task->output = parameters.path;
9898
task->initFromProject(qRelightApp->project());
9999

relightlab/normalstask.cpp

+23-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@ using namespace Eigen;
3333
/// That NormalsWorker fills a vector with the colors of the normals in that line.
3434
///
3535

36+
QString NormalsParameters::summary() {
37+
QString ret = "Normals";
38+
if(flatMethod == FLAT_RADIAL)
39+
ret += " , radial flattning";
40+
if(flatMethod == FLAT_FOURIER)
41+
ret += ", frequencies based flattening";
42+
43+
if(surface_integration == SURFACE_ASSM)
44+
ret += ", adaptive surface reconstruction";
45+
if(surface_integration == SURFACE_BNI)
46+
ret += ", bilateral surface reconstruction";
47+
if(surface_integration == SURFACE_FFT)
48+
ret += ", Fourier transform surface reconstruction";
49+
ret += ".";
50+
return ret;
51+
}
52+
3653
void NormalsTask::initFromProject(Project &project) {
3754
lens = project.lens;
3855
imageset.width = imageset.image_width = project.lens.width;
@@ -48,10 +65,14 @@ void NormalsTask::initFromProject(Project &project) {
4865
}
4966
pixelSize = project.pixelSize;
5067
}
68+
void NormalsTask::setParameters(NormalsParameters &param) {
69+
parameters = param;
70+
label = parameters.summary();
71+
}
5172

5273
void NormalsTask::run() {
5374
status = RUNNING;
54-
75+
label = parameters.summary();
5576

5677
function<bool(QString s, int d)> callback = [this](QString s, int n)->bool { return this->progressed(s, n); };
5778

@@ -307,7 +328,7 @@ void NormalsTask::assm(QString filename, vector<float> &_normals, float approx_e
307328

308329
for(auto vertex: mesh.vertices()) {
309330
auto &p = mesh.position(vertex);
310-
p[1] *= imageset.height -p[1] -1;
331+
p[1] = imageset.height -p[1] -1;
311332
p[2] *= -1;
312333
}
313334
savePly(filename.toStdString().c_str(), mesh);

relightlab/normalstask.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,10 @@ class NormalsParameters {
3030
float bni_k = 2.0;
3131
float assm_error = 0.1;
3232

33-
//bool exportJpeg = true;
3433
int quality = 95;
35-
//bool exportPng = false;
36-
//bool exportTiff = false;
37-
//bool exportPly = false;
38-
//bool exportObj = false;
39-
4034
QString path;
4135

36+
QString summary();
4237
};
4338

4439

@@ -53,6 +48,7 @@ class NormalsTask : public Task {
5348

5449
virtual void run() override;
5550

51+
void setParameters(NormalsParameters &param);
5652
void initFromProject(Project &project);
5753
void assm(QString filename, std::vector<float> &normals, float precision);
5854

relightlab/queueitem.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ void QueueItem::update() {
8686
case Task::PAUSED:
8787
status->setText("Paused");
8888
case Task::ON_QUEUE:
89+
status->setText("On queue");
90+
break;
8991
case Task::RUNNING:
92+
status->setText("Starting...");
93+
9094
break;
9195
case Task::DONE:
9296
status->setText("Done");

src/fft_normal_integration.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ void fft_integrate(std::function<bool(QString s, int n)> progressed,
114114
for (int j = 0; j < cols; ++j) {
115115
float *normal = &normals[3*(i * cols + j)];
116116
dzdx(i, j) = normal[0] / normal[2]; // dz/dx = -nx/nz
117-
dzdy(i, j) = -normal[1] / normal[2]; // dz/dy = -ny/nz
118-
assert(!isnan(dzdx(i, j)));
117+
dzdy(i, j) = -normal[1] / normal[2]; // dz/dy = -ny/nz assert(!isnan(dzdx(i, j)));
119118
assert(!isnan(dzdy(i, j)));
120119
}
121120
}

0 commit comments

Comments
 (0)