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 b9167a46d5e7ff3afd9abe5ff08760d0e28bc0e7..dfb93a91c75d7f7857f4da4335851fee671bc3ed 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/OpenGL.h b/apps/specular_estimation/src/OpenGL.h index 333e26250dce07da3d065eff61b7631cb4a0f94d..08fda0c3449f6fec15ecedf1da16c006902905b2 100644 --- a/apps/specular_estimation/src/OpenGL.h +++ b/apps/specular_estimation/src/OpenGL.h @@ -481,8 +481,8 @@ void computeResidual(int imageNumber, int windowHeight, int windowWidth, std::st // 3D models have the origin in the bottom-left corner, while images have the origin in the top-left corner. The image is flipped to convert between the two. cv::flip(temp, temp, 0); - /*temp = temp(cv::Rect(0, 0, windowWidth, windowHeight-1)); - copyMakeBorder(temp, temp, 0, 1, 0, 0, cv::BORDER_REPLICATE);*/ + //temp = temp(cv::Rect(1, 1, windowWidth-2, windowHeight-2)); + //copyMakeBorder(temp, temp, 1, 1, 1, 1, cv::BORDER_REPLICATE); // Calculate the absolute differences between the model and the photograph cv::absdiff(temp, textureImages[imageNumber], residual); @@ -502,7 +502,9 @@ void computeResidual(int imageNumber, int windowHeight, int windowWidth, std::st cv::imwrite(modelPath + "model." + number + ".png", temp); cv::imwrite(modelPath + "residual." + number + ".png", sumOfSquaredDifferences); - // + // Crop a 1-pixel border around the residual + sumOfSquaredDifferences = sumOfSquaredDifferences(cv::Rect(1, 1, windowWidth-2, windowHeight-2)); + sum = (cv::sum(sumOfSquaredDifferences)[0] + cv::sum(sumOfSquaredDifferences)[1] + cv::sum(sumOfSquaredDifferences)[2])/(windowHeight * windowWidth); residuals = cv::Vec3d(cv::sum(sumOfSquaredDifferences)[0], cv::sum(sumOfSquaredDifferences)[1], cv::sum(sumOfSquaredDifferences)[2]); diff --git a/bin/specular_estimation b/bin/specular_estimation index ba7755bb91772a9b560a0bf0cb5bfebc2ecde814..a190f979325200bd142905ed12407a9b0fcf043d 100755 Binary files a/bin/specular_estimation and b/bin/specular_estimation differ