Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean-up .clang-tidy and apply camelBack case on functions and variables for some modules #1637

Merged
merged 7 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 5 additions & 38 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,cppcoreguidelines-*,modernize-*,readability-*,-readability-braces-around-statements,-modernize-use-auto,-modernize-use-using,-readability-function-size,-readability-identifier-naming,-modernize-pass-by-value,-google-readability-braces-around-statements,-cppcoreguidelines-pro-type-member-init,-modernize-raw-string-literal,-modernize-loop-convert,misc-unused-parameters'
#WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
User: faca
Checks: '-*,readability-identifier-naming'
CheckOptions:
- key: cert-oop11-cpp.UseCERTSemantics
value: '1'
- key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
value: ''
- key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
value: '0'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-emplace.ContainersWithPushBack
value: '::std::vector;::std::list;::std::deque'
- key: modernize-use-emplace.SmartPointers
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
value: '0'
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
value: '0'
...

- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase}
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Apply `clang-format` on modified files
807034b1eb101b19b3bc9b9078a1635460591959
# Estimator states in SfMData: Apply clang-format across all files
938c0e83497c94ef6506c00ded61cf1da00e4ca5
# Reformat src/aliceVision with latest clang-format rules
Expand Down
58 changes: 29 additions & 29 deletions src/aliceVision/calibration/checkerDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool CheckerDetector::process(const image::Image<image::RGBColor>& source, bool
image::Image<float> grayscale;
image::ConvertPixelType(source, &grayscale);

const Vec2 center(grayscale.Width() / 2, grayscale.Height() / 2);
const Vec2 center(grayscale.width() / 2, grayscale.height() / 2);

const double scales[] = {1.0, 0.75, 0.5, 0.25};

Expand Down Expand Up @@ -150,8 +150,8 @@ bool CheckerDetector::process(const image::Image<image::RGBColor>& source, bool
bool CheckerDetector::processLevel(std::vector<Vec2>& corners, const image::Image<float>& input, double scale) const
{
// Get resized size
const unsigned int w = input.Width();
const unsigned int h = input.Height();
const unsigned int w = input.width();
const unsigned int h = input.height();
const unsigned int nw = static_cast<unsigned int>(floor(static_cast<float>(w) * scale));
const unsigned int nh = static_cast<unsigned int>(floor(static_cast<float>(h) * scale));

Expand Down Expand Up @@ -249,10 +249,10 @@ void CheckerDetector::normalizeImage(image::Image<float>& output, const image::I
float min = 0.0f, max = 0.0f;
getMinMax(min, max, input);

output.resize(input.Width(), input.Height());
for (int y = 0; y < output.Height(); ++y)
output.resize(input.width(), input.height());
for (int y = 0; y < output.height(); ++y)
{
for (int x = 0; x < output.Width(); ++x)
for (int x = 0; x < output.width(); ++x)
{
output(y, x) = (input(y, x) - min) / (max - min);
}
Expand All @@ -262,23 +262,23 @@ void CheckerDetector::normalizeImage(image::Image<float>& output, const image::I
void CheckerDetector::computeHessianResponse(image::Image<float>& output, const image::Image<float>& input) const
{
image::Image<float> smoothed;
image::ImageGaussianFilter(input, 1.5, smoothed, 2);
image::imageGaussianFilter(input, 1.5, smoothed, 2);

// First order derivatives
image::Image<float> gx, gy;
ImageXDerivative(smoothed, gx, true);
ImageYDerivative(smoothed, gy, true);
imageXDerivative(smoothed, gx, true);
imageYDerivative(smoothed, gy, true);

// Second order derivatives
image::Image<float> gxx, gxy, gyy;
ImageXDerivative(gx, gxx, true);
ImageXDerivative(gy, gxy, true);
ImageYDerivative(gy, gyy, true);
imageXDerivative(gx, gxx, true);
imageXDerivative(gy, gxy, true);
imageYDerivative(gy, gyy, true);

output.resize(input.Width(), input.Height());
for (int y = 0; y < input.Height(); ++y)
output.resize(input.width(), input.height());
for (int y = 0; y < input.height(); ++y)
{
for (int x = 0; x < input.Width(); ++x)
for (int x = 0; x < input.width(); ++x)
{
output(y, x) = std::abs(gxx(y, x) * gyy(y, x) - 2.0 * gxy(y, x));
}
Expand All @@ -294,10 +294,10 @@ void CheckerDetector::extractCorners(std::vector<Vec2>& rawCorners, const image:
const int radius = 7;

// Find peaks (local maxima) of the Hessian response
image::Image<float> output(hessianResponse.Width(), hessianResponse.Height(), true, 0.0f);
for (int i = radius; i < hessianResponse.Height() - radius; ++i)
image::Image<float> output(hessianResponse.width(), hessianResponse.height(), true, 0.0f);
for (int i = radius; i < hessianResponse.height() - radius; ++i)
{
for (int j = radius; j < hessianResponse.Width() - radius; ++j)
for (int j = radius; j < hessianResponse.width() - radius; ++j)
{
bool isMaximal = true;
const float val = hessianResponse(i, j);
Expand Down Expand Up @@ -330,9 +330,9 @@ void CheckerDetector::getMinMax(float& min, float& max, const image::Image<float
{
min = std::numeric_limits<float>::max();
max = std::numeric_limits<float>::min();
for (int y = 0; y < input.Height(); ++y)
for (int y = 0; y < input.height(); ++y)
{
for (int x = 0; x < input.Width(); ++x)
for (int x = 0; x < input.width(); ++x)
{
min = std::min(min, input(y, x));
max = std::max(max, input(y, x));
Expand All @@ -343,8 +343,8 @@ void CheckerDetector::getMinMax(float& min, float& max, const image::Image<float
void CheckerDetector::refineCorners(std::vector<Vec2>& refinedCorners, const std::vector<Vec2>& rawCorners, const image::Image<float>& input) const
{
image::Image<float> gx, gy;
ImageXDerivative(input, gx, true);
ImageYDerivative(input, gy, true);
imageXDerivative(input, gx, true);
imageYDerivative(input, gy, true);

const int radius = 5;

Expand All @@ -354,9 +354,9 @@ void CheckerDetector::refineCorners(std::vector<Vec2>& refinedCorners, const std
continue;
if (pt.y() < radius)
continue;
if (pt.x() >= gx.Width() - radius)
if (pt.x() >= gx.width() - radius)
continue;
if (pt.y() >= gx.Height() - radius)
if (pt.y() >= gx.height() - radius)
continue;

Eigen::Matrix2d A = Eigen::Matrix2d::Zero();
Expand Down Expand Up @@ -429,7 +429,7 @@ void CheckerDetector::fitCorners(std::vector<CheckerBoardCorner>& refinedCorners
kernel /= norm;

image::Image<float> filtered;
image::ImageConvolution(input, kernel, filtered);
image::imageConvolution(input, kernel, filtered);

Eigen::MatrixXd AtA(6, 6);
Eigen::Vector<double, 6> Atb;
Expand Down Expand Up @@ -515,7 +515,7 @@ void CheckerDetector::fitCorners(std::vector<CheckerBoardCorner>& refinedCorners
break;
}

if (corner(0) < radius || corner(0) >= input.Width() - radius || corner(1) < radius || corner(1) >= input.Height() - radius)
if (corner(0) < radius || corner(0) >= input.width() - radius || corner(1) < radius || corner(1) >= input.height() - radius)
{
isValid = false;
break;
Expand Down Expand Up @@ -1108,8 +1108,8 @@ void CheckerDetector::drawCheckerBoard(image::Image<image::RGBColor>& img, bool
{
for (auto c : _corners)
{
image::DrawLine(c.center.x() + 2.0, c.center.y(), c.center.x() - 2.0, c.center.y(), image::RGBColor(255, 255, 0), &img);
image::DrawLine(c.center.x(), c.center.y() + 2.0, c.center.x(), c.center.y() - 2.0, image::RGBColor(255, 255, 0), &img);
image::drawLine(c.center.x() + 2.0, c.center.y(), c.center.x() - 2.0, c.center.y(), image::RGBColor(255, 255, 0), &img);
image::drawLine(c.center.x(), c.center.y() + 2.0, c.center.x(), c.center.y() - 2.0, image::RGBColor(255, 255, 0), &img);
}

std::vector<image::RGBColor> colors;
Expand Down Expand Up @@ -1151,7 +1151,7 @@ void CheckerDetector::drawCheckerBoard(image::Image<image::RGBColor>& img, bool
const CheckerBoardCorner& c1 = _corners[p1];
const CheckerBoardCorner& c2 = _corners[p2];

image::DrawLineThickness(c1.center.x(), c1.center.y(), c2.center.x(), c2.center.y(), color, 5, &img);
image::drawLineThickness(c1.center.x(), c1.center.y(), c2.center.x(), c2.center.y(), color, 5, &img);
}
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/aliceVision/camera/cameraUndistortImage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void UndistortImage(const image::Image<T>& imageIn,
}

// There is distortion
const Vec2 center(imageIn.Width() * 0.5, imageIn.Height() * 0.5);
const Vec2 center(imageIn.width() * 0.5, imageIn.height() * 0.5);

int widthRoi = intrinsicOutput->w();
int heightRoi = intrinsicOutput->h();
Expand Down Expand Up @@ -69,7 +69,7 @@ void UndistortImage(const image::Image<T>& imageIn,
intrinsicOutput->ima2cam((undistortionOutput) ? undistortionOutput->inverse(undisto_pix) : undisto_pix)));

// pick pixel if it is in the image domain
if (imageIn.Contains(disto_pix(1), disto_pix(0)))
if (imageIn.contains(disto_pix(1), disto_pix(0)))
{
image_ud(y, x) = sampler(imageIn, disto_pix(1), disto_pix(0));
}
Expand All @@ -93,7 +93,7 @@ void UndistortImage(const image::Image<T>& imageIn,
}

// There is distortion
const Vec2 center(imageIn.Width() * 0.5, imageIn.Height() * 0.5);
const Vec2 center(imageIn.width() * 0.5, imageIn.height() * 0.5);
Vec2 ppCorrection(0.0, 0.0);

if (correctPrincipalPoint)
Expand All @@ -105,8 +105,8 @@ void UndistortImage(const image::Image<T>& imageIn,
}
}

int widthRoi = imageIn.Width();
int heightRoi = imageIn.Height();
int widthRoi = imageIn.width();
int heightRoi = imageIn.height();
int xOffset = 0;
int yOffset = 0;
if (roi.defined())
Expand All @@ -130,7 +130,7 @@ void UndistortImage(const image::Image<T>& imageIn,
const Vec2 disto_pix = intrinsicPtr->get_d_pixel(undisto_pix + ppCorrection);

// pick pixel if it is in the image domain
if (imageIn.Contains(disto_pix(1), disto_pix(0)))
if (imageIn.contains(disto_pix(1), disto_pix(0)))
{
image_ud(y, x) = sampler(imageIn, disto_pix(1), disto_pix(0));
}
Expand Down
4 changes: 2 additions & 2 deletions src/aliceVision/colorHarmonization/CommonDataByPair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class CommonDataByPair
std::size_t channelIndex,
const image::Image<ImageType>& image)
{
for (int j = 0; j < mask.Height(); ++j)
for (int j = 0; j < mask.height(); ++j)
{
for (int i = 0; i < mask.Width(); ++i)
for (int i = 0; i < mask.width(); ++i)
{
if ((int)mask(j, i) != 0)
histo.Add(image(j, i)(channelIndex));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class CommonDataByPair_matchedPoints : public CommonDataByPair
const feature::PointFeature& L = _regionsL.at(descType)->Features().at(match._i);
const feature::PointFeature& R = _regionsR.at(descType)->Features().at(match._j);

image::FilledCircle(L.x(), L.y(), (int)_radius, (unsigned char)255, &maskLeft);
image::FilledCircle(R.x(), R.y(), (int)_radius, (unsigned char)255, &maskRight);
image::filledCircle(L.x(), L.y(), (int)_radius, (unsigned char)255, &maskLeft);
image::filledCircle(R.x(), R.y(), (int)_radius, (unsigned char)255, &maskRight);
}
}
return _matchesPerDesc.getNbAllMatches() > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class CommonDataByPair_vldSegment : public CommonDataByPair
image::readImage(_sLeftImage, imageL, image::EImageColorSpace::LINEAR);
image::readImage(_sRightImage, imageR, image::EImageColorSpace::LINEAR);

image::Image<float> imgA(imageL.GetMat().cast<float>());
image::Image<float> imgB(imageR.GetMat().cast<float>());
image::Image<float> imgA(imageL.getMat().cast<float>());
image::Image<float> imgB(imageR.getMat().cast<float>());

std::vector<Pair> matchesFiltered, matchesPair;

Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/dataio/SfMDataFeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SfMDataFeed::FeederImpl
SfMDataFeed::FeederImpl::FeederImpl(const std::string& imagePath, const std::string& calibPath)
: _isInit(false)
{
_isInit = sfmDataIO::Load(_sfmData, imagePath, sfmDataIO::ESfMData(sfmDataIO::ESfMData::VIEWS | sfmDataIO::ESfMData::INTRINSICS));
_isInit = sfmDataIO::load(_sfmData, imagePath, sfmDataIO::ESfMData(sfmDataIO::ESfMData::VIEWS | sfmDataIO::ESfMData::INTRINSICS));

// Order the views according to the frame ID and the intrinsics serial number
std::map<std::string, std::vector<const sfmData::View*>> viewSequences;
Expand Down
6 changes: 3 additions & 3 deletions src/aliceVision/dataio/VideoFeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "VideoFeed.hpp"

#include <aliceVision/system/Logger.hpp>
#include <aliceVision/image/convertion.hpp>
#include <aliceVision/image/conversion.hpp>
#include <aliceVision/image/io.hpp>

#include <opencv2/core.hpp>
Expand Down Expand Up @@ -153,7 +153,7 @@ bool VideoFeed::FeederImpl::readImage(image::Image<float>& imageGray, camera::Pi
image::Image<unsigned char> imageGrayUChar;
if (FeederImpl::readImage(imageGrayUChar, camIntrinsics, mediaPath, hasIntrinsics))
{
imageGray = (imageGrayUChar.GetMat().cast<float>() / 255.f);
imageGray = (imageGrayUChar.getMat().cast<float>() / 255.f);
return true;
}
return false;
Expand All @@ -180,7 +180,7 @@ bool VideoFeed::FeederImpl::readImage(image::Image<unsigned char>& imageGray,
imageGray.resize(grey.cols, grey.rows);
cv::cv2eigen(grey, imageGray);
// ALICEVISION_LOG_DEBUG(grey.channels() << " " << grey.rows << " " << grey.cols);
// ALICEVISION_LOG_DEBUG(imageGray.Depth() << " " << imageGray.Height() << " " << imageGray.Width());
// ALICEVISION_LOG_DEBUG(imageGray.Depth() << " " << imageGray.height() << " " << imageGray.width());
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/aliceVision/depthMap/NormalMapEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void NormalMapEstimator::compute(int cudaDeviceId, const std::vector<int>& cams)
mvsUtils::readMap(rc, _mp, mvsUtils::EFileType::depthMapFiltered, in_depthMap);

// get input depth map width / height
const int width = in_depthMap.Width();
const int height = in_depthMap.Height();
const int width = in_depthMap.width();
const int height = in_depthMap.height();

// default tile parameters, no tiles
const mvsUtils::TileParams tileParams;
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/depthMap/cuda/host/DeviceCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void DeviceCache::addMipmapImage(int camId,
mvsUtils::ImagesCache<image::Image<image::RGBAfColor>>::ImgSharedPtr img = imageCache.getImg_sync(camId);

// allocate the full size host-sided image buffer
CudaSize<2> imgSize(img->Width(), img->Height());
CudaSize<2> imgSize(img->width(), img->height());
CudaHostMemoryHeap<CudaRGBA, 2> img_hmh(imgSize);

// copy image from imageCache to CUDA host-side image buffer
Expand Down
12 changes: 6 additions & 6 deletions src/aliceVision/depthMap/volumeIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void exportSimilarityVolume(const CudaHostMemoryHeap<TSim, 3>& in_volumeSim_hmh,
}
}

sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

void exportSimilarityVolumeCross(const CudaHostMemoryHeap<TSim, 3>& in_volumeSim_hmh,
Expand Down Expand Up @@ -242,7 +242,7 @@ void exportSimilarityVolumeCross(const CudaHostMemoryHeap<TSim, 3>& in_volumeSim
}
}

sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

void exportSimilarityVolumeCross(const CudaHostMemoryHeap<TSimRefine, 3>& in_volumeSim_hmh,
Expand Down Expand Up @@ -300,7 +300,7 @@ void exportSimilarityVolumeCross(const CudaHostMemoryHeap<TSimRefine, 3>& in_vol
}
}

sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

void exportSimilarityVolumeTopographicCut(const CudaHostMemoryHeap<TSim, 3>& in_volumeSim_hmh,
Expand Down Expand Up @@ -372,7 +372,7 @@ void exportSimilarityVolumeTopographicCut(const CudaHostMemoryHeap<TSim, 3>& in_
}

// write point cloud
sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

void exportSimilarityVolumeTopographicCut(const CudaHostMemoryHeap<TSimRefine, 3>& in_volumeSim_hmh,
Expand Down Expand Up @@ -437,7 +437,7 @@ void exportSimilarityVolumeTopographicCut(const CudaHostMemoryHeap<TSimRefine, 3
}

// write point cloud
sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

inline unsigned char float_to_uchar(float v)
Expand Down Expand Up @@ -498,7 +498,7 @@ void exportColorVolume(const CudaHostMemoryHeap<float4, 3>& in_volumeSim_hmh,
}
}

sfmDataIO::Save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
sfmDataIO::save(pointCloud, filepath, sfmDataIO::ESfMData::STRUCTURE);
}

} // namespace depthMap
Expand Down
Loading
Loading