diff --git a/app/SandboxSetup/beamerlocationgui.cpp b/app/SandboxSetup/beamerlocationgui.cpp
index d2ad1fc0e3ff2225d8230511dd1264236f957c77..f655bc70cb7666826d42a3853b20c8fc210ba0c2 100644
--- a/app/SandboxSetup/beamerlocationgui.cpp
+++ b/app/SandboxSetup/beamerlocationgui.cpp
@@ -24,7 +24,7 @@ BeamerLocationGui::BeamerLocationGui(SandboxSetup *_setup, MonitorGui *_mg, QWid
     mut = new QMutex();
     myThread = new RefreshFrame(this);
     timer = new QTimer(this);
-    connect(timer, &QTimer::timeout, this, &BeamerLocationGui::refreshRoutine);
+    connect(timer, &QTimer::timeout, this, &BeamerLocationGui::tickRoutine);
 }
 
 BeamerLocationGui::~BeamerLocationGui()
@@ -62,7 +62,7 @@ void BeamerLocationGui::closeEvent(QCloseEvent *e){
     QWidget::closeEvent(e);
 }
 
-void BeamerLocationGui::refreshRoutine(){
+void BeamerLocationGui::tickRoutine(){
     myThread->start();
 }
 
diff --git a/app/SandboxSetup/beamerlocationgui.h b/app/SandboxSetup/beamerlocationgui.h
index f095bdd4e968f2b1928b5e535ee8f2729ef9980a..9fef3d6c713cc1bc44285cd2cdec83fceab895d9 100644
--- a/app/SandboxSetup/beamerlocationgui.h
+++ b/app/SandboxSetup/beamerlocationgui.h
@@ -48,21 +48,19 @@ private:
     };
 
     Ui::BeamerLocationGui *ui;
-    QtFullScreen *winFullScreen;
     SandboxSetup *setup;
     Beamer *beamer;
     Camera *camera;
     FrameProcessProfil *profil;
     MonitorGui *mg;
-    int keypressed = -1;
+    QtFullScreen *winFullScreen;
     bool isFullScreenInit = false;
-    bool isWaiting = true;
     std::vector<cv::Point2i> crosses;
     std::vector<cv::Point3d> directions;
     std::vector<cv::Point3d> bases;
     std::vector<cv::Point3f> capturedPoints;
-    cv::Mat depth;
-    cv::Mat rgb;
+    cv::Mat_<float> depth;
+    cv::Mat_<cv::Vec3b> rgb;
     QMutex *mut;
     std::vector<cv::Point3i> circles;
     int stepCross = 0;
@@ -72,7 +70,7 @@ private:
     void startRoutine();
     void userValidePoint();
     void endRoutine();
-    void refreshRoutine();
+    void tickRoutine();
     void updateLabelSteps();
 };
 
diff --git a/app/SandboxSetup/croppingmask.cpp b/app/SandboxSetup/croppingmask.cpp
index 71b138c27c8016245e9cf4d6c27030b0b80117dc..9efd457846f9bf626e7d4341fbed63d712d485f5 100644
--- a/app/SandboxSetup/croppingmask.cpp
+++ b/app/SandboxSetup/croppingmask.cpp
@@ -51,8 +51,8 @@ void CroppingMask::showEvent(QShowEvent *event){
     QWidget::showEvent(event);
 
     // show blue screen
-    if(!blueScreenInitilized){
-        blueScreenInitilized = true;
+    if(!blueScreenInitialized){
+        blueScreenInitialized = true;
         blueScreen->editGeometry(mg->getResolution());
     }
     cv::Mat blueMat = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255));
