Skip to content

Commit

Permalink
[PS] Correct spelling of "ambient"
Browse files Browse the repository at this point in the history
  • Loading branch information
jmelou committed Jun 2, 2024
1 parent df2bd63 commit f71e958
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions src/aliceVision/lightingEstimation/lightingCalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void lightCalibration(const sfmData::SfMData& sfmData,
ALICEVISION_LOG_INFO("View Id: " << currentView.getViewId());
const fs::path imagePath = fs::path(currentView.getImage().getImagePath());

if (!boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
{
std::string sphereName = std::to_string(currentView.getViewId());
auto sphereExists = (fileTree.get_child_optional(sphereName)).is_initialized();
Expand Down Expand Up @@ -138,7 +138,7 @@ void lightCalibration(const sfmData::SfMData& sfmData,
ALICEVISION_LOG_INFO("View Id: " << currentView.getViewId());
const fs::path imagePath = fs::path(currentView.getImage().getImagePath());

if (!boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
{
ALICEVISION_LOG_INFO(" - " << imagePath.string());
imageList.push_back(imagePath.string());
Expand Down Expand Up @@ -641,7 +641,7 @@ void writeJSON(const std::string& fileName,
const bool calibratedFile = (std::find(imageList.begin(), imageList.end(), viewId.getImage().getImagePath()) != imageList.end());

// Only write images that were actually used for the lighting calibration, instead of all the input images
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambiant") && calibratedFile)
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambient") && calibratedFile)
{
bpt::ptree lightTree;
if (saveAsModel)
Expand Down Expand Up @@ -684,7 +684,7 @@ void writeJSON(const std::string& fileName,
else
{
ALICEVISION_LOG_INFO("'" << imagePath << "' is in the input SfMData but has not been used for the lighting "
<< "calibration or contains 'ambiant' in its filename.");
<< "calibration or contains 'ambient' in its filename.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/lightingEstimation/lightingEstimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void albedoNormalsProduct(MatrixXf& rhoTimesN, const MatrixXf& albedoChannel, co
rhoTimesN(validIndex, 0) = albedoChannel(i) * augmentedNormals(i).nx();
rhoTimesN(validIndex, 1) = albedoChannel(i) * augmentedNormals(i).ny();
rhoTimesN(validIndex, 2) = albedoChannel(i) * augmentedNormals(i).nz();
rhoTimesN(validIndex, 3) = albedoChannel(i) * augmentedNormals(i).nambiant();
rhoTimesN(validIndex, 3) = albedoChannel(i) * augmentedNormals(i).nambient();
rhoTimesN(validIndex, 4) = albedoChannel(i) * augmentedNormals(i).nx_ny();
rhoTimesN(validIndex, 5) = albedoChannel(i) * augmentedNormals(i).nx_nz();
rhoTimesN(validIndex, 6) = albedoChannel(i) * augmentedNormals(i).ny_nz();
Expand Down
6 changes: 3 additions & 3 deletions src/aliceVision/photometricStereo/photometricDataIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void loadLightSH(const std::string& dirFileName, Eigen::MatrixXf& lightMat)
{
std::stringstream stream;
std::string line;
float x, y, z, ambiant, nxny, nxnz, nynz, nx2ny2, nz2;
float x, y, z, ambient, nxny, nxnz, nynz, nx2ny2, nz2;

std::fstream dirFile;
dirFile.open(dirFileName, std::ios::in);
Expand All @@ -117,13 +117,13 @@ void loadLightSH(const std::string& dirFileName, Eigen::MatrixXf& lightMat)
stream.clear();
stream.str(line);

stream >> x >> y >> z >> ambiant >> nxny >> nxnz >> nynz >> nx2ny2 >> nz2;
stream >> x >> y >> z >> ambient >> nxny >> nxnz >> nynz >> nx2ny2 >> nz2;
if (lineNumber < lightMat.rows())
{
lightMat(lineNumber, 0) = x;
lightMat(lineNumber, 1) = -y;
lightMat(lineNumber, 2) = -z;
lightMat(lineNumber, 3) = ambiant;
lightMat(lineNumber, 3) = ambient;
lightMat(lineNumber, 4) = nxny;
lightMat(lineNumber, 5) = nxnz;
lightMat(lineNumber, 6) = nynz;
Expand Down
22 changes: 11 additions & 11 deletions src/aliceVision/photometricStereo/photometricStereo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ void photometricStereo(const std::string& inputPath,
std::string maskName = lightDataPath.remove_filename().string() + "/mask.png";
loadMask(maskName, mask);

std::string pathToAmbiant = "";
std::string pathToAmbient = "";

if (PSParameters.removeAmbiant)
if (PSParameters.removeAmbient)
{
for (auto& currentPath : imageList)
{
const fs::path imagePath = fs::path(currentPath);
if (boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
{
pathToAmbiant = imagePath.string();
pathToAmbient = imagePath.string();
}
}
}

photometricStereo(imageList, intList, lightMat, mask, pathToAmbiant, PSParameters, normals, albedo);
photometricStereo(imageList, intList, lightMat, mask, pathToAmbient, PSParameters, normals, albedo);

writePSResults(outputPath, normals, albedo);
image::writeImage(outputPath + "/mask.png", mask, image::ImageWriteOptions().toColorSpace(image::EImageColorSpace::NO_CONVERSION));
Expand All @@ -96,7 +96,7 @@ void photometricStereo(const sfmData::SfMData& sfmData,
ALICEVISION_LOG_INFO("SH will soon be available for use in PS. For now, lighting is reduced to directional");
}

std::string pathToAmbiant = "";
std::string pathToAmbient = "";
std::map<IndexT, std::vector<IndexT>> viewsPerPoseId;

for (auto& viewIt : sfmData.getViews())
Expand Down Expand Up @@ -148,15 +148,15 @@ void photometricStereo(const sfmData::SfMData& sfmData,
for (auto& viewId : viewIds)
{
const fs::path imagePath = fs::path(sfmData.getView(viewId).getImage().getImagePath());
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (!boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
{
ALICEVISION_LOG_INFO(" - " << imagePath.string());
imageList.push_back(imagePath.string());
}
else if (PSParameters.removeAmbiant)
else if (PSParameters.removeAmbient)
{
ALICEVISION_LOG_INFO("Remove ambiant light - " << imagePath.string());
pathToAmbiant = imagePath.string();
ALICEVISION_LOG_INFO("Remove ambient light - " << imagePath.string());
pathToAmbient = imagePath.string();
}
}

Expand Down Expand Up @@ -210,7 +210,7 @@ void photometricStereo(const sfmData::SfMData& sfmData,

loadMask(currentMaskPath, mask);

photometricStereo(imageList, intList, lightMat, mask, pathToAmbiant, PSParameters, normals, albedo);
photometricStereo(imageList, intList, lightMat, mask, pathToAmbient, PSParameters, normals, albedo);

writePSResults(outputPath, normals, albedo, posesIt.first);
image::writeImage(outputPath + "/" + std::to_string(posesIt.first) + "_mask.png",
Expand Down
6 changes: 3 additions & 3 deletions src/aliceVision/photometricStereo/photometricStereo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace photometricStereo {
struct PhotometricSteroParameters
{
size_t SHOrder; // Order of spherical harmonics (lighting)
bool removeAmbiant; // Do we remove ambiant light ? (currently tested)
bool removeAmbient; // Do we remove ambient light ? (currently tested)
bool isRobust; // Do we use the robust version of the algorithm ? (currently tested)
int downscale; // Downscale factor
};
Expand Down Expand Up @@ -65,7 +65,7 @@ void photometricStereo(const sfmData::SfMData& sfmData,
* @param[in] intList List of light intensities
* @param[in] lightMat List of light direction/coefficients (SH)
* @param[in] mask Mask that defines region of interest
* @param[in] pathToAmbiant Path to picture without any additional lighting
* @param[in] pathToAmbient Path to picture without any additional lighting
* @param[in] PSParameters Parameters for the PS algorithm
* @param[out] normals Normal map of the scene
* @param[out] albedo Albedo map of the scene
Expand All @@ -74,7 +74,7 @@ void photometricStereo(const std::vector<std::string>& imageList,
const std::vector<std::array<float, 3>>& intList,
const Eigen::MatrixXf& lightMat,
image::Image<float>& mask,
const std::string& pathToAmbiant,
const std::string& pathToAmbient,
const PhotometricSteroParameters& PSParameters,
image::Image<image::RGBfColor>& normals,
image::Image<image::RGBfColor>& albedo);
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/sphereDetection/sphereDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void sphereDetection(const sfmData::SfMData& sfmData, Ort::Session& session, fs:
const std::string sphereName = std::to_string(viewID.second->getViewId());
const fs::path imagePath = fs::path(sfmData.getView(viewID.second->getViewId()).getImage().getImagePath());

if (boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
continue;

const auto pred = predict(session, imagePath, minScore);
Expand Down
12 changes: 6 additions & 6 deletions src/software/pipeline/main_cameraInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,24 +801,24 @@ int aliceVision_main(int argc, char** argv)
{
for (const auto& poseGroup : poseGroups)
{
bool hasAmbiant = false;
bool hasAmbient = false;

// Photometric stereo : ambiant viewId used for all pictures
// Photometric stereo : ambient viewId used for all pictures
for (const IndexT vId : poseGroup.second)
{
const fs::path imagePath = fs::path(sfmData.getView(vId).getImage().getImagePath());
if (boost::algorithm::icontains(imagePath.stem().string(), "ambiant"))
if (boost::algorithm::icontains(imagePath.stem().string(), "ambient"))
{
hasAmbiant = true;
hasAmbient = true;
for (const auto it : poseGroup.second)
{
// Update poseId with ambiant view id
// Update poseId with ambient view id
sfmData.getView(it).setPoseId(vId);
}
break;
}
}
if (!hasAmbiant)
if (!hasAmbient)
{
// Sort views of the poseGroup per timestamps
std::vector<std::pair<int64_t, IndexT>> sortedViews;
Expand Down
6 changes: 3 additions & 3 deletions src/software/pipeline/main_photometricStereo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ int aliceVision_main(int argc, char** argv)
("pathToJSONLightFile,l", po::value<std::string>(&pathToLightData)->default_value("defaultJSON.txt"),
"Path to light file (JSON). If empty, .txt files are expected in the image folder.")
("SHOrder,s", po::value<size_t>(&PSParameters.SHOrder)->default_value(0),
"Spherical harmonics order, 0 = directional, 1 = directional + ambiant, 2 = second order SH.")
("removeAmbiant,a", po::value<bool>(&PSParameters.removeAmbiant)->default_value(false),
"True if the ambiant light is to be removed on PS images, false otherwise.")
"Spherical harmonics order, 0 = directional, 1 = directional + ambient, 2 = second order SH.")
("removeAmbient,a", po::value<bool>(&PSParameters.removeAmbient)->default_value(false),
"True if the ambient light is to be removed on PS images, false otherwise.")
("isRobust,r", po::value<bool>(&PSParameters.isRobust)->default_value(false),
"True to use the robust algorithm, false otherwise.")
("downscale, d", po::value<int>(&PSParameters.downscale)->default_value(1),
Expand Down

0 comments on commit f71e958

Please sign in to comment.