diff --git a/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/PhotometricStereo.cc.o b/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/PhotometricStereo.cc.o
index 540ba83948787cdb8abf565161409a49e31d4306..d6651f03bcb82f2d5d1468c5eb27e0f0ce8cb7c4 100644
Binary files a/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/PhotometricStereo.cc.o and b/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/PhotometricStereo.cc.o differ
diff --git a/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/specular_estimation.cc.o b/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/specular_estimation.cc.o
index ad6ba8533ac5dfd1dcc2e583f2e8b54d53d0ee4e..2d8b26e789a4a145d9a436839be31c8e0ff2acf1 100644
Binary files a/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/specular_estimation.cc.o and b/apps/specular_estimation/CMakeFiles/specular_estimation.dir/src/specular_estimation.cc.o differ
diff --git a/apps/specular_estimation/src/Charuco.h b/apps/specular_estimation/src/Charuco.h
index 3cbd6ed08fb9bd96186e9f55eca866291001292b..ac50bc0e18a21426a52e5579d041db8320643fa7 100644
--- a/apps/specular_estimation/src/Charuco.h
+++ b/apps/specular_estimation/src/Charuco.h
@@ -30,8 +30,9 @@ void createArucoDictionary(std::vector< cv::Mat >& arucoMarkers, int dictionaryI
 cv::Mat drawCharuco(cv::Ptr<cv::aruco::CharucoBoard> board, int rows, int cols, bool saveCharuco, bool displayCharuco);
 void calibrateCamera(int squaresX, int squaresY, float squareLength, float markerLength, int dictionaryId, std::vector<cv::Mat> charucoImages, cv::Mat& cameraMatrix, cv::Mat& distCoeffs);
 void calibrateCamera(std::string charucoPath, cv::Mat& cameraMatrix, cv::Mat& distortionCoefficients);
-void loadCharucoImages(std::vector< cv::Mat >& charucoImages, std::string charucoPath, std::string charucoName);
+void loadCharucoImages(std::vector<cv::Mat>& charucoImages, std::string charucoPath, std::string charucoName);
 void undistortCharuco(cv::Ptr<cv::aruco::CharucoBoard> board, cv::Mat inputImage, cv::Mat boardImage, cv::Mat& undistortedCharuco, cv::Mat cameraMatrix, cv::Mat distortionCoefficients, cv::Vec3d& rvec, cv::Vec3d& tvec, cv::Mat& perspectiveTransform, bool displayUndistortedCharuco);
+std::vector<cv::Mat> loadCharucoImages(std::string path, int imageScale);
 
 void charucoCalibration(int width, int height, cv::Ptr<cv::aruco::CharucoBoard>& charucoBoard, cv::Mat& charucoBoardImage, cv::Mat& cameraMatrix, cv::Mat& distortionCoefficients, const std::string imagesPath, const std::string folderPath) {
 
@@ -330,8 +331,6 @@ std::vector<cv::Mat> charucoAlignment(std::vector<cv::Mat> materialImages, int n
 		cv::Mat croppedWindow(undistortedCharuco, crop);
 		charucoImages.push_back(croppedWindow);
 
-		i++;
-
 		cv::imshow("Undistorted ChArUco", croppedWindow);
 		cv::waitKey(0);
 	}
@@ -339,7 +338,7 @@ std::vector<cv::Mat> charucoAlignment(std::vector<cv::Mat> materialImages, int n
 	return charucoImages;
 }
 
-void createArucoDictionary(std::vector< cv::Mat >& arucoMarkers, int dictionaryId) {
+void createArucoDictionary(std::vector<cv::Mat>& arucoMarkers, int dictionaryId) {
 	//int dictionaryId = 0;  // dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2, DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12, DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16
 	int borderBits = 1;    // Number of bits in marker borders
 	int markerSize = 200;  // Marker size in pixels
@@ -705,7 +704,7 @@ void calibrateCamera(std::string charucoPath, cv::Mat& cameraMatrix, cv::Mat& di
 	//cv::Ptr<cv::aruco::CharucoBoard> charucoBoard = cv::aruco::CharucoBoard::create(squaresX, squaresY, squareLength, markerLength, dictionary);
 
 	std::cout << "Loading ChArUco images.\n";
-	std::vector<cv::Mat> charucoImages = loadImages(charucoPath);
+	std::vector<cv::Mat> charucoImages = loadCharucoImages(charucoPath, 1);
 
 	std::string outputFile = "cameraCalibration";
 
@@ -975,4 +974,43 @@ void detectArucoMarkers(int dictionaryId, bool showRejected, bool estimatePose,
 	cv::imwrite("DetectedArUcoMarkers.png", imageCopy);
 }
 
+std::vector<cv::Mat> loadCharucoImages(std::string path, int imageScale = 1) {
+
+	std::vector<cv::Mat> images;
+	bool loadedImages = false;
+	int imageNumber = 0;
+
+	// Load the images
+	while (!loadedImages) {
+
+		// The index of the loop is converted into a stringstream, then to the string called "indexString"
+		// Using 'to_string' directly gives the error "'to_string' is not a member of 'std'"
+		std::ostringstream stm;
+		stm << imageNumber;
+		std::string indexString = stm.str();
+
+		// Read the image of the current index
+		cv::Mat image = cv::imread(path + indexString + ".png", cv::IMREAD_COLOR);
+
+		if (!image.data) {  // Check if any images failed to load
+			std::cout << imageNumber << " images have been loaded." << std::endl;
+			loadedImages = true;
+		}
+		else {
+			if (imageScale != 1) {
+				cv::resize(image, image, cv::Size(), 1.0 / imageScale, 1.0 / imageScale, cv::INTER_AREA);
+			}
+			images.push_back(image);
+			imageNumber++;
+			//std::cout << "Loaded image " << imageNumber << std::endl;
+		}
+	}
+
+	if (imageNumber < 1) {
+		std::cerr << "Error: No images could be loaded." << std::endl;
+	}
+
+	return images;
+}
+
 #endif
diff --git a/apps/specular_estimation/src/PhotometricStereo.cc b/apps/specular_estimation/src/PhotometricStereo.cc
index 27a53e0c069a6f82b5026807ff7eb22efd657e50..261267b85ec35ad58a83026005d485902c99dd39 100755
--- a/apps/specular_estimation/src/PhotometricStereo.cc
+++ b/apps/specular_estimation/src/PhotometricStereo.cc
@@ -180,15 +180,56 @@ photometricStereo::photometricStereo(int n, int startI, int endI, std::string pa
     mMaskNames.push_back(path + objectName);
 }
 
-photometricStereo::photometricStereo(int imageNumber, std::string modelPath, std::string calibrationPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio): mDiscardRatio(discardRatio), imageNum(imageNumber) {
-    int imageScale = 4;
-    mp2Images = readImages(modelPath, imageScale);
-    std::cout << "Loaded material images.\n";
+photometricStereo::photometricStereo(int imageNumber, std::string modelPath, std::string calibrationPath, std::string charucoPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio): mDiscardRatio(discardRatio), imageNum(imageNumber) {
+    int imageScale = 2, numberOfLights = 6;
+
+    /*cv::Mat cameraMatrix, distortionCoefficients, lightDirectionsPerspective;
+
+	calibrateCamera(charucoPath, cameraMatrix, distortionCoefficients);
+	std::cout << "Camera parameters obtained.\n";
+
+	cv::Mat perspectiveTransform;
+	mp2Images = readImages(modelPath, imageScale);
+	mp2Images = charucoAlignment(mp2Images, numberOfLights, perspectiveTransform, cameraMatrix, distortionCoefficients);
+	std::cout << "ChArUco alignment successful.\n";*/
+
+    //mp2Images = readImages(modelPath, imageScale);
+    //std::cout << "Loaded material images.\n";
+
+
+    mp2CalibrationImages = readImages(calibrationPath, imageScale);
+    std::cout << "Loaded calibration images.\n";
+    //mp2MacbethImages = readImages(macbethPath);
+    //std::cout << "Loaded macbeth images.\n";
+
+    width  = mp2Images[0].cols;
+    height = mp2Images[0].rows;
+
+    std::string maskName = calibrationPath + "mask.png";
+    cv::Mat p2Mask = cv::imread(maskName, cv::IMREAD_GRAYSCALE);
+    if (imageScale != 1)
+		cv::resize(p2Mask, p2Mask, cv::Size(), 1.0 / imageScale, 1.0 / imageScale, cv::INTER_AREA);
+    mp2Mask.push_back(p2Mask);
+    mMaskNames.push_back(maskName);
+
+
+    maskName = calibrationPath + "white.png";
+    p2Mask = cv::imread(maskName, cv::IMREAD_GRAYSCALE);
+    if (imageScale != 1)
+        cv::resize(p2Mask, p2Mask, cv::Size(), 1.0 / imageScale, 1.0 / imageScale, cv::INTER_AREA);
+    mp2Mask.push_back(p2Mask);
+    mMaskNames.push_back(maskName);   
+}
+
+photometricStereo::photometricStereo(int imageNumber, int imageScale, std::vector<cv::Mat> materialImages, std::string calibrationPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio): mDiscardRatio(discardRatio), imageNum(imageNumber), mp2Images(materialImages) {
+    cv::Mat perspectiveTransform, lightDirectionsPerspective;
+
     mp2CalibrationImages = readImages(calibrationPath, imageScale);
     std::cout << "Loaded calibration images.\n";
     //mp2MacbethImages = readImages(macbethPath);
     //std::cout << "Loaded macbeth images.\n";
 
+    int numberOfLights = mp2CalibrationImages.size();
     width  = mp2Images[0].cols;
     height = mp2Images[0].rows;
 
diff --git a/apps/specular_estimation/src/PhotometricStereo.h b/apps/specular_estimation/src/PhotometricStereo.h
index e759ccaf011c3f7d562fe5d22f2ab1b8020fa281..f01ee36d631ea5af4c568640eaf5aac8679050a9 100755
--- a/apps/specular_estimation/src/PhotometricStereo.h
+++ b/apps/specular_estimation/src/PhotometricStereo.h
@@ -33,8 +33,9 @@ class photometricStereo {
     // fill the imageNames and maskNames
     // use image with equal distance
     photometricStereo(int n, int startI, int endI, std::string path, std::string metal1Phere1Name, std::string metal2Phere1Name, std::string lambertPhereName, std::string objectName, double discardRatio = 0.1);
-    photometricStereo(int imageNumber, std::string modelPath, std::string calibrationPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio = 0.1);
+    photometricStereo(int imageNumber, std::string modelPath, std::string calibrationPath, std::string charucoPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio = 0.1);
     photometricStereo(std::vector<cv::Mat> mp2Images, std::vector<cv::Mat> mp2CalibrationImages, std::vector<cv::Mat> mp2Mask, int imageNumber = 0, double discardRatio = 0.1);
+    photometricStereo(int imageNumber, int imageScale, std::vector<cv::Mat> materialImages, std::string calibrationPath, std::string macbethPath, std::string imageName, std::string calibration, double discardRatio = 0.1);
     photometricStereo(const photometricStereo&) = delete;
     photometricStereo& operator = (const photometricStereo&) = delete;
     ~photometricStereo();
diff --git a/apps/specular_estimation/src/specular_estimation.cc b/apps/specular_estimation/src/specular_estimation.cc
index 3849edddeff64260778025e8617c6ffd8529afa1..08d509f7aade2e16f8b861691531ce41e2682269 100644
--- a/apps/specular_estimation/src/specular_estimation.cc
+++ b/apps/specular_estimation/src/specular_estimation.cc
@@ -65,7 +65,7 @@ void specularEstimation(std::string imageName, std::string calibration, double R
 	const std::string normalPath      = materialPath + "normal.png";
 
 	double LightDistance = 1.0, LightIntensity = 1.0, Gain = 1.0, Bias = 0.0;
-	int numberOfLights = 6, width = 1092, height = 732;
+	int numberOfLights = 6, width = 2091, height = 1626;
 
 	cv::Mat residualImage, albedo, normalMap, heightMap;
 	std::vector<cv::Mat> materialImages, charucoImages, calibrationImages, mp2Mask;
@@ -73,43 +73,34 @@ void specularEstimation(std::string imageName, std::string calibration, double R
 
 	if (!synthetic) {
 		
-		int originalWidth, originalHeight, imageScale = 1;		
-		cv::Mat cameraMatrix, distortionCoefficients, lightDirectionsPerspective;
+		int originalWidth = width, originalHeight = height, imageScale = 2;
+		width  /= imageScale;
+		height /= imageScale;
 
+		cv::Mat cameraMatrix, distortionCoefficients, lightDirectionsPerspective;
 		calibrateCamera(charucoPath, cameraMatrix, distortionCoefficients);
 		std::cout << "Camera parameters obtained.\n";
 
 		cv::Mat perspectiveTransform;
-		materialImages = loadImages(materialPath);
+		materialImages = loadImages(materialPath, imageScale);
 		materialImages = charucoAlignment(materialImages, numberOfLights, perspectiveTransform, cameraMatrix, distortionCoefficients);
 		std::cout << "ChArUco alignment successful.\n";
-
+		
 		/*
 		//std::cout << "Loading material images.\n";
 		materialImages = loadMaterialImages(materialPath, originalWidth, originalHeight, width, height, imageScale);
 		//std::cout << "Loading light source calibration images.\n";
 		calibrationImages = loadImages(calibrationPath);
 		numberOfLights = calibrationImages.size();
-
-		std::string maskName = calibrationPath + "mask.png";
-		cv::Mat p2Mask = cv::imread(maskName, cv::IMREAD_GRAYSCALE);
-		mp2Mask.push_back(p2Mask);
-		maskName = calibrationPath + "white.png";
-		p2Mask = cv::imread(maskName, cv::IMREAD_GRAYSCALE);
-		//p2Mask = cv::Mat(p2Mask.size(), CV_8U, cv::Scalar(255));
-		mp2Mask.push_back(p2Mask);*/
-
-		//cv::Mat lightDirectionsInverted;
-		//cv::Mat cameraMatrix, distortionCoefficients, lightDirectionsPerspective;
-		/*cv::Mat lightDirections = (cv::Mat_<float>(6,3) << -0.57735, -0.57735, 0.57735, 	0, 0.7071, 0.7071,	0, -0.7071, 0.7071,	0.7071, 0, 0.7071,	-0.7071, 0, 0.7071, 	0.57735, 0.57735, 0.57735);*/
-		//cv::invert(lightDirections, lightDirectionsInverted, cv::DECOMP_SVD);
+		*/
 
 
 		//charucoAlignment(charucoPath, charucoImages, materialImages, numberOfLights, width, height, lightDirections, lightDirectionsPerspective, cameraMatrix, distortionCoefficients);
 		
 
 		//phoSte::photometricStereo PhotometricStereo(materialImages, calibrationImages, mp2Mask, numberOfLights, 0);
-		phoSte::photometricStereo PhotometricStereo(numberOfLights, materialPath, calibrationPath, macbethPath, imageName, calibration, 0);
+		//phoSte::photometricStereo PhotometricStereo(numberOfLights, materialPath, calibrationPath, charucoPath, macbethPath, imageName, calibration, 0);
+    	phoSte::photometricStereo PhotometricStereo(numberOfLights, imageScale, materialImages, calibrationPath, macbethPath, imageName, calibration, 0);
 
 		//PhotometricStereo.readImage(materialPath, calibrationPath, macbethPath);
 		//cv::Mat calibrationMask = loadCalibrationMask(calibrationPath, height, width);
diff --git a/bin/specular_estimation b/bin/specular_estimation
index 7baeb8a373bc251c96d1860b6a8b627120a48ea7..3091b94ab90bcbbaefeafc3c2d4778e1e6991e38 100755
Binary files a/bin/specular_estimation and b/bin/specular_estimation differ