Skip to content

Commit bf83d9a

Browse files
committed
fixed crop regressiona and align missing updates
1 parent 4ee0aaf commit bf83d9a

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

relightlab/alignframe.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,18 @@ void AlignFrame::newAlign() {
6262
qRelightApp->project().aligns.push_back(align);
6363
AlignRow *row = addAlign(align);
6464
row->findAlignment();
65+
}
6566

67+
void AlignFrame::projectUpdate() {
68+
qRelightApp->project().computeOffsets();
6669
}
6770

6871
AlignRow *AlignFrame::addAlign(Align *align) {
6972
AlignRow *row = new AlignRow(align);
7073
aligns->addWidget(row);
7174

7275
connect(row, SIGNAL(removeme(AlignRow *)), this, SLOT(removeAlign(AlignRow *)));
73-
connect(row, SIGNAL(updated()), this, SIGNAL(updated()));
76+
connect(row, SIGNAL(updated()), this, SLOT(projectUpdate()));
7477
return row;
7578
}
7679

@@ -89,4 +92,5 @@ void AlignFrame::removeAlign(AlignRow *row) {
8992
delete align;
9093
aligns.erase(it);
9194
delete row;
95+
projectUpdate();
9296
}

relightlab/alignframe.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ Q_OBJECT
1919
AlignRow *addAlign(Align *align);
2020

2121
public slots:
22+
void projectUpdate();
2223
void newAlign();
2324
void removeAlign(AlignRow *align);
24-
signals:
25-
void updated();
2625

2726
private:
2827
MarkerDialog *marker_dialog = nullptr;

relightlab/rtitask.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ void RtiTask::run() {
8787
imageset.initImages(input_folder.toStdString().c_str());
8888

8989
imageset.initFromDome(project.dome); //lights after images
90-
imageset.setCrop(crop,project.offsets);
90+
imageset.setCrop(crop, project.offsets);
91+
92+
qDebug() << project.offsets << endl;
9193

9294
//TODO too many crop locations!
9395
if(!crop.isNull()) {

src/imageset.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,17 @@ void ImageSet::setCrop(QRect &_crop, std::vector<QPointF> &_offsets) {
395395

396396
//find min and max of offsets to adjust the maxCrop;
397397
int l = 0;
398-
int r = 0;
399-
int t = image_width;
398+
int r = image_width;;
399+
int t = 0;
400400
int b = image_height;
401401
for(QPoint &o: int_offsets) {
402-
l = std::max(l, -o.x());
403-
r = std::min(image_width, -o.x());
404-
t = std::max(b, -o.y());
405-
b = std::min(image_height, -o.y());
402+
l = std::max(l, -o.x());
403+
r = std::min(r, image_width-o.x());
404+
t = std::max(t, -o.y());
405+
b = std::min(b, image_height-o.y());
406406
}
407407
//TODO check +1 problem
408-
QRect max_crop(l, t, r -l, t - b);
408+
QRect max_crop(l, t, r - l, b - t);
409409
if(_crop.isNull())
410410
_crop = max_crop;
411411
else

src/project.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ float lineSphereDistance(const Vector3f &origin, const Vector3f &direction, cons
598598
return d;
599599
}
600600
void Project::computeOffsets() {
601+
offsets.clear();
601602
offsets.resize(images.size(), QPointF(0,0));
602603
std::vector<float> weights(offsets.size(), 0);
603604
for(Align *align: aligns) {

0 commit comments

Comments
 (0)