diff --git a/TrackerPlugin_EyeTracker.cpp b/TrackerPlugin_EyeTracker.cpp
index d846366..a7507fe 100644
--- a/TrackerPlugin_EyeTracker.cpp
+++ b/TrackerPlugin_EyeTracker.cpp
@@ -161,26 +161,28 @@ QObject *TrackerPlugin_EyeTracker::worker()
 
 void TrackerPlugin_EyeTracker::initializeUI(QLayout *layout, QGraphicsScene *cameraScene, QSize cameraResolution)
 {
-    this->cameraResolution = cameraResolution;
-    layout->addWidget(this);
-    this->cameraScene = cameraScene;
-
-    for(int i=0;i<rectItems.size();i++){
-        this->cameraScene->addItem(rectItems.at(i));
-    }
-
-    /*Resize rectangles according to the correct size*/
-    if(cameraResolution.width()>cameraResolution.height()){
-        this->maxRectWidth = cameraResolution.height()/2;
-    }else{
-        this->maxRectWidth = cameraResolution.width()/2;
-    }
-    qDebug()<<maxRectWidth;
-    for(int i=0;i<rectItems.size();i++){
-        rectItems.at(i)->setRect(QRect(0,0,maxRectWidth,maxRectWidth));
-        emit(thresholdChanged(i, uiSliders.at(i)->value()));
-        emit(sizeChanged(i, QSize(rectItems.at(i)->rect().width(), rectItems.at(i)->rect().height())));
-        emit(posChanged(i, QPoint(rectItems.at(i)->pos().rx(),rectItems.at(i)->pos().ry())));
+    /*Keep rectangles unchanged if the resolution didn't change*/
+    if(this->cameraResolution!=cameraResolution){
+        this->cameraResolution = cameraResolution;
+        layout->addWidget(this);
+        this->cameraScene = cameraScene;
+
+        for(int i=0;i<rectItems.size();i++){
+            this->cameraScene->addItem(rectItems.at(i));
+        }
+
+        /*Resize rectangles according to the correct size*/
+        if(cameraResolution.width()>cameraResolution.height()){
+            this->maxRectWidth = cameraResolution.height()/2;
+        }else{
+            this->maxRectWidth = cameraResolution.width()/2;
+        }
+        for(int i=0;i<rectItems.size();i++){
+            rectItems.at(i)->setRect(QRect(0,0,maxRectWidth,maxRectWidth));
+            emit(thresholdChanged(i, uiSliders.at(i)->value()));
+            emit(sizeChanged(i, QSize(rectItems.at(i)->rect().width(), rectItems.at(i)->rect().height())));
+            emit(posChanged(i, QPoint(rectItems.at(i)->pos().rx(),rectItems.at(i)->pos().ry())));
+        }
     }
 }
 
diff --git a/TrackerPlugin_EyeTracker.h b/TrackerPlugin_EyeTracker.h
index 037bb9a..37b351b 100644
--- a/TrackerPlugin_EyeTracker.h
+++ b/TrackerPlugin_EyeTracker.h
@@ -38,7 +38,7 @@ class TrackerPlugin_EyeTracker : public QWidget, public TrackerInterface
     QObject *worker();
     void initializeUI(QLayout* guiTargetLayout, QGraphicsScene* cameraScene, QSize cameraResolution);
     TrackerWorker* trackerWorker;
-    QSize cameraResolution;
+    QSize cameraResolution = QSize(0,0);
 
 private:
     Ui::TrackerPlugin_EyeTracker *ui;