From 0377e420a533842a8b979c389eab04c196109aaf Mon Sep 17 00:00:00 2001 From: ponchio Date: Mon, 25 Mar 2024 18:58:52 +0100 Subject: [PATCH] refactoring to add align. --- relightlab/alignframe.cpp | 88 +++++++++++++++++++---- relightlab/alignframe.h | 18 +++-- relightlab/alignpicking.cpp | 51 +++++++++++++ relightlab/alignpicking.h | 30 ++++++++ relightlab/alignrow.cpp | 140 ++++++++++++++++++++++++++++++++++++ relightlab/alignrow.h | 52 ++++++++++++++ relightlab/imageview.h | 2 +- relightlab/markerdialog.cpp | 50 +++++++++++++ relightlab/markerdialog.h | 28 ++++++++ relightlab/relightlab.pro | 10 ++- relightlab/spherepanel.cpp | 1 - relightlab/spherepanel.h | 2 - relightlab/sphererow.cpp | 9 ++- relightlab/verifydialog.cpp | 11 ++- relightlab/verifydialog.h | 7 +- relightlab/verifyview.cpp | 18 +++-- relightlab/verifyview.h | 5 +- 17 files changed, 476 insertions(+), 46 deletions(-) create mode 100644 relightlab/alignpicking.cpp create mode 100644 relightlab/alignpicking.h create mode 100644 relightlab/alignrow.cpp create mode 100644 relightlab/alignrow.h create mode 100644 relightlab/markerdialog.cpp create mode 100644 relightlab/markerdialog.h diff --git a/relightlab/alignframe.cpp b/relightlab/alignframe.cpp index e735af7a..6f95e868 100644 --- a/relightlab/alignframe.cpp +++ b/relightlab/alignframe.cpp @@ -1,33 +1,91 @@ #include "alignframe.h" #include "imageview.h" #include "flowlayout.h" +#include "relightapp.h" +#include "markerdialog.h" +#include "alignrow.h" +#include "../src/align.h" #include #include #include +#include AlignFrame::AlignFrame(QWidget *parent): QFrame(parent) { - //TODO: make a function for this to use in all frames. (inheritance?) - setFrameStyle(QFrame::NoFrame); + QVBoxLayout *content = new QVBoxLayout(this); - QVBoxLayout *content = new QVBoxLayout(this); + content->addSpacing(10); + QPushButton *new_align = new QPushButton("New align..."); + new_align->setProperty("class", "large"); + content->addWidget(new_align); + new_align->setMinimumWidth(200); + new_align->setMaximumWidth(300); - content->addWidget(image_viewer = new ImageViewer()); + QFrame *aligns_frame = new QFrame; + content->addWidget(aligns_frame); + aligns = new QVBoxLayout(aligns_frame); - //content->addWidget(new FlowLayout()); + //content->addStretch(); + connect(new_align, SIGNAL(clicked()), this, SLOT(newAlign())); +} + +void AlignFrame::clear() { + while(aligns->count() > 0) { + QLayoutItem *item = aligns->takeAt(0); + AlignRow *row = dynamic_cast(item->widget()); + //row->stopDetecting(); + delete row; + } +} - connect(image_viewer->view, SIGNAL(clicked(QPoint)), this, SLOT(click(QPoint))); +void AlignFrame::init() { + for(Align *align: qRelightApp->project().aligns) { + AlignRow * row = addAlign(align); +// row->detectHighlights(false); + } } -void AlignFrame::click(QPoint p) { - QPointF pos = image_viewer->view->mapToScene(p); +/* on user button press */ +void AlignFrame::newAlign() { + if(!marker_dialog) + marker_dialog = new MarkerDialog(MarkerDialog::ALIGN, this); - //min distance between border points in pixels. - double minBorderDist = 20; - if( sqrt(pow(p.x() - pos.x(), 2) + pow(p.y() - pos.y(), 2)) < minBorderDist) { - return; + //TODO ACTUALLY images might be skipped! + Align *align = new Align(qRelightApp->project().images.size()); + marker_dialog->setAlign(align); + int answer = marker_dialog->exec(); + if(answer == QDialog::Rejected) { + delete align; + return; } - float side = 32; - QGraphicsRectItem *rect = new QGraphicsRectItem(pos.x() - side, pos.y() - side, side*2, side*2); - image_viewer->scene().addItem(rect); + qRelightApp->project().aligns.push_back(align); + AlignRow *row = addAlign(align); + //row->detectHighlights(); +} + +AlignRow *AlignFrame::addAlign(Align *align) { + AlignRow *row = new AlignRow(align); + aligns->addWidget(row); + + + connect(row, SIGNAL(removeme(AlignRow *)), this, SLOT(removeAlign(AlignRow *))); + connect(row, SIGNAL(updated()), this, SIGNAL(updated())); + return row; +} + +void AlignFrame::removeAlign(AlignRow *row) { + layout()->removeWidget(row); + +// row->stopDetecting(); + + Align *align = row->align; + auto &aligns = qRelightApp->project().aligns; + + auto it = std::find(aligns.begin(), aligns.end(), align); + + assert(it != aligns.end()); + + delete align; + aligns.erase(it); + delete row; } diff --git a/relightlab/alignframe.h b/relightlab/alignframe.h index 6ec57085..d3c53a15 100644 --- a/relightlab/alignframe.h +++ b/relightlab/alignframe.h @@ -5,17 +5,27 @@ class ImageViewer; class QGraphicsRectItem; +class Align; +class AlignRow; +class MarkerDialog; +class QVBoxLayout; + class AlignFrame: public QFrame { Q_OBJECT public: - AlignFrame(QWidget *parent = 0); + AlignFrame(QWidget *parent = nullptr); + void clear(); + void init(); + AlignRow *addAlign(Align *align); public slots: - void click(QPoint p); + void newAlign(); + void removeAlign(AlignRow *align); + private: - ImageViewer *image_viewer; - std::vector samples; + MarkerDialog *marker_dialog = nullptr; + QVBoxLayout *aligns = nullptr; }; #endif // ALIGNFRAME_H diff --git a/relightlab/alignpicking.cpp b/relightlab/alignpicking.cpp new file mode 100644 index 00000000..f0a8c2ed --- /dev/null +++ b/relightlab/alignpicking.cpp @@ -0,0 +1,51 @@ +#include "alignpicking.h" +#include "canvas.h" +#include "../src/align.h" +#include "relightapp.h" + +#include +#include +#include + +AlignPicking::AlignPicking(QWidget *parent): ImageViewer(parent) { + + marker_side = 40; + + connect(view, SIGNAL(clicked(QPoint)), this, SLOT(click(QPoint))); +} + + +void AlignPicking::clear() { + scene().clear(); + rect = nullptr; +} + +void AlignPicking::setAlign(Align *a) { + clear(); + align = a; + + rect = scene().addRect(a->rect, QPen(Qt::yellow), Qt::red); + + showImage(0); + fit(); +} + + + +void AlignPicking::click(QPoint p) { + clear(); + + QSize imgsize = qRelightApp->project().imgsize; + QPointF pos = view->mapToScene(p); + +//ensure that the marker is inside the image + pos.setX(std::max(marker_side/2.0, pos.x())); + pos.setY(std::max(marker_side/2.0, pos.y())); + + + pos.setX(std::min(imgsize.width()-marker_side/2.0, pos.x())); + pos.setY(std::min(imgsize.height()-marker_side/2.0, pos.y())); + + align->rect = QRect(pos.x()-marker_side/2.0, pos.y()-marker_side/2.0, marker_side, marker_side); + rect = scene().addRect(align->rect, QPen(Qt::yellow), Qt::red); +} diff --git a/relightlab/alignpicking.h b/relightlab/alignpicking.h new file mode 100644 index 00000000..caa6aa59 --- /dev/null +++ b/relightlab/alignpicking.h @@ -0,0 +1,30 @@ +#ifndef ALIGN_PICKING_H +#define ALIGN_PICKING_H + +#include "imageview.h" + +class QGraphicsRectItem; +class Canvas; +class Align; + + +class AlignPicking: public ImageViewer { + Q_OBJECT +public: + int marker_side = 40; + Align *align = nullptr; + + QGraphicsRectItem *rect = nullptr; + + + AlignPicking(QWidget *parent = nullptr); + void setAlign(Align *sphere); + void updateAlign(); + void clear(); + +public slots: + void click(QPoint); + +}; + +#endif diff --git a/relightlab/alignrow.cpp b/relightlab/alignrow.cpp new file mode 100644 index 00000000..ce2da63b --- /dev/null +++ b/relightlab/alignrow.cpp @@ -0,0 +1,140 @@ +#include "alignrow.h" +#include "markerdialog.h" +#include "relightapp.h" +#include "verifydialog.h" +#include "reflectionview.h" +#include "../src/project.h" +#include "../src/sphere.h" +#include "../relight/processqueue.h" + +#include +#include +#include +#include +#include + +FindAlignment::FindAlignment(Align *_align, bool update) { + align = _align; + update_positions = update; +} + +void FindAlignment::run() { + mutex.lock(); + status = RUNNING; + mutex.unlock(); +/* + Project &project = qRelightApp->project(); + for(size_t i = 0; i < project.images.size(); i++) { + + Image &image = project.images[i]; + if(image.skip) continue; + + QImage img(image.filename); + sphere->findHighlight(img, i, update_positions); + + int progress = std::min(99, (int)(100*(i+1) / project.images.size())); + progressed(QString("Detecting highlights"), progress); + } */ + progressed(QString("Done"), 100); + mutex.lock(); + status = DONE; + mutex.unlock(); +} + + +AlignRow::AlignRow(Align *_align, QWidget *parent): QWidget(parent) { + align = _align; + QHBoxLayout *columns = new QHBoxLayout(this); + columns->setSpacing(20); + + columns->addWidget(thumb = new QLabel()); +/* position = new PositionView(sphere, rowHeight); + position->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + columns->addWidget(position); + + + reflections = new ReflectionView(sphere, rowHeight); + reflections->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + columns->addWidget(reflections); */ + + QVBoxLayout *status_layout = new QVBoxLayout; + columns->addLayout(status_layout, 2); + status_layout->addStretch(); + status = new QLabel("Locating highlights..."); + status_layout->addWidget(status); + progress = new QProgressBar; + progress->setValue(0); + status_layout->addWidget(progress); + status_layout->addStretch(); + + QPushButton *edit = new QPushButton(QIcon::fromTheme("edit"), "Edit..."); + columns->addWidget(edit, 1); + QPushButton *verify = new QPushButton(QIcon::fromTheme("check"), "Verify..."); + columns->addWidget(verify, 1); + QPushButton *remove = new QPushButton(QIcon::fromTheme("trash-2"), "Delete"); + columns->addWidget(remove, 1); + + connect(edit, SIGNAL(clicked()), this, SLOT(edit())); + connect(remove, SIGNAL(clicked()), this, SLOT(remove())); + connect(verify, SIGNAL(clicked()), this, SLOT(verify())); + +} +void AlignRow::edit() { + MarkerDialog *marker_dialog = new MarkerDialog(MarkerDialog::ALIGN, this); + marker_dialog->setAlign(align); + int answer = marker_dialog->exec(); + if(answer == QDialog::Accepted) { + //position->update(); + //reflections->init(); + //detectHighlights(); + } +} + +void AlignRow::verify() { + std::vector centers; + std::vector thumbs; + assert(0); //todo needs to initialize those vaules and update align. + VerifyDialog *verify_dialog = new VerifyDialog(thumbs, centers, this); + verify_dialog->exec(); +} + +void AlignRow::remove() { + emit removeme(this); +} + +void AlignRow::updateStatus(QString msg, int percent) { + status->setText(msg); + progress->setValue(percent); + reflections->update(); + if(percent == 100) { + emit updated(); + } +} + +void AlignRow::findAlignment(bool update) { +/* if(sphere->center.isNull()) { + status->setText("Needs at least 3 points."); + return; + } + if(!detect_highlights) { + detect_highlights = new DetectHighlights(sphere, update); + connect(detect_highlights, &DetectHighlights::progress, this, &SphereRow::updateStatus); //, Qt::QueuedConnection); + } + detect_highlights->stop(); + + ProcessQueue &queue = ProcessQueue::instance(); + queue.removeTask(detect_highlights); + queue.addTask(detect_highlights); + queue.start(); */ +} + +void AlignRow::stopFinding() { + /* + if(detect_highlights) { + if(detect_highlights->isRunning()) { + detect_highlights->stop(); + detect_highlights->wait(); + } + detect_highlights->deleteLater(); + } */ +} diff --git a/relightlab/alignrow.h b/relightlab/alignrow.h new file mode 100644 index 00000000..d8e54c1a --- /dev/null +++ b/relightlab/alignrow.h @@ -0,0 +1,52 @@ +#ifndef ALIGNROW_H +#define ALIGNROW_H + +#include "../relight/task.h" +#include + + + + +class Align; +class QLabel; +class QProgressBar; +class ReflectionView; +class QGraphicsPixmapItem; + +class FindAlignment: public Task { +public: + Align *align; + bool update_positions; + + FindAlignment(Align *align, bool update = true); + virtual void run() override; + +}; + +class AlignRow: public QWidget { + Q_OBJECT +public: + Align *align; + int rowHeight = 92; + QLabel *thumb; + ReflectionView *reflections; + QLabel *status = nullptr; + QProgressBar *progress = nullptr; + FindAlignment *find_alignment = nullptr; + + AlignRow(Align *align, QWidget *parent = nullptr); + void findAlignment(bool update = true); + void stopFinding(); + +signals: + void removeme(AlignRow *row); + void updated(); //emit when status changes + +public slots: + void edit(); + void remove(); + void verify(); + void updateStatus(QString msg, int percent); +}; + +#endif // SPHEREROW_H diff --git a/relightlab/imageview.h b/relightlab/imageview.h index 38e2760d..93342c54 100644 --- a/relightlab/imageview.h +++ b/relightlab/imageview.h @@ -39,7 +39,7 @@ class ImageViewer: public QFrame { ImageViewer(QWidget *parent = nullptr); QGraphicsScene &scene() { return view->scene; } - void showImage(int id); + virtual void showImage(int id); int currentImage() { return view->current_image; } public slots: diff --git a/relightlab/markerdialog.cpp b/relightlab/markerdialog.cpp new file mode 100644 index 00000000..8d28471d --- /dev/null +++ b/relightlab/markerdialog.cpp @@ -0,0 +1,50 @@ +#include "markerdialog.h" +#include "spherepicking.h" +#include "alignpicking.h" +#include "imageview.h" + +#include +#include + +MarkerDialog::MarkerDialog(Marker marker, QWidget *parent): QDialog(parent) { + + QVBoxLayout *content = new QVBoxLayout(this); + + setModal(true); + switch(marker) { + case SPHERE: + sphere_picking = new SpherePicking(); + content->addWidget(sphere_picking); + + break; + case ALIGN: + align_picking = new AlignPicking(); + content->addWidget(align_picking); + break; + } + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + content->addWidget(buttonBox); + showMaximized(); +} + +void MarkerDialog::setAlign(Align *align) { + align_picking->setAlign(align); +} + +void MarkerDialog::setSphere(Sphere *sphere) { + sphere_picking->setSphere(sphere); +} + + +void MarkerDialog::accept() { + QDialog::accept(); +} + +void MarkerDialog::reject() { + QDialog::reject(); +} diff --git a/relightlab/markerdialog.h b/relightlab/markerdialog.h new file mode 100644 index 00000000..cec6f4ce --- /dev/null +++ b/relightlab/markerdialog.h @@ -0,0 +1,28 @@ +#ifndef MARKERDIALOG_H +#define MARKERDIALOG_H + +#include + +class SpherePicking; +class AlignPicking; +class Align; +class Sphere; + +class MarkerDialog: public QDialog { + Q_OBJECT +public: + enum Marker { SPHERE, ALIGN }; + MarkerDialog(Marker marker, QWidget *parent = nullptr); + void setAlign(Align *align); + void setSphere(Sphere *sphere); + +public slots: + void accept(); + void reject(); + +private: + SpherePicking *sphere_picking = nullptr; + AlignPicking *align_picking = nullptr; +}; + +#endif // SPHEREDIALOG_H diff --git a/relightlab/relightlab.pro b/relightlab/relightlab.pro index 2b5de3ce..d2402a66 100644 --- a/relightlab/relightlab.pro +++ b/relightlab/relightlab.pro @@ -48,17 +48,21 @@ SOURCES += main.cpp \ ../src/sphere.cpp \ ../src/white.cpp \ alignframe.cpp \ + alignpicking.cpp \ + alignrow.cpp \ canvas.cpp \ domepanel.cpp \ imageview.cpp \ lightgeometry.cpp \ mainwindow.cpp \ + markerdialog.cpp \ preferences.cpp \ recentprojects.cpp \ reflectionview.cpp \ relightapp.cpp \ rticard.cpp \ rtiframe.cpp \ + spherepicking.cpp \ sphererow.cpp \ tabwidget.cpp \ imageframe.cpp \ @@ -70,7 +74,6 @@ SOURCES += main.cpp \ ../src/lp.cpp \ directionsview.cpp \ spherepanel.cpp \ - spherepicking.cpp \ spheredialog.cpp \ ../relight/task.cpp \ verifyview.cpp \ @@ -97,17 +100,21 @@ HEADERS += \ ../src/sphere.h \ ../src/white.h \ alignframe.h \ + alignpicking.h \ + alignrow.h \ canvas.h \ imageview.h \ lightgeometry.h \ mainwindow.h \ mainwindow.h \ + markerdialog.h \ preferences.h \ recentprojects.h \ reflectionview.h \ relightapp.h \ rticard.h \ rtiframe.h \ + spherepicking.h \ sphererow.h \ tabwidget.h \ imageframe.h \ @@ -120,7 +127,6 @@ HEADERS += \ domepanel.h \ directionsview.h \ spherepanel.h \ - spherepicking.h \ spheredialog.h \ ../relight/task.h \ verifyview.h \ diff --git a/relightlab/spherepanel.cpp b/relightlab/spherepanel.cpp index 13bfd39d..16d9ada2 100644 --- a/relightlab/spherepanel.cpp +++ b/relightlab/spherepanel.cpp @@ -4,7 +4,6 @@ #include "spherepicking.h" #include "relightapp.h" #include "../src/sphere.h" -#include "lightgeometry.h" #include #include diff --git a/relightlab/spherepanel.h b/relightlab/spherepanel.h index 4fb6c548..edfb5163 100644 --- a/relightlab/spherepanel.h +++ b/relightlab/spherepanel.h @@ -11,7 +11,6 @@ class QVBoxLayout; class SphereRow; class Dome; -class LightGeometry; class SpherePanel: public QFrame { Q_OBJECT @@ -31,7 +30,6 @@ public slots: private: SphereDialog *sphere_dialog = nullptr; QVBoxLayout *spheres = nullptr; - LightGeometry *geometry = nullptr; }; diff --git a/relightlab/sphererow.cpp b/relightlab/sphererow.cpp index d8e2bfb5..8eaf5e54 100644 --- a/relightlab/sphererow.cpp +++ b/relightlab/sphererow.cpp @@ -90,8 +90,15 @@ void SphereRow::edit() { } void SphereRow::verify() { - VerifyDialog *verify_dialog = new VerifyDialog(sphere, this); + std::vector &positions = sphere->lights; + for(QPointF &pos: positions) + pos -= sphere->inner.topLeft(); + + VerifyDialog *verify_dialog = new VerifyDialog(sphere->thumbs, positions, this); verify_dialog->exec(); + + for(QPointF &pos: positions) + pos += sphere->inner.topLeft(); } void SphereRow::remove() { diff --git a/relightlab/verifydialog.cpp b/relightlab/verifydialog.cpp index a392821f..d79959cd 100644 --- a/relightlab/verifydialog.cpp +++ b/relightlab/verifydialog.cpp @@ -12,11 +12,11 @@ #include "assert.h" -VerifyDialog::VerifyDialog(Sphere *_sphere, QWidget *parent): QDialog(parent) { +VerifyDialog::VerifyDialog(std::vector &_thumbs, std::vector &_positions, QWidget *parent): + QDialog(parent), thumbs(_thumbs), positions(_positions) { setModal(true); showMaximized(); - sphere = _sphere; QVBoxLayout *layout = new QVBoxLayout(this); QScrollArea *area = new QScrollArea(this); layout->addWidget(area); @@ -25,12 +25,11 @@ VerifyDialog::VerifyDialog(Sphere *_sphere, QWidget *parent): QDialog(parent) { area->setWidget(new QWidget); flowlayout = new FlowLayout(); area->widget()->setLayout(flowlayout); - area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - std::vector &thumbs = sphere->thumbs; + area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - for(size_t i = 0; i < thumbs.size(); i++) { - VerifyView *thumb = new VerifyView(i, sphere, 192); + for(int i = 0; i < thumbs.size(); i++) { + VerifyView *thumb = new VerifyView(thumbs[i], positions[i], 192); flowlayout->addWidget(thumb); } diff --git a/relightlab/verifydialog.h b/relightlab/verifydialog.h index 3b1ed24b..695e84f6 100644 --- a/relightlab/verifydialog.h +++ b/relightlab/verifydialog.h @@ -9,10 +9,13 @@ class Sphere; class VerifyDialog: public QDialog { public: - VerifyDialog(Sphere *sphere, QWidget *parent = nullptr); + VerifyDialog(std::vector &thumbs, std::vector &positions, QWidget *parent = nullptr); + private: - Sphere *sphere; FlowLayout *flowlayout = nullptr; + std::vector &thumbs; + std::vector &positions; + }; #endif // SPHEREVERIFY_H diff --git a/relightlab/verifyview.cpp b/relightlab/verifyview.cpp index 606f2e5f..94bde858 100644 --- a/relightlab/verifyview.cpp +++ b/relightlab/verifyview.cpp @@ -45,28 +45,26 @@ QVariant ReflectionPoint::itemChange(GraphicsItemChange change, const QVariant & return QGraphicsItem::itemChange(change, value); } -VerifyView:: VerifyView(int _id, Sphere *_sphere, int _height, QWidget *parent): QGraphicsView(parent) { - id = _id; - sphere = _sphere; +VerifyView:: VerifyView(QImage &_image, QPointF &_pos, int _height, QWidget *parent): + QGraphicsView(parent), image(_image), pos(_pos) { height = _height; setScene(&scene); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - QPixmap pix = QPixmap::fromImage(sphere->thumbs[id]);//.scaledToHeight(height); + QPixmap pix = QPixmap::fromImage(image);//.scaledToHeight(height); img_item = scene.addPixmap(pix); double scale = height/(double)pix.height(); setFixedSize(pix.width()*scale, height); - QPointF pos = sphere->lights[id]; + int r = 8*scale; reflection = new ReflectionPoint(this, QRectF(QPointF(-r, -r), QSize(2*r, 2*r))); if(pos.isNull()) { - reflection->setPos(sphere->inner.center() - sphere->inner.topLeft()); + reflection->setPos(image.width()/2, image.height()/2); reflection->setPen(QPen(Qt::red, 2)); } else { - pos -= sphere->inner.topLeft(); reflection->setPos(pos); reflection->setPen(QPen(Qt::green, 2)); } @@ -76,12 +74,12 @@ VerifyView:: VerifyView(int _id, Sphere *_sphere, int _height, QWidget *parent): void VerifyView::updateReflection() { QPointF p = reflection->pos(); if(!img_item->boundingRect().contains(p)) { - reflection->setPos(sphere->inner.center() - sphere->inner.topLeft()); + reflection->setPos(image.width()/2, image.height()/2); reflection->setPen(QPen(Qt::red, 2)); - sphere->lights[id] = QPointF(0, 0); //order is important: setPos triggers again. + pos = QPointF(0, 0); //order is important: setPos triggers again. } else { - sphere->lights[id] = p + sphere->inner.topLeft(); + pos = p; reflection->setPen(QPen(Qt::green, 2)); } } diff --git a/relightlab/verifyview.h b/relightlab/verifyview.h index 822b1cfd..ee90b002 100644 --- a/relightlab/verifyview.h +++ b/relightlab/verifyview.h @@ -26,7 +26,7 @@ class VerifyView: public QGraphicsView { public: double lightSize = 10.0; //id is just image number - VerifyView(int id, Sphere *sphere, int height, QWidget *parent = nullptr); + VerifyView(QImage &image, QPointF &pos, int height, QWidget *parent = nullptr); public slots: void updateReflection(); @@ -38,7 +38,8 @@ public slots: QGraphicsPixmapItem *img_item; ReflectionPoint *reflection; QGraphicsScene scene; - Sphere *sphere; + QImage ℑ + QPointF &pos; int id; int height; };