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 875c8f0e893f4b5d30849024a3126233a7f4c5e1..78fc764115803021e5b40df798e0bd4a31b80c94 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 59f1e683dd0025db286e1f175675de8c215361ce..d0439deffc17cc4332694191645be110da01e694 100644
--- a/apps/specular_estimation/src/Charuco.h
+++ b/apps/specular_estimation/src/Charuco.h
@@ -155,11 +155,11 @@ std::vector<cv::Mat> charucoAlignment(std::vector<cv::Mat> materialImages, int n
 	int xSquares = 11;
 	int ySquares = 9;
 	int height = materialImages[0].rows;
-	int width  = materialImages[0].cols;
+	int width  = ((height * xSquares) / ySquares);
 	float squareSideLength = 0.04f;
 	float markerSideLength = 0.02f;
 	cv::Ptr<cv::aruco::CharucoBoard> charucoBoard = cv::aruco::CharucoBoard::create(xSquares, ySquares, squareSideLength, markerSideLength, dictionary);
-	cv::Mat charucoBoardImage = drawCharuco(charucoBoard, height, ((height * xSquares) / ySquares), false, false);
+	cv::Mat charucoBoardImage = drawCharuco(charucoBoard, height, width, false, false);
 
 	// Create the rotation and translation vectors for the current ChArUco board image
 	// Brings the calibration pattern from the model coordinate space (in which object points are specified) to the world coordinate space, the real position of the calibration pattern
@@ -248,7 +248,7 @@ std::vector<cv::Mat> charucoAlignment(std::vector<cv::Mat> materialImages, int n
 	float squareSideLength = 0.04f;
 	float markerSideLength = 0.02f;
 	cv::Ptr<cv::aruco::CharucoBoard> charucoBoard = cv::aruco::CharucoBoard::create(xSquares, ySquares, squareSideLength, markerSideLength, dictionary);
-	cv::Mat charucoBoardImage = drawCharuco(charucoBoard, height, ((height * xSquares) / ySquares), false, false), rotationMatrix, rotationVector;
+	cv::Mat charucoBoardImage = drawCharuco(charucoBoard, height, width, false, false), rotationMatrix, rotationVector;
 	//cv::imwrite(imagesPath + "ChArUco board.png", charucoBoardImage);
 	
 	// Create the rotation and translation vectors for the current ChArUco board image
@@ -318,11 +318,19 @@ std::vector<cv::Mat> charucoAlignment(std::vector<cv::Mat> materialImages, int n
 
 		rvecs.push_back(rvec);
 		tvecs.push_back(tvec);
-		charucoImages.push_back(undistortedCharuco);
+		int borderWidth = height * 2.0/ySquares;
+		int windowWidth = height * (ySquares-4.0)/(ySquares-2.0);
+		int windowHeight = height * (ySquares-4.0)/(xSquares-2.0);
+		cv::Rect crop = cv::Rect(borderWidth, borderWidth, windowWidth, windowHeight);
+
+		//std::cout << "ChArUco board width: " << width << ", ChArUco board height: " << height << ", Border width: " << borderWidth << ", Window width: " << windowWidth << ", Window height: " << windowHeight << std::endl;
+
+		cv::Mat croppedWindow(undistortedCharuco, crop);
+		charucoImages.push_back(croppedWindow);
 
 		i++;
 
-		cv::imshow("Undistorted ChArUco", undistortedCharuco);
+		cv::imshow("Undistorted ChArUco", croppedWindow);
 		cv::waitKey(0);
 	}
 
diff --git a/bin/specular_estimation b/bin/specular_estimation
index 59e26bf22540558453eb544c0410366121f2acad..be7f34fedcec6608e657bb50541c4e268f270123 100755
Binary files a/bin/specular_estimation and b/bin/specular_estimation differ