@@ -73,7 +73,7 @@ void CroppingMask::init(){
 
     // load from config
     if(rectPoints.empty()){
-        if(!setup->loadCroppingMask()){
+        if(!setup->loadCroppingMaskAndAdjustingMatrix()){
             cv::Rect mask = setup->getCamera()->getCroppingMask();
             std::vector<cv::Point2i> pts = { cv::Point2i(mask.x, mask.y),
                                              cv::Point2i(mask.x, mask.y+mask.height),
@@ -102,7 +102,7 @@ void CroppingMask::refreshFrame(){
     maskEdit->updateFrame(&cameraColoredFrame);
 }
 
-bool CroppingMask::maskValideInFrame(cv::Mat *rgb){
+bool CroppingMask::maskValideInFrame(cv::Mat_<cv::Vec3b> *rgb){
 
     if(rectPoints.empty())
         return false;
diff --git a/app/SandboxSetup/croppingmask.h b/app/SandboxSetup/croppingmask.h
index 6fb694cee50f389179a2ec7cfbea640aa670479f..564ec29cdec258f4495ed803e8c0e7cd78a4e97c 100644
--- a/app/SandboxSetup/croppingmask.h
+++ b/app/SandboxSetup/croppingmask.h
@@ -39,15 +39,15 @@ private:
     SandboxSetup *setup;
     std::vector<cv::Point2i> rectPoints;
     std::vector<cv::Point2i> loadedMask;
-    cv::Mat cameraColoredFrame;
+    cv::Mat_<cv::Vec3b> cameraColoredFrame;
     MaskEdit *maskEdit;
     MonitorGui *mg;
     QtFullScreen *blueScreen;
-    bool blueScreenInitilized = false;
+    bool blueScreenInitialized = false;
     bool maskUpdated = false;
     QTimer *timer;
 
-    bool maskValideInFrame(cv::Mat *rgb);
+    bool maskValideInFrame(cv::Mat_<cv::Vec3b> *rgb);
     void refreshFrame();
     void init();
 };
diff --git a/app/SandboxSetup/maskedit.cpp b/app/SandboxSetup/maskedit.cpp
index 36f4220f749a2cc196ea72e7879374bd733d4d00..26568e6cf3535ded83a8107e73851f1fe17fcd8b 100644
--- a/app/SandboxSetup/maskedit.cpp
+++ b/app/SandboxSetup/maskedit.cpp
@@ -18,7 +18,7 @@ MaskEdit::~MaskEdit()
 }
 
 
-void MaskEdit::updateFrame(cv::Mat *frame, std::vector<cv::Point> *points){
+void MaskEdit::updateFrame(cv::Mat_<cv::Vec3b> *frame, std::vector<cv::Point2i> *points){
     capture = frame;
     rectPoints = points;
     if(frame != nullptr && points != nullptr){
@@ -28,11 +28,11 @@ void MaskEdit::updateFrame(cv::Mat *frame, std::vector<cv::Point> *points){
     update();
 }
 
-void MaskEdit::updateFrame(cv::Mat *frame){
+void MaskEdit::updateFrame(cv::Mat_<cv::Vec3b> *frame){
     updateFrame(frame, rectPoints);
 }
 
-void MaskEdit::updateFrame(std::vector<cv::Point> *points){
+void MaskEdit::updateFrame(std::vector<cv::Point2i> *points){
     updateFrame(capture, points);
 }
 
@@ -85,7 +85,7 @@ bool MaskEdit::eventFilter(QObject *object, QEvent *ev)
         QMouseEvent* eMouse = (QMouseEvent*)ev;
         if (eMouse->type() == QMouseEvent::MouseMove){
 
-            UpdateSelectedCornerPosition(eMouse);
+            updateSelectedCornerPosition(eMouse);
         }
     }
 
@@ -125,7 +125,7 @@ int MaskEdit::selectCorner(QMouseEvent* eMouse){
 }
 
 
-void MaskEdit::UpdateSelectedCornerPosition(QMouseEvent* eMouse){
+void MaskEdit::updateSelectedCornerPosition(QMouseEvent* eMouse){
 
     if(capture != nullptr && rectPoints != nullptr){
         if(selectedCornerIndex != -1){
diff --git a/app/SandboxSetup/maskedit.h b/app/SandboxSetup/maskedit.h
index 32448dded88a908b9a445faed28a458089fa428e..6d40517f73b368c43306d4a388af2b0d9a8f9555 100644
--- a/app/SandboxSetup/maskedit.h
+++ b/app/SandboxSetup/maskedit.h
@@ -18,15 +18,15 @@ class MaskEdit : public QFrame
 public:
     explicit MaskEdit(const QRect geo, QWidget *parent = 0);
     ~MaskEdit();
-    void updateFrame(cv::Mat *frame, std::vector<cv::Point> *points);
-    void updateFrame(cv::Mat *frame);
-    void updateFrame(std::vector<cv::Point> *points);
+    void updateFrame(cv::Mat_<cv::Vec3b> *frame, std::vector<cv::Point2i> *points);
+    void updateFrame(cv::Mat_<cv::Vec3b> *frame);
+    void updateFrame(std::vector<cv::Point2i> *points);
     virtual bool eventFilter(QObject *object, QEvent *ev) override;
 
 private:
     Ui::MaskEdit *ui;
-    cv::Mat *capture = nullptr;
-    std::vector<cv::Point> *rectPoints = nullptr;
+    cv::Mat_<cv::Vec3b> *capture = nullptr;
+    std::vector<cv::Point2i> *rectPoints = nullptr;
     int selectedCornerIndex = -1;
 
     // relative to the captured frame, not the UI
@@ -34,7 +34,7 @@ private:
     float ratioY = 1.0f;
 
     int selectCorner(QMouseEvent* eMouse);
-    void UpdateSelectedCornerPosition(QMouseEvent* eMouse);
+    void updateSelectedCornerPosition(QMouseEvent* eMouse);
 
 protected:
     void paintEvent(QPaintEvent* event);
diff --git a/inc/projection.h b/inc/projection.h
index f088b89e5b7b7815f9ec4f0879970d2abaaf1d8d..7f96dbc663b6d868f24bab93bc01c42e1e0e4096 100644
--- a/inc/projection.h
+++ b/inc/projection.h
@@ -33,7 +33,7 @@ class Projection{
         Projection();
 
         void setAdjustingMatrix(cv::Mat_<float> matrix){ adjustingMatrix = matrix; }
-        cv::Mat getAdjustingMatrix(){ return adjustingMatrix; }
+        cv::Mat_<float> getAdjustingMatrix(){ return adjustingMatrix; }
         void setDistanceTopSandbox(float dist){ distanceTopSandbox = dist; };
         float getDistanceTopSandbox(){ return distanceTopSandbox; };
 
diff --git a/inc/sandbox.h b/inc/sandbox.h
index bb45cae46c256a29dc8419ae40d2200f345de457..c07945d215ac4d6935f8341999ab39ff3b9735bb 100644
--- a/inc/sandbox.h
+++ b/inc/sandbox.h
@@ -30,7 +30,7 @@ class Sandbox{
         cv::Mat_<cv::Vec3b> adjustProjection(cv::Mat_<cv::Vec3b> &frame);
         cv::Mat_<cv::Vec3b> adjustProjection(cv::Mat_<cv::Vec3b> &frame, cv::Mat_<float> &depth);
         int loadConfig();
-        int loadConfigFrom(char *path);
+        int loadConfig(char *path);
     
 };
 
diff --git a/inc/sandboxConfig.h b/inc/sandboxConfig.h
index 8bf5306e1cfbfa68cbfc9b69092ff3441c6b76d9..4dae00345cdfa56e1c063e29364ee7239f68d1dd 100644
--- a/inc/sandboxConfig.h
+++ b/inc/sandboxConfig.h
@@ -19,19 +19,19 @@ class SandboxConfig{
         SandboxConfig(){};
 
     public:
-        static int saveAdjustingMatrixInto(char *path, cv::Mat matrix);
-        static int saveDistanceToSandboxTop(char *path, float distance);
+        static int saveAdjustingMatrixInto(char *path, cv::Mat_<float> matrix);
+        static int saveDistanceToSandboxTopInto(char *path, float distance);
         static int saveCroppingMaskInto(char *path, cv::Rect mask);
         static int saveBeamerPositionInto(char *path, cv::Point3f position);
         static int saveBeamerResolutionInto(char *path, cv::Size resolution);
-        static int saveFrameProcessProfil(char *path, FrameProcessProfil profil);
+        static int saveFrameProcessProfilInto(char *path, FrameProcessProfil profil);
 
         static int loadAdjustingMatrixFrom(char *path, Projection *projection);
-        static int loadDistanceToSandboxTop(char *path, Projection *projection);
+        static int loadDistanceToSandboxTopFrom(char *path, Projection *projection);
         static int loadCroppingMaskFrom(char *path, Camera *camera);
         static int loadBeamerPositionFrom(char *path, Beamer *beamer);
         static int loadBeamerResolutionFrom(char *path, Beamer *beamer);
-        static int loadFrameProcessProfil(char *path, FrameProcessProfil *profil);
+        static int loadFrameProcessProfilFrom(char *path, FrameProcessProfil *profil);
 
 };
 
diff --git a/inc/sandboxSetup.h b/inc/sandboxSetup.h
index 94cbf17a797db29dd46f9c1a5962bba5c7f8dc22..2544769a6e67a8297f6fe706d54abb9bc57df47c 100644
--- a/inc/sandboxSetup.h
+++ b/inc/sandboxSetup.h
@@ -26,17 +26,17 @@ class SandboxSetup{
         
         
         // save config in file => persistant
-        int saveConfigInto(char *path);
+        int saveConfig(char *path);
         int saveConfig();
         
-        int loadFrameProcessProfilFrom(char *path);
+        int loadFrameProcessProfil(char *path);
         int loadFrameProcessProfil();
-        int loadCroppingMask(char *path);
-        int loadCroppingMask();
+        int loadCroppingMaskAndAdjustingMatrix(char *path);
+        int loadCroppingMaskAndAdjustingMatrix();
 
         // edit variables of config => not persistant
-        void setupAdjustMatrix(std::vector<cv::Point> rectPoints, cv::Point center);
-        void setupCroppingMask(std::vector<cv::Point> rectPoints);
+        void setupAdjustMatrix(std::vector<cv::Point2i> rectPoints, cv::Point2i center);
+        void setupCroppingMask(std::vector<cv::Point2i> rectPoints);
 };
 
 #endif
diff --git a/src/components/beamer.cpp b/src/components/beamer.cpp
index ac12d434b550b9eb3a6941985814220e46f458c6..835c36db9d1c0a308ad36b20c256a7eaf6a1133d 100644
--- a/src/components/beamer.cpp
+++ b/src/components/beamer.cpp
@@ -1,5 +1,8 @@
 #include "../../inc/beamer.h"
 
+/*
+*   Main
+*/
 
 
 Beamer::Beamer(){
@@ -13,24 +16,6 @@ Beamer::~Beamer(){
 }
 
 
-/*
-*   Global purpose
-*/
-
-
-cv::Point3f Beamer::deprojectPixel(cv::Point2i circle, cv::Mat *depth, Camera *camera){
-    float coord[2] = {(float)circle.x, (float)circle.y};
-    float z = depth->at<float>(circle.y, circle.x);
-    return camera->deprojectPixelToPoint(coord, z);
-}
-
-
-void Beamer::printPosition(){
-    cv::Point3f pos = getPosition();
-    std::cout << "(" << pos.x << "," << pos.y << "," << pos.z << ")" << std::endl;
-}
-
-
 
 
 /*
@@ -126,10 +111,8 @@ void Beamer::findLinearLineFrom(std::vector<cv::Point3f> *capturedPoints, std::v
     cv::Vec6f line;
     cv::fitLine(*capturedPoints, line, CV_DIST_L2, 0, 0.01, 0.01);
 
-    cv::Point3d base = cv::Point3d(line[0], line[1], line[2]);
-    cv::Point3d direction = cv::Point3d( LINEAR_REGRESSION_FACT * line[3],
-                                         LINEAR_REGRESSION_FACT * line[4],
-                                         LINEAR_REGRESSION_FACT * line[5] );
+    cv::Point3d direction = cv::Point3d(line[0], line[1], line[2]);
+    cv::Point3d base = cv::Point3d(line[3], line[4], line[5]);
     
     bases->push_back(base);
     directions->push_back(direction);
@@ -199,7 +182,7 @@ int Beamer::LineLineIntersect(
     return (true);
 }
 
-
+/*
 cv::Point3d Beamer::approximatePosition(std::vector<cv::Point3d> *bases, std::vector<cv::Point3d> *directions){
 
     cv::Point3d pa, pb;
@@ -225,4 +208,50 @@ cv::Point3d Beamer::approximatePosition(std::vector<cv::Point3d> *bases, std::ve
     beamerPoint /= (double)beamerPoints.size();
     
     return beamerPoint;
-}
\ No newline at end of file
+}
+*/
+
+cv::Point3d Beamer::approximatePosition(std::vector<cv::Point3d> *bases, std::vector<cv::Point3d> *directions){
+
+    cv::Point3d pa, pb;
+    double mua;
+    double mub;
+    std::vector<cv::Point3d> beamerPoints;
+    int selected[3][2] = { {0,1}, {0,2}, {1,2} };
+
+    for(int i=0; i < 3; i++){
+        LineLineIntersect( bases->at(selected[i][0]),
+                           bases->at(selected[i][0]) + directions->at(selected[i][0]),
+                           bases->at(selected[i][1]),
+                           bases->at(selected[i][1]) + directions->at(selected[i][1]),
+                           &pa, &pb, &mua, &mub);
+        beamerPoints.push_back(pa);
+        beamerPoints.push_back(pb);
+    }
+
+    cv::Point3d beamerPoint(0.0, 0.0, 0.0);
+    for (unsigned int i = 0; i < beamerPoints.size(); i++){
+        beamerPoint += beamerPoints[i];
+    }
+    beamerPoint /= (double)beamerPoints.size();
+    
+    return beamerPoint;
+}
+
+
+cv::Point3f Beamer::deprojectPixel(cv::Point2i circle, cv::Mat *depth, Camera *camera){
+    float coord[2] = {(float)circle.x, (float)circle.y};
+    float z = depth->at<float>(circle.y, circle.x);
+    return camera->deprojectPixelToPoint(coord, z);
+}
+
+
+
+/*
+*   Debug
+*/
+
+void Beamer::printPosition(){
+    cv::Point3f pos = getPosition();
+    std::cout << "(" << pos.x << "," << pos.y << "," << pos.z << ")" << std::endl;
+}
diff --git a/src/components/projection.cpp b/src/components/projection.cpp
index 196dd55fcd4c7f0706376326067bca892b7bee1c..21f37b9a08a8b86083c774a416bf4ceb0f6beb9c 100644
--- a/src/components/projection.cpp
+++ b/src/components/projection.cpp
@@ -32,6 +32,24 @@ cv::Point2i Projection::revertRotatePixel(cv::Point2i pixel){
 */
 void Projection::adjustFrame(cv::Mat_<float> &depth, cv::Mat_<cv::Vec3b> &src, cv::Mat_<cv::Vec3b> &dst, Camera *camera, cv::Point3f beamer_pos){
 
+    // deallocate and reallocate buffers if 1st pass
+    // or dst.size changed, since for all buffers :
+    //      buff.size == dst.size
+    
+    // try
+    if(deprojectMap.size() != dst.size()){
+        std::vector<cv::Point2f> profil = camera->getAdaptedIntrinsics(dst);
+        fxy = profil.at(0);
+        ppxy = profil.at(1);
+    }
+    // do nothing if contains matrix with same size
+    // otherwise => release => allocate
+    deprojectMap.create(dst.rows, dst.cols);
+    frameMap.create(dst.rows, dst.cols);
+    resized_depth.create(dst.rows, dst.cols);
+    resized_src.create(dst.rows, dst.cols);
+/*
+    // default
     if(deprojectMap.empty() || deprojectMap.size() != dst.size()){
         if(!deprojectMap.empty()){
             deprojectMap.release();
@@ -48,7 +66,7 @@ void Projection::adjustFrame(cv::Mat_<float> &depth, cv::Mat_<cv::Vec3b> &src, c
         fxy = profil.at(0);
         ppxy = profil.at(1);
     }
-
+*/
     deprojectMap = cv::Point2i(-1,-1);
     frameMap = cv::Point2i(-1,-1);
 
diff --git a/src/lib/sandbox.cpp b/src/lib/sandbox.cpp
index aa5fd148d0690edaac54439e84c472045ace9d22..c0eeb6d79e4c78d8589b734d1716e0316a0f586c 100644
--- a/src/lib/sandbox.cpp
+++ b/src/lib/sandbox.cpp
@@ -61,11 +61,11 @@ cv::Mat_<cv::Vec3b> Sandbox::adjustProjection(cv::Mat_<cv::Vec3b> &frame){
     return adjustProjection(frame, depth);
 }
 
-int Sandbox::loadConfigFrom(char *path){
+int Sandbox::loadConfig(char *path){
 
     int err = SandboxConfig::loadAdjustingMatrixFrom(path, projection);
     if(err){ return err; }
-    err = SandboxConfig::loadDistanceToSandboxTop(path, projection);
+    err = SandboxConfig::loadDistanceToSandboxTopFrom(path, projection);
     if(err){ return err; }
     err = SandboxConfig::loadCroppingMaskFrom(path, camera);
     if(err){ return err; }
@@ -78,5 +78,5 @@ int Sandbox::loadConfigFrom(char *path){
 
 int Sandbox::loadConfig(){
 
-    return loadConfigFrom(defaultConfigFilePath);
+    return loadConfig(defaultConfigFilePath);
 }
diff --git a/src/lib/sandboxSetup.cpp b/src/lib/sandboxSetup.cpp
index 13d020506ede192420d37c631820cda715ab81f5..e62f3dd8852258466790910e056632f3dc7b753c 100644
--- a/src/lib/sandboxSetup.cpp
+++ b/src/lib/sandboxSetup.cpp
@@ -19,11 +19,11 @@ SandboxSetup::~SandboxSetup(){
 
 
 // return 1 when config can't be saved in file
-int SandboxSetup::saveConfigInto(char *path){
+int SandboxSetup::saveConfig(char *path){
     if(SandboxConfig::saveAdjustingMatrixInto(path, projection->getAdjustingMatrix()))
         return 1;
     
-    if(SandboxConfig::saveDistanceToSandboxTop(path, projection->getDistanceTopSandbox()))
+    if(SandboxConfig::saveDistanceToSandboxTopInto(path, projection->getDistanceTopSandbox()))
         return 1;
 
     if(SandboxConfig::saveCroppingMaskInto(path, camera->getCroppingMask()))
@@ -35,7 +35,7 @@ int SandboxSetup::saveConfigInto(char *path){
     if(SandboxConfig::saveBeamerPositionInto(path, beamer->getPosition()))
         return 1;
 
-    if(SandboxConfig::saveFrameProcessProfil(path, *beamer->getProfil()))
+    if(SandboxConfig::saveFrameProcessProfilInto(path, *beamer->getProfil()))
         return 1;
 
     return 0;
@@ -43,23 +43,26 @@ int SandboxSetup::saveConfigInto(char *path){
 
 
 int SandboxSetup::saveConfig(){
-    return saveConfigInto(defaultConfigFilePath);
+    return saveConfig(defaultConfigFilePath);
 }
 
-int SandboxSetup::loadCroppingMask(char *path){
-    return SandboxConfig::loadCroppingMaskFrom(path, camera);
+int SandboxSetup::loadCroppingMaskAndAdjustingMatrix(char *path){
+    int err = SandboxConfig::loadAdjustingMatrixFrom(path, projection);
+    if(err){ return err; }
+    err = SandboxConfig::loadCroppingMaskFrom(path, camera);
+    return err;
 }
 
-int SandboxSetup::loadCroppingMask(){
-    return loadCroppingMask(defaultConfigFilePath);
+int SandboxSetup::loadCroppingMaskAndAdjustingMatrix(){
+    return loadCroppingMaskAndAdjustingMatrix(defaultConfigFilePath);
 }
 
-int SandboxSetup::loadFrameProcessProfilFrom(char *path){
-    return SandboxConfig::loadFrameProcessProfil(path, beamer->getProfil());
+int SandboxSetup::loadFrameProcessProfil(char *path){
+    return SandboxConfig::loadFrameProcessProfilFrom(path, beamer->getProfil());
 }
 
 int SandboxSetup::loadFrameProcessProfil(){
-    return loadFrameProcessProfilFrom(defaultConfigFilePath);
+    return loadFrameProcessProfil(defaultConfigFilePath);
 }
 
 
@@ -71,7 +74,7 @@ int SandboxSetup::loadFrameProcessProfil(){
  * 
  *  center : center of the rotation in the projected frame
  */
-void SandboxSetup::setupAdjustMatrix(std::vector<cv::Point> rectPoints, cv::Point center){
+void SandboxSetup::setupAdjustMatrix(std::vector<cv::Point2i> rectPoints, cv::Point2i center){
 
     // Set adjusting matrix for the projection
     int widthTop = rectPoints[3].x - rectPoints[0].x;
@@ -90,14 +93,15 @@ void SandboxSetup::setupAdjustMatrix(std::vector<cv::Point> rectPoints, cv::Poin
 void SandboxSetup::setupCroppingMask(std::vector<cv::Point2i> rectPoints){
 
     // Set cropping mask
-    int widthTop = rectPoints[3].x - rectPoints[0].x;
+    cv::Point2i ptl = projection->rotatePixel(rectPoints[0]);
     cv::Point2i pbl = projection->rotatePixel(rectPoints[1]);
     cv::Point2i pbr = projection->rotatePixel(rectPoints[2]);
+    cv::Point2i ptr = projection->rotatePixel(rectPoints[3]);
     cv::Point2i pbot = (pbl.y < pbr.y) ? pbl : pbr;
-    cv::Point2i ptop = projection->rotatePixel(rectPoints[0]);
+    int widthTop = ptr.x - ptl.x;
 
     cv::Size rectSize = cv::Size(widthTop, pbot.y - rectPoints[0].y);
-    camera->setCroppingMask(cv::Rect(ptop, rectSize)); // croppingMask
+    camera->setCroppingMask(cv::Rect(ptl, rectSize)); // croppingMask
 }
 
 
diff --git a/src/tools/sandboxConfig.cpp b/src/tools/sandboxConfig.cpp
index 557d7ba23b0bc4dfd54a86a26976a84a44318670..5de2e922700bda9202c569e7e5ba4e5f53b479c8 100644
--- a/src/tools/sandboxConfig.cpp
+++ b/src/tools/sandboxConfig.cpp
@@ -3,13 +3,13 @@
 static int saveConfigIn(char *path, YAML::Node config);
 
 
-int SandboxConfig::saveAdjustingMatrixInto(char *path, cv::Mat matrix){
+int SandboxConfig::saveAdjustingMatrixInto(char *path, cv::Mat_<float> matrix){
 
     // convert matrix into a one layer vector
     YAML::Node vec = YAML::Load("[]");
     for (int y = 0; y < matrix.rows; y++){
         for (int x = 0; x < matrix.cols; x++){
-            vec.push_back((float)matrix.at<float>(y, x));
+            vec.push_back(matrix.at<float>(y, x));
         }
     }
 
@@ -32,7 +32,7 @@ int SandboxConfig::saveAdjustingMatrixInto(char *path, cv::Mat matrix){
 }
 
 
-int SandboxConfig::saveDistanceToSandboxTop(char *path, float distance){
+int SandboxConfig::saveDistanceToSandboxTopInto(char *path, float distance){
     
     YAML::Node val;
 
@@ -114,7 +114,7 @@ int SandboxConfig::saveBeamerResolutionInto(char *path, cv::Size res){
 }
 
 
-int SandboxConfig::saveFrameProcessProfil(char *path, FrameProcessProfil profil){
+int SandboxConfig::saveFrameProcessProfilInto(char *path, FrameProcessProfil profil){
 
     YAML::Node val;
 
@@ -190,7 +190,7 @@ int SandboxConfig::loadAdjustingMatrixFrom(char *path, Projection *projection){
 }
 
 
-int SandboxConfig::loadDistanceToSandboxTop(char *path, Projection *projection){
+int SandboxConfig::loadDistanceToSandboxTopFrom(char *path, Projection *projection){
 
     YAML::Node config;
 
@@ -311,7 +311,7 @@ int SandboxConfig::loadBeamerResolutionFrom(char *path, Beamer *beamer){
 }
 
 
-int SandboxConfig::loadFrameProcessProfil(char *path, FrameProcessProfil *profil){
+int SandboxConfig::loadFrameProcessProfilFrom(char *path, FrameProcessProfil *profil){
     
     YAML::Node config